diff options
author | Patricio Cano <suprnova32@gmail.com> | 2015-09-16 19:46:24 -0500 |
---|---|---|
committer | Patricio Cano <suprnova32@gmail.com> | 2015-09-16 19:46:24 -0500 |
commit | 4c98357f16b1acfa793d8a5b28c7147e21f20356 (patch) | |
tree | 4fac132cf08e07b89a44c5cc253727c4c2552924 /app/helpers/notifications_helper.rb | |
parent | de1ffce7391a9e6adf07a8be60cd36bbc95ef2f3 (diff) | |
download | gitlab-ce-4c98357f16b1acfa793d8a5b28c7147e21f20356.tar.gz |
Added Global to the drop downs and updated the label of the button to show the current level instead of `Notifications`
Diffstat (limited to 'app/helpers/notifications_helper.rb')
-rw-r--r-- | app/helpers/notifications_helper.rb | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/app/helpers/notifications_helper.rb b/app/helpers/notifications_helper.rb index 48dc198e4e2..4fd06bebc2a 100644 --- a/app/helpers/notifications_helper.rb +++ b/app/helpers/notifications_helper.rb @@ -24,19 +24,25 @@ module NotificationsHelper when Notification::N_PARTICIPATING content_tag(:li, class: active_level_for(user_membership, 'participating?')) do link_to '#', class: 'update-notification', data: { notification_level: Notification::N_PARTICIPATING } do - icon('volume-up fw', text: 'Participating') + icon('volume-up fw', text: 'Participate') end end when Notification::N_WATCH content_tag(:li, class: active_level_for(user_membership, 'watch?')) do link_to '#', class: 'update-notification', data: { notification_level: Notification::N_WATCH } do - icon('globe fw', text: 'Watch') + icon('eye fw', text: 'Watch') end end when Notification::N_MENTION content_tag(:li, class: active_level_for(user_membership, 'mention?')) do link_to '#', class: 'update-notification', data: { notification_level: Notification::N_MENTION } do - icon('at fw', text: 'Mention') + icon('at fw', text: 'On mention') + end + end + when Notification::N_GLOBAL + content_tag(:li, class: active_level_for(user_membership, 'global?')) do + link_to '#', class: 'update-notification', data: { notification_level: Notification::N_GLOBAL } do + icon('globe fw', text: 'Global') end end else @@ -44,12 +50,14 @@ module NotificationsHelper end end + def notification_label(user_membership) + Notification.new(user_membership).to_s + end + def active_level_for(user_membership, level) value = Notification.new(user_membership) - if value.global? - return 'active' if current_user.notification.send(level) - elsif value.send(level) - return 'active' + if value.send(level) + 'active' end end end |