Projet

Général

Profil

0001-notifications-ack-on-click-34244.patch

Frédéric Péters, 23 juin 2019 13:21

Télécharger (1,37 ko)

Voir les différences:

Subject: [PATCH] notifications: ack on click (#34244)

 combo/public/static/js/combo.public.js | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
combo/public/static/js/combo.public.js
252 252
  }).focusout(function() {
253 253
    $('body').removeClass('focus-in');
254 254
  });
255

  
256
  /* notifications */
257
  $('div.cell li.combo-notification').on('click', function(event) {
258
    var target_url = $(this).find('a').attr('href');
259
    if ($(this).hasClass('combo-notification-acked')) {
260
      if (target_url != '#') {
261
        window.location.href = target_url;
262
      }
263
    } else {
264
      var ack_url = $('body').data('api-root') + 'notification/ack/' + $(this).data('combo-notification-id');
265
      $.ajax({
266
         url: ack_url,
267
         success: function(html) {
268
           $(this).addClass('combo-notification-acked');
269
           if (target_url != '#') {
270
             window.location.href = target_url;
271
           }
272
         }
273
      });
274
    }
275
    return false;
276
  });
277

  
255 278
});
256
-