Projet

Général

Profil

0001-manager-use-ajax-to-refresh-tables-using-search-butt.patch

Frédéric Péters, 28 décembre 2021 17:32

Télécharger (2,69 ko)

Voir les différences:

Subject: [PATCH] manager: use ajax to refresh tables using search button
 (#60118)

 .../static/authentic2/manager/js/manager.js   | 38 +++++++++++++------
 1 file changed, 26 insertions(+), 12 deletions(-)
src/authentic2/manager/static/authentic2/manager/js/manager.js
142 142
          return false;
143 143
        });
144 144
        /* confirmation on submit buttons */
145
        $(document).on('click', 'button', function (e) {
146
          if ($(e.target).data('confirm')) {
147
            if (! confirm($(e.target).data('confirm'))) {
148
              e.preventDefault();
149
              return false;
150
            }
151
          } else if ($(e.target).data('url')) {
145
        $(document).on('click', 'button[data-confirm]', function (e) {
146
          if (! confirm($(e.target).data('confirm'))) {
152 147
            e.preventDefault();
153
            if ($(e.target).attr('rel') == 'popup') {
154
              return displayPopup.apply($(e.target), [e]);
155
            } else {
156
              window.location.href = $(e.target).data('url');
157
            }
148
            return false;
149
          }
150
        });
151
        $(document).on('click', 'button[data-url]', function (e) {
152
          e.preventDefault();
153
          if ($(e.target).attr('rel') == 'popup') {
154
            return displayPopup.apply($(e.target), [e]);
155
          } else {
156
            window.location.href = $(e.target).data('url');
158 157
          }
159 158
        });
160 159
        $(document).on('change', '#id_generate_password', function (e) {
......
197 196
          }, 600);
198 197

  
199 198
        });
199
        $('#search-form button').on('click', function(e) {
200
          e.preventDefault();
201
          $('#search-form').trigger('submit');
202
          return false;
203
        });
204
        $('#search-form').on('submit', function(e) {
205
          var $form = $('#search-form');
206
          if (timer) {
207
            window.clearTimeout(timer);
208
            timer = null;
209
          }
210
          var query = $form.serialize();
211
          update_content('?' + query, {'form': '#search-form', 'values': $form.values()}, true);
212
          return false;
213
        });
200 214
        if ($('#search-form').length) {
201 215
            window.history.replaceState({'form': '#search-form', 'values': $('#search-form').values()}, window.document.title, window.location.href)
202 216
        }
203
-