Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFatih Acet <acetfatih@gmail.com>2016-07-24 23:45:11 +0300
committerFatih Acet <acetfatih@gmail.com>2016-07-24 23:45:11 +0300
commitaaa9509d120524573085e94af9de5cdde83e3271 (patch)
tree3824cffd4cdd132ee9cf75a00a7624f5ccc0dabd /app/assets/javascripts/notifications_dropdown.js
parent56b79181adc0bd6e9abef97ea075c14be971a01a (diff)
ES6ify all the things!
Diffstat (limited to 'app/assets/javascripts/notifications_dropdown.js')
-rw-r--r--app/assets/javascripts/notifications_dropdown.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/app/assets/javascripts/notifications_dropdown.js b/app/assets/javascripts/notifications_dropdown.js
new file mode 100644
index 00000000000..a41e9d3fabe
--- /dev/null
+++ b/app/assets/javascripts/notifications_dropdown.js
@@ -0,0 +1,30 @@
+(function() {
+ this.NotificationsDropdown = (function() {
+ function NotificationsDropdown() {
+ $(document).off('click', '.update-notification').on('click', '.update-notification', function(e) {
+ var form, label, notificationLevel;
+ e.preventDefault();
+ if ($(this).is('.is-active') && $(this).data('notification-level') === 'custom') {
+ return;
+ }
+ notificationLevel = $(this).data('notification-level');
+ label = $(this).data('notification-title');
+ form = $(this).parents('.notification-form:first');
+ form.find('.js-notification-loading').toggleClass('fa-bell fa-spin fa-spinner');
+ form.find('#notification_setting_level').val(notificationLevel);
+ return form.submit();
+ });
+ $(document).off('ajax:success', '.notification-form').on('ajax:success', '.notification-form', function(e, data) {
+ if (data.saved) {
+ return $(e.currentTarget).closest('.notification-dropdown').replaceWith(data.html);
+ } else {
+ return new Flash('Failed to save new settings', 'alert');
+ }
+ });
+ }
+
+ return NotificationsDropdown;
+
+ })();
+
+}).call(this);