]> git.agnieray.net Git - galette.git/commitdiff
Use redalert style when errors displayed in modals
authorGuillaume AGNIERAY <dev@agnieray.net>
Thu, 23 Feb 2023 11:44:13 +0000 (12:44 +0100)
committerJohan Cwiklinski <johan@x-tnd.be>
Sun, 26 Feb 2023 17:42:46 +0000 (18:42 +0100)
galette/templates/default/elements/list.html.twig
galette/templates/default/pages/configuration_core_fields.html.twig
galette/templates/default/pages/import.html.twig
galette/templates/default/pages/import_model.html.twig
galette/templates/default/pages/mailing_form.html.twig
galette/templates/default/pages/member_show.html.twig
galette/templates/default/pages/reminder.html.twig

index 4e1aa698f75c40e95c9f728fcecdcee13623ddd1..be17eca909836494c8733a0a1a6dc578928f5c51 100644 (file)
         var _checkselection = function() {
             var _checked = $('#listform').find('input[type=checkbox]:checked').length;
             if ( _checked == 0 ) {
-                $('body').modal({
-                    title: '{{ batch.modal.title|e("js") }}',
-                    class: 'tiny',
-                    content: '{{ batch.modal.content|e("js") }}',
-                    actions: [{
-                        text    : '{{ _T("Close")|e("js") }}',
-                        icon    : 'times',
-                        class   : 'icon labeled cancel'
-                    }],
-                    className: {
-                        modal: 'ui redalert modal',
-                        title: 'center aligned header',
-                        content: 'center aligned content',
-                        actions: 'center aligned actions'
-                    }
-                }).modal('show');
+                {% include "elements/js/modal.js.twig" with {
+                    modaltitle: batch.modal.title|e("js"),
+                    modalcontent: batch.modal.content|e("js"),
+                    contentfromtwig: true,
+                    modal_class: "tiny",
+                    singlecancelaction: true,
+                    cancel_text: _T("Close")|e("js"),
+                    modalclassname: "modal: 'ui redalert modal',title: 'center aligned header',content: 'center aligned content',actions: 'center aligned actions'",
+                } %}
                 return false;
             } else {
                 return true;
index ba2df525c629b3219b68697fa0468b37fb9e1c53..3d424afc40ba328d004c10ad0c0ca2c4d4bad870 100644 (file)
                         _w.find('ul').append('<li>' + _val + '</li>');
                     });
 
