|
21 | 21 | {% if form.circles is defined %} |
22 | 22 | {{ form_row(form.circles) }} |
23 | 23 | {% endif %} |
| 24 | + {{ form_row(form.allowedToConfigureWysiwyg) }} |
| 25 | + {% include "EMSCoreBundle:user:wysiwygOptions.html.twig" with { |
| 26 | + form: form |
| 27 | + } %} |
24 | 28 | {# {{ form_row(form.expiresAt) }}#} |
25 | 29 | </div> |
26 | 30 | <div class="col-md-6"> |
|
34 | 38 | </div> |
35 | 39 | <!-- /.box --> |
36 | 40 | {% 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 %} |
0 commit comments