diff options
Diffstat (limited to 'app/assets/javascripts/notifications_dropdown.js')
-rw-r--r-- | app/assets/javascripts/notifications_dropdown.js | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/app/assets/javascripts/notifications_dropdown.js b/app/assets/javascripts/notifications_dropdown.js deleted file mode 100644 index d61defed14d..00000000000 --- a/app/assets/javascripts/notifications_dropdown.js +++ /dev/null @@ -1,35 +0,0 @@ -import $ from 'jquery'; -import { Rails } from '~/lib/utils/rails_ujs'; -import { __ } from '~/locale'; -import { deprecatedCreateFlash as Flash } from './flash'; - -export default function notificationsDropdown() { - $(document).on('click', '.update-notification', function updateNotificationCallback(e) { - e.preventDefault(); - - if ($(this).is('.is-active') && $(this).data('notificationLevel') === 'custom') { - return; - } - - const notificationLevel = $(this).data('notificationLevel'); - const form = $(this).parents('.notification-form').first(); - - form.find('.js-notification-loading').toggleClass('spinner'); - if (form.hasClass('no-label')) { - form.find('.js-notification-loading').toggleClass('hidden'); - form.find('.js-notifications-icon').toggleClass('hidden'); - } - form.find('#notification_setting_level').val(notificationLevel); - Rails.fire(form[0], 'submit'); - }); - - $(document).on('ajax:success', '.notification-form', (e) => { - const data = e.detail[0]; - - if (data.saved) { - $(e.currentTarget).closest('.js-notification-dropdown').replaceWith(data.html); - } else { - Flash(__('Failed to save new settings'), 'alert'); - } - }); -} |