Projet

Général

Profil

0001-dialog-add-data-autoclose-dialog-option-37253.patch

Lauréline Guérin, 29 octobre 2019 09:48

Télécharger (2,2 ko)

Voir les différences:

Subject: [PATCH] dialog: add data-autoclose-dialog option (#37253)

 gadjo/static/js/gadjo.js | 13 +++++++++++++
 1 file changed, 13 insertions(+)
gadjo/static/js/gadjo.js
47 47
         * attribute, a gadjo:dialog-done event is triggered on success, a
48 48
         * gadjo:dialog-submit-error event is triggered on failure.
49 49
         *
50
         * Set data-autoclose-dialog="true" to close the dialog box after the
51
         * submit.
52
         *
50 53
         * Dialog is modal by default, set data-modal="false" for non-modal
51 54
         * dialogs.
52 55
         */
......
55 58
        var selector = $anchor.data('selector') || 'form:not(.gadjo-popup-ignore)';
56 59
        var title_selector = $anchor.data('title-selector') || '#appbar h2';
57 60
        var inplace_submit = $anchor.data('inplace-submit');
61
        var autoclose_dialog = $anchor.data('autoclose-dialog');
58 62
        var modal = $anchor.data('modal');
59 63
        if (url == '#') {
60 64
            return false;
......
217 221
                                    } else {
218 222
                                        $elem.click();
219 223
                                    }
224
                                    var validated = true;
225
                                    $form.find('input, textarea').each(function() {
226
                                        if ($(this)[0].checkValidity != undefined) {
227
                                            validated &= $(this)[0].checkValidity();
228
                                        }
229
                                    })
230
                                    if (autoclose_dialog & validated) {
231
                                        $content.dialog('destroy');
232
                                    }
220 233
                                }
221 234
                                return false;
222 235
                            };
223
-