X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/89397b66ebc9b8ec82d806fe6a2af2bbefd01161..5185c0d7e1d9aa8ea4abe46e4bbc0927e52e9a66:/apps/workbench/app/assets/javascripts/users.js diff --git a/apps/workbench/app/assets/javascripts/users.js b/apps/workbench/app/assets/javascripts/users.js index c9c69a0a64..ee1c7dda37 100644 --- a/apps/workbench/app/assets/javascripts/users.js +++ b/apps/workbench/app/assets/javascripts/users.js @@ -1,8 +1,15 @@ $(document). + on('notifications:recount', + function() { + var menu = $('.notification-menu'); + n = $('.notification', menu).not('.empty').length; + $('.notification-count', menu).html(n>0 ? n : ''); + }). on('ajax:success', 'form.new_authorized_key', function(e, data, status, xhr) { - $(e.target).parents('div.daxalert').fadeOut('slow', function() { - $('

Key added.

').hide().replaceAll(this).fadeIn('slow'); + $(e.target).parents('.notification').eq(0).fadeOut('slow', function() { + $('
  • SSH key added.
  • ').hide().replaceAll(this).fadeIn('slow'); + $(document).trigger('notifications:recount'); }); }). on('ajax:complete', 'form.new_authorized_key',