]> git.agnieray.net Git - galette.git/commitdiff
Use simple modal twig include when possible
authorGuillaume AGNIERAY <dev@agnieray.net>
Thu, 23 Feb 2023 12:57:47 +0000 (13:57 +0100)
committerJohan Cwiklinski <johan@x-tnd.be>
Sun, 26 Feb 2023 17:42:46 +0000 (18:42 +0100)
galette/templates/default/pages/configuration_dynamic_fields.html.twig
galette/templates/default/pages/groups_list.html.twig
galette/templates/default/pages/mailing_form.html.twig
galette/templates/default/pages/mailings_list.html.twig
galette/templates/default/pages/member_form.html.twig
galette/templates/default/pages/plugins.html.twig

index 5ab0851faee62418cc9f41dd3e1b67bbfbcb8b89..64b0ff3ac61c0af084c9a8d38625d0989f07a6f5 100644 (file)
                         success: function(res){
                             var _res = $(res);
 
-                            $('body').modal({
-                                class: 'tiny',
-                                title: '{{ _T("New dynamic field") }}',
-                                content: _res,
-                                onApprove: function() {
-                                    $('form').submit();
-                                },
-                                actions: [{
-                                    text    : '{{ _T("Add") }}',
-                                    icon    : 'plus',
-                                    class   : 'icon labeled green approve'
-                                }, {
-                                    text    : '{{ _T("Close")|e('js') }}',
-                                    icon    : 'times',
-                                    class   : 'icon labeled cancel'
-                                }]
-                            }).modal('show');
+                            {% include "elements/js/modal.js.twig" with {
+                                modaltitle: _T("New dynamic field")|e("js"),
+                                modalcontent: "_res",
+                                modal_class: "tiny",
+                                approve_text: _T("Add")|e('js'),
+                                approve_icon: "plus",
+                                approve_color: "green",
+                                cancel_text: _T("Close")|e("js")
+                            } %}
                         },
                         error: function() {
                             alert("{{ _T("An error occurred :(")|e("js") }}");
index b6be444c3cdc22fc92c14ed867f47b864fc3cc7a..e08b456176a06cee3404b244abd3efae590410f4 100644 (file)
             if ( mode == 'managers' ) {
                 _title = '{{ _T("Group managers selection")|e('js') }}';
             }
-            $('body').modal({
-                title: _title,
-                class: 'members-selection fullscreen scrolling',
-                content: res,
-                actions: [{
-                    text    : '{{ _T("Close")|e("js") }}',
-                    icon    : 'times',
-                    class   : 'icon labeled cancel'
-                }]
-            }).modal('show');
+            {% include "elements/js/modal.js.twig" with {
+                modaltitlefromjs: "_title",
+                modalcontent: "res",
+                modal_class: "members-selection fullscreen",
+                modalcontent_class: "scrolling",
+                singlecancelaction: true,
+                cancel_text: _T("Close")|e("js")
+            } %}
             _members_ajax_mapper(res, $('#group_id').val(), mode);
 
         }
index 6c0d59032203a8d2f0e46f03e744cc304855e84b..7eb040f0c3756b07ffbf139b0a08adbf92b2feec 100644 (file)
         });
 
         var _preview_dialog = function(res){
-            $('body').modal({
-                title: '{{ _T("Mailing preview")|e("js") }}',
-                class: 'scrolling',
-                content: res,
-                actions: [{
-                    text    : '{{ _T("Close")|e('js') }}',
-                    icon    : 'times',
-                    class   : 'icon labeled cancel'
-                }]
-            }).modal('show');
+            {% include "elements/js/modal.js.twig" with {
+                modaltitle: _T("Mailing preview")|e("js"),
+                modalcontent: "res",
+                modalcontent_class: "scrolling",
+                singlecancelaction: true,
+                cancel_text: _T("Close")|e("js")
+            } %}
         }
 
         {# Members popup #}
         });
 
         var _members_dialog = function(res){
-            $('body').modal({
-                title: '{{ _T("Members selection")|e("js") }}',
-                class: 'members-selection fullscreen scrolling',
-                content: res,
-                actions: [{
-                    text    : '{{ _T("Close")|e('js') }}',
-                    icon    : 'times'
-                    class   : 'icon labeled cancel'
-                }]
-            }).modal('show');
+            {% include "elements/js/modal.js.twig" with {
+                modaltitle: _T("Members selection")|e("js"),
+                modalcontent: "res",
+                modal_class: "members-selection fullscreen",
+                modalcontent_class: "scrolling",
+                singlecancelaction: true,
+                cancel_text: _T("Close")|e("js")
+            } %}
             _members_ajax_mapper(res);
         }
 
index f669fd2d83d609a3db38d317d9ae790aaa3793d1..ec99ebadfe90e7bc4b5c1f40c003e0a2f433e318 100644 (file)
         });
 
         var _preview_dialog = function(res){
-            $('body').modal({
-                title: '{{ _T("Mailing preview")|e("js") }}',
-                class: 'scrolling',
-                content: res,
-                actions: [{
-                    text    : '{{ _T("Close")|e("js") }}',
-                    icon    : 'times',
-                    class   : 'icon labeled cancel'
-                }]
-            }).modal('show');
+            {% include "elements/js/modal.js.twig" with {
+                modaltitle: _T("Mailing preview")|e("js"),
+                modalcontent: "res",
+                modal_class: "scrolling",
+                singlecancelaction: true,
+                cancel_text: _T("Close")|e("js")
+            } %}
         }
     </script>
 {% endblock %}
index ca2f5f2ef3d1f1dae321aab5247df171e5fd73fb..f3f8f55e54ac40f191b801aa9413efd17b78f1b1 100644 (file)
                     if ( _managed ) {
                         _title = '{{ _T("Managed groups selection")|e('js') }}';
                     }
-                    $('body').modal({
-                        title: _title,
-                        class: 'groups-selection fullscreen scrolling',
-                        content: res,
-                        actions: [{
-                            text    : '{{ _T("Close")|e('js') }}',
-                            icon    :'times',
-                            class   : 'icon labeled cancel'
-                        }]
-                    }).modal('show');
+                    {% include "elements/js/modal.js.twig" with {
+                        modaltitlefromjs: "_title",
+                        modalcontent: "res",
+                        modal_class: "groups-selection fullscreen",
+                        modalcontent_class: "scrolling",
+                        singlecancelaction: true,
+                        cancel_text: _T("Close")|e("js")
+                    } %}
                     _groups_ajax_mapper(res, _groups, _managed);
                 }
 
index 8bd1fd1b15d94fddf65a196e57c3ce20fba07354..5e3f1c56373c07f4ca606e12eb43e09e12b67736 100644 (file)
                     {% include "elements/js/loader.js.twig" %},
                     success: function(res) {
                         var _content = $($.parseHTML(res)).find('div.main-content').children();
-                        $('body').modal({
-                            title: _this.html(),
-                            class: 'large',
-                            classContent: 'scrolling',
-                            content: _content,
-                            actions: [{
-                                text    : '{{ _T("Close")|e('js') }}',
-                                icon    : 'times',
-                                class   : 'icon labeled cancel'
-                            }]
-                        }).modal('show');
+                        {% include "elements/js/modal.js.twig" with {
+                            modaltitlefromjs: "_this.html()",
+                            modalcontent: "_content",
+                            modal_class: "large",
+                            modalcontent_class: "scrolling",
+                            singlecancelaction: true,
+                            cancel_text: _T("Close")|e("js")
+                        } %}
                     },
                     error: function() {
                         alert("{{ _T("An error occurred :(")|e('js') }}");