-                    $('body').modal({
-                        class: 'tiny',
-                        title: _w.find('.header'),
-                        content: _w.find('.content'),
-                        actions: [{
-                            text    : '{{ _T("Close")|e('js') }}',
-                            icon    : 'times',
-                            class   : 'icon labeled cancel'
-                        }]
-                    }).modal('show');
+                    {% include "elements/js/modal.js.twig" with {
+                        modaltitlefromjs: "_w.find('.header')",
+                        modalcontent: "_w.find('.content')",
+                        contentfromtwig: true,
+                        modal_class: "tiny",
+                        singlecancelaction: true,
+                        cancel_text: _T("Close")|e("js"),
+                        modalclassname: "modal: 'ui redalert modal',title: 'center aligned header',content: 'center aligned content',actions: 'center aligned actions'",
+                    } %}
                     return false;
                 } else {
                     return true;
index b32ef42f5d4735c179350b62838d85ae9ae0cdbe..3f78b88f8d6e12f43e4c4c22139e21c1efad5f32 100644 (file)
                     if ( $('input[name=import_file]:checked').length > 0 ) {
                         return true;
                     } else {
-                        $('body').modal({
-                            title: '{{ _T("No file selected")|e("js") }}',
-                            class: 'tiny',
-                            content: '{{ _T("Please make sure to select one file to import.")|e("js") }}',
-                            actions: [{
-                                text    : '{{ _T("Close")|e("js") }}',
-                                icon    : 'times',
-                                class   : 'icon labeled cancel'
-                            }]
-                        }).modal('show');
+                        {% include "elements/js/modal.js.twig" with {
+                            modaltitle: _T("No file selected")|e("js"),
+                            modalcontent: _T("Please make sure to select one file to import.")|e("js"),
+                            contentfromtwig: true,
+                            modal_class: "tiny",
+                            singlecancelaction: true,
+                            cancel_text: _T("Close")|e("js"),
+                            modalclassname: "modal: 'ui redalert modal',title: 'center aligned header',content: 'center aligned content',actions: 'center aligned actions'",
+                        } %}
                         return false;
                     }
                 });
                 $('#upload').click(function(){
                     var _selected = $('#new_file')[0].files.length;
                     if ( _selected == 0 ) {
-                        $('body').modal({
-                            title: '{{ _T("No file to upload")|e("js") }}',
-                            class: 'tiny',
-                            content: '{{ _T("Please make sure to select one file to upload.")|e("js") }}',
-                            actions: [{
-                                text    : '{{ _T("Close")|e("js") }}',
-                                icon    : 'times',
-                                class   : 'icon labeled cancel'
-                            }]
-                        }).modal('show');
+                        {% include "elements/js/modal.js.twig" with {
+                            modaltitle: _T("No file selected")|e("js"),
+                            modalcontent: _T("Please make sure to select one file to upload.")|e("js"),
+                            contentfromtwig: true,
+                            modal_class: "tiny",
+                            singlecancelaction: true,
+                            cancel_text: _T("Close")|e("js"),
+                            modalclassname: "modal: 'ui redalert modal',title: 'center aligned header',content: 'center aligned content',actions: 'center aligned actions'",
+                        } %}
                         return false;
                     } else {
                         return true;
index f63e7a2505c378f47cd62ce6e6c183040c12222f..28afdf1a1529782216cd12a51f7bc483c618ee6f 100644 (file)
         $('#store-model').click(function() {
             var _checked = $('#modelform').find('input[type=checkbox]:checked').length;
             if ( _checked == 0 ) {
-                $('body').modal({
-                    title: '{{ _T("No field selected")|e("js") }}',
-                    class: 'tiny',
-                    content: '{{ _T("Please make sure to select at least one field from the list to perform this action.")|e("js") }}',
-                    actions: [{
-                        text    : '{{ _T("Close")|e("js") }}',
-                        icon    : 'times',
-                        class   : 'icon labeled cancel'
-                    }]
-                }).modal('show');
+                {% include "elements/js/modal.js.twig" with {
+                    modaltitle: _T("No file selected")|e("js"),
+                    modalcontent: _T("Please make sure to select at least one field from the list to perform this action.")|e("js"),
+                    contentfromtwig: true,
+                    modal_class: "tiny",
+                    singlecancelaction: true,
+                    cancel_text: _T("Close")|e("js"),
+                    modalclassname: "modal: 'ui redalert modal',title: 'center aligned header',content: 'center aligned content',actions: 'center aligned actions'",
+                } %}
                 return false;
             } else {
                 return true;
index 7ed97bdafbdc18b1a57d881ffeed69d71019430e..6c0d59032203a8d2f0e46f03e744cc304855e84b 100644 (file)
         $('.rm_attachement').click(function(event){
             event.preventDefault();
             var _link = $(this);
-            $('body').modal({
-                title: '{{ _T("Remove attachment") }}',
-                class: 'tiny',
-                content: '{{ _T("Are you sure you want to remove this attachment?") }}<br/>{{ _T("This will immediately remove attachment from disk and cannot be undo.") }}',
-                onApprove: function() {
-                    window.location.href = '{{ url_for('mailing') }}' + _link.attr('href');
-                },
-                actions: [{
-                    text    : '{{ _T("Remove")|e('js') }}',
-                    icon    : 'trash',
-                    class   : 'icon labeled red approve',
-                }, {
-                    text    : '{{ _T("Cancel")|e('js') }}',
-                    icon    : 'times',
-                    class   : 'icon labeled cancel'
-                }],
-                className: {
-                    'modal': 'ui redalert modal',
-                    'title': 'center aligned header',
-                    'content': 'center aligned content',
-                    'actions': 'center aligned actions'
-                }
-            }).modal('show');
+            {% set modalcontent = _T("Are you sure you want to remove this attachment?") ~ '<br/>' ~ _T("This will immediately remove attachment from disk and cannot be undone.") %}
+            {% include "elements/js/modal.js.twig" with {
+                modaltitle: _T("Remove attachment")|e("js"),
+                modalcontent: modalcontent,
+                contentfromtwig: true,
+                modal_class: "tiny",
+                singlecancelaction: true,
+                modalapprove: "window.location.href = '{{ url_for('mailing') }}' + _link.attr('href');",
+                approve_text: _T("Remove")|e('js'),
+                approve_icon: "trash",
+                approve_color: "red",
+                cancel_text: _T("Cancel")|e("js"),
+                modalclassname: "modal: 'ui redalert modal',title: 'center aligned header',content: 'center aligned content',actions: 'center aligned actions'",
+            } %}
         });
 
         $('#sender').on('change', function() {
index a121d761b9ca7bc6ee5c99d7fb805ae3c982fed3..41120834f3fce724cbfe27ff272c0a1abf52376b 100644 (file)
             {% include "elements/js/photo_dnd.js.twig" %}
 
             $('.notmanaged').click(function(){
-                $('body').modal({
-                    title: '{{ _T("Not managed group")|e('js') }}',
-                    class: 'tiny',
-                    content: '{{ _T("You are not part of managers for the requested group.")|e("js") }}',
-                    actions: [{
-                        text    : '{{ _T("Close")|e('js') }}',
-                        icon    : 'times',
-                        class   : 'icon labeled cancel'
-                    }],
-                    className: {
-                        'modal': 'ui redalert modal',
-                        'title': 'center aligned header',
-                        'content': 'center aligned content',
-                        'actions': 'center aligned actions'
-                    }
-                }).modal('show');
+                {% include "elements/js/modal.js.twig" with {
+                    modaltitle: _T("Not managed group")|e("js"),
+                    modalcontent: _T("You are not part of managers for the requested group.")|e("js"),
+                    contentfromtwig: true,
+                    modal_class: "tiny",
+                    singlecancelaction: true,
+                    cancel_text: _T("Close")|e("js"),
+                    modalclassname: "modal: 'ui redalert modal',title: 'center aligned header',content: 'center aligned content',actions: 'center aligned actions'",
+                } %}
                 return false;
             });
         });
index 743e8b8d62fae9cf7972e4b46d2210e4f9b8d00c..dbfef9edbae9cac8da35fa32c105c7979dff70ae 100644 (file)
                     var _this = $(this);
                     var _checked = _this.find('input[type=checkbox]:checked').length;
                     if ( _checked == 0 ) {
-                        $('body').modal({
-                            title: '{{ _T("No reminder selected")|e("js") }}',
-                            class: 'tiny',
-                            content: '{{ _T("Please make sure to select at least one reminder.")|e("js") }}',
-                            actions: [{
-                                text    : '{{ _T("Close")|e("js") }}',
-                                icon    : 'times',
-                                class   : 'icon labeled cancel'
-                            }],
-                            className: {
-                                'modal': 'ui redalert modal',
-                                'title': 'center aligned header',
-                                'content': 'center aligned content',
-                                'actions': 'center aligned actions'
-                            }
-                        }).modal('show');
+                        {% include "elements/js/modal.js.twig" with {
+                            modaltitle: _T("No reminder selected")|e("js"),
+                            modalcontent: _T("Please make sure to select at least one reminder.")|e("js"),
+                            contentfromtwig: true,
+                            modal_class: "tiny",
+                            singlecancelaction: true,
+                            cancel_text: _T("Close")|e("js"),
+                            modalclassname: "modal: 'ui redalert modal',title: 'center aligned header',content: 'center aligned content',actions: 'center aligned actions'",
+                        } %}
                         return false;
                     } else {
                         return true;