Skip to content

Commit c7e53ff

Browse files
committed
2 parents 528df32 + e751441 commit c7e53ff

File tree

6 files changed

+370
-92
lines changed

6 files changed

+370
-92
lines changed

.babelrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
{ "presets": [ "stage-3" ] }
1+
{ "presets": [ "env", "stage-3", "stage-2" ] }
22

Resources/views/user/add.html.twig

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
{% if form.circles is defined %}
2222
{{ form_row(form.circles) }}
2323
{% endif %}
24+
{{ form_row(form.allowedToConfigureWysiwyg) }}
25+
{% include "EMSCoreBundle:user:wysiwygOptions.html.twig" with {
26+
form: form
27+
} %}
2428
{# {{ form_row(form.expiresAt) }}#}
2529
</div>
2630
<div class="col-md-6">
@@ -34,3 +38,88 @@
3438
</div>
3539
<!-- /.box -->
3640
{% endblock fos_user_content %}
41+
42+
{% block javascripts %}
43+
<script type="text/javascript">
44+
function formatRepo (repo) {
45+
if (repo.loading) return repo.text;
46+
47+
var markup = "<div class='select2-result-repository clearfix'>" +
48+
repo.text + "</div>";
49+
50+
return markup;
51+
}
52+
53+
function formatRepoSelection (repo) {
54+
return repo.text;
55+
}
56+
57+
58+
$(document).ready(function() {
59+
60+
$(".objectpicker").each(function(index){
61+
var environment = $( this ).data('environment');
62+
var type = $( this ).data('type');
63+
var dynamicLoading = $( this ).data('dynamic-loading');
64+
65+
var params = {
66+
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
67+
templateResult: formatRepo, // omitted for brevity, see the source of this page
68+
templateSelection: formatRepoSelection // omitted for brevity, see the source of this page
69+
};
70+
71+
72+
if(dynamicLoading){
73+
params.minimumInputLength = 1,
74+
params.ajax = {
75+
url: '{{ path("elasticsearch.api.search") }}',
76+
dataType: 'json',
77+
delay: 250,
78+
data: function (params) {
79+
return {
80+
q: params.term, // search term
81+
page: params.page,
82+
environment: environment,
83+
type: type
84+
};
85+
},
86+
processResults: function (data, params) {
87+
// parse the results into the format expected by Select2
88+
// since we are using custom formatting functions we do not need to
89+
// alter the remote JSON data, except to indicate that infinite
90+
// scrolling can be used
91+
params.page = params.page || 1;
92+
93+
return {
94+
results: data.items,
95+
pagination: {
96+
more: (params.page * 30) < data.total_count
97+
}
98+
};
99+
},
100+
cache: true
101+
};
102+
}
103+
104+
$( this ).select2(params);
105+
});
106+
107+
$('.datepicker').datepicker({
108+
format: '{{ datepicker_format }}',
109+
todayBtn: true,
110+
todayHighlight: true,
111+
weekStart: {{ datepicker_weekstart }},
112+
daysOfWeekHighlighted: {{ datepicker_daysofweek_highlighted | json_encode }},
113+
daysOfWeekDisabled: [],
114+
multidate: false
115+
});
116+
});
117+
</script>
118+
{% include 'EMSCoreBundle:app:menu.html.twig' with {
119+
'item': 'user-index'
120+
}%}
121+
122+
{% include "EMSCoreBundle:user:wysiwygOptionsJS.html.twig" with {
123+
form: form
124+
} %}
125+
{% endblock javascripts %}

Service/DataService.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,6 @@ public function propagateDataToComputedField(FormInterface $form, array& $object
215215
}
216216
else {
217217
try {
218-
// $this->twig->addExtension($this->appTwig);
219-
// Bugfix because we are always getting the following error (we should not inject the service we load in the construct?):
220-
// Error in template: Unable to register extension "app_extension" as extensions have already been initialized.
221218
$out = $this->twig->createTemplate($template)->render([
222219
'_source' => $objectArray,
223220
'_type' => $type,

Service/PublishService.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use EMS\CoreBundle\Event\RevisionPublishEvent;
99
use EMS\CoreBundle\Event\RevisionUnpublishEvent;
1010
use EMS\CoreBundle\Repository\RevisionRepository;
11-
use EMS\CoreBundle\Twig\AppExtension;
1211
use Doctrine\Bundle\DoctrineBundle\Registry;
1312
use Elasticsearch\Client;
1413
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
@@ -20,7 +19,6 @@
2019
class PublishService
2120
{
2221

23-
protected $twig;
2422
/**@var Registry $doctrine */
2523
protected $doctrine;
2624
/**@var AuthorizationCheckerInterface $authorizationChecker*/

0 commit comments

Comments
 (0)