]> git.agnieray.net Git - galette.git/commitdiff
Fix email testing; closes #1699
authorGuillaume AGNIERAY <dev@agnieray.net>
Mon, 25 Sep 2023 15:41:12 +0000 (17:41 +0200)
committerJohan Cwiklinski <johan@x-tnd.be>
Mon, 25 Sep 2023 16:26:52 +0000 (18:26 +0200)
galette/templates/default/pages/preferences.html.twig

index 8f82aa4fe345aca27e51d894a3bb5a91bbed0619..5080c3fc72e21c4ae8e977e6b030776e763054e0 100644 (file)
                         title: '{{ _T("Enter the email adress")|e('js') }}',
                         class: 'tiny',
                         content: _input,
+                        onApprove: function() {
+                            $.ajax({
+                                url: _this.attr('href'),
+                                type: 'GET',
+                                data: {
+                                    adress: $('#email_adress').val()
+                                },
+                                {% include "elements/js/loader.js.twig" with {
+                                    selector: '#btnmail',
+                                    loader: 'button'
+                                } %},
+                                success: function(res) {
+                                    //display message
+                                    $.ajax({
+                                        url: '{{ url_for('ajaxMessages') }}',
+                                        method: "GET",
+                                        success: function (message) {
+                                            $('#testEmail').prepend(message);
+                                        }
+                                    });
+                                },
+                                error: function () {
+                                    {% include "elements/js/modal.js.twig" with {
+                                        modal_title_twig: _T("An error occurred sending test email :(")|e("js"),
+                                        modal_without_content: true,
+                                        modal_class: "mini",
+                                        modal_deny_only: true,
+                                        modal_cancel_text: _T("Close")|e("js"),
+                                        modal_classname: "redalert",
+                                    } %}
+                                }
+                            });
+                        },
                         actions: [{
                             text    : '{{ _T("Send")|e('js') }}',
                             icon    : 'rocket',
-                            class   : 'icon labeled green approve',
-                            click   : function() {
-                                $.ajax({
-                                    url: _this.attr('href'),
-                                    type: 'GET',
-                                    data: {
-                                        adress: $('#email_adress').val()
-                                    },
-                                    {% include "elements/js/loader.js.twig" with {
-                                        selector: '#btnmail',
-                                        loader: 'button'
-                                    } %},
-                                    success: function(res) {
-                                        //display message
-                                        $.ajax({
-                                            url: '{{ url_for('ajaxMessages') }}',
-                                            method: "GET",
-                                            success: function (message) {
-                                                $('#testEmail').prepend(message);
-                                            }
-                                        });
-                                    },
-                                    error: function () {
-                                        {% include "elements/js/modal.js.twig" with {
-                                            modal_title_twig: _T("An error occurred sending test email :(")|e("js"),
-                                            modal_without_content: true,
-                                            modal_class: "mini",
-                                            modal_deny_only: true,
-                                            modal_cancel_text: _T("Close")|e("js"),
-                                            modal_classname: "redalert",
-                                        } %}
-                                    }
-                                });
-                            }
+                            class   : 'icon labeled green approve'
                         }, {
                             text    : '{{ _T("Cancel")|e('js') }}',
                             icon    : 'times',