]> git.agnieray.net Git - galette.git/blobdiff - galette/templates/default/elements/scripts.html.twig
Merge branch 'hotfix/1.0.3'
[galette.git] / galette / templates / default / elements / scripts.html.twig
index 89c0ef72c98a477cd9574db2d87f48363a7646b5..544a39ece2411e76b9d36e5f1caf993cab8f4b9b 100644 (file)
         <script type="text/javascript" src="{{ base_path() }}/assets/js/formatting.js"></script>
         <script type="text/javascript" src="{{ base_path() }}/assets/js/summernote.min.js"></script>
         <script type="text/javascript" src="{{ base_path() }}/assets/js/lang/summernote-{{ i18n.getID()|replace({'_': '-'}) }}.min.js"></script>
-        <script language="javascript">
-            function activateMailingEditor() {
-                if(!$('#mailing_html').attr('checked')){
-                    $('#mailing_html').attr('checked', true);
-                }
-
-                $('input#html_editor_active').attr('value', '1');
-                $('#activate_editor').remove();
-                $('#summernote_toggler').html('<a class="ui blue tertiary button" href="javascript:deactivateMailingEditor();" id="deactivate_editor">{{ _T("Deactivate HTML editor") }}</a>');
-
-                $('#mailing_corps').summernote({
-                    lang: '{{ i18n.getID()|replace({'_': '-'}) }}',
-                    disableDragAndDrop: true,
-                    height: 240,
-                    toolbar: [
+        <script type="text/javascript">
+            function activateHtmlEditor(elt, basic) {
+                if (basic === true) {
+                    var _toolbar = [
+                        ['font', ['bold', 'italic', 'strikethrough', 'clear']],
+                        ['para', ['ul', 'ol']],
+                        ['insert', ['link']],
+                        ['view', ['codeview']]
+                    ];
+                } else {
+                    var _toolbar = [
                         ['style', ['style']],
                         ['font', ['bold', 'italic', 'strikethrough', 'clear']],
                         ['para', ['ul', 'ol', 'paragraph']],
                         ['insert', ['link', 'picture']],
-                        ['view', ['codeview', 'help']]
-                    ],
+                        ['view', ['codeview']]
+                    ];
+                }
+                elt.summernote({
+                    lang: '{{ i18n.getID()|replace({'_': '-'}) }}',
+                    disableDragAndDrop: true,
+                    height: 240,
+                    toolbar: _toolbar,
                     styleTags: [
                         'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'
                     ],
                         }
                     }
                 });
-                $('#mailing_corps').summernote('focus');
+                elt.summernote('focus');
+            }
+
+            function deactivateHtmlEditor(elt) {
+                elt.summernote('destroy');
+            }
+
+            function activateMailingEditor() {
+                if(!$('#mailing_html').attr('checked')){
+                    $('#mailing_html').attr('checked', true);
+                }
+
+                $('input#html_editor_active').attr('value', '1');
+                $('#activate_editor').remove();
+                $('#summernote_toggler').html('<a class="ui blue tertiary button" href="javascript:deactivateMailingEditor();" id="deactivate_editor">{{ _T("Deactivate HTML editor") }}</a>');
+
+                activateHtmlEditor($('#mailing_corps'));
             }
             function deactivateMailingEditor() {
-                $('#mailing_corps').summernote('destroy');
+                deactivateHtmlEditor($('#mailing_corps'));
                 $('#deactivate_editor').remove();
                 $('#summernote_toggler').html('<a class="ui blue tertiary button" href="javascript:activateMailingEditor();" id="activate_editor">{{ _T("Activate HTML editor") }}</a>');
             }