From 47e926bec0a9da28daaca7dc92415b25f2301daf Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Sun, 20 Sep 2015 18:28:14 +0200 Subject: Minor code cleanup --- app/helpers/notifications_helper.rb | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'app/helpers/notifications_helper.rb') diff --git a/app/helpers/notifications_helper.rb b/app/helpers/notifications_helper.rb index 4fd06bebc2a..cf11f8e5320 100644 --- a/app/helpers/notifications_helper.rb +++ b/app/helpers/notifications_helper.rb @@ -16,31 +16,31 @@ module NotificationsHelper def notification_list_item(notification_level, user_membership) case notification_level when Notification::N_DISABLED - content_tag(:li, class: active_level_for(user_membership, 'disabled?')) do + content_tag(:li, class: active_level_for(user_membership, Notification::N_DISABLED)) do link_to '#', class: 'update-notification', data: { notification_level: Notification::N_DISABLED } do icon('microphone-slash fw', text: 'Disabled') end end when Notification::N_PARTICIPATING - content_tag(:li, class: active_level_for(user_membership, 'participating?')) do + content_tag(:li, class: active_level_for(user_membership, Notification::N_PARTICIPATING)) do link_to '#', class: 'update-notification', data: { notification_level: Notification::N_PARTICIPATING } do icon('volume-up fw', text: 'Participate') end end when Notification::N_WATCH - content_tag(:li, class: active_level_for(user_membership, 'watch?')) do + content_tag(:li, class: active_level_for(user_membership, Notification::N_WATCH)) do link_to '#', class: 'update-notification', data: { notification_level: Notification::N_WATCH } do icon('eye fw', text: 'Watch') end end when Notification::N_MENTION - content_tag(:li, class: active_level_for(user_membership, 'mention?')) do + content_tag(:li, class: active_level_for(user_membership, Notification::N_MENTION)) do link_to '#', class: 'update-notification', data: { notification_level: Notification::N_MENTION } do icon('at fw', text: 'On mention') end end when Notification::N_GLOBAL - content_tag(:li, class: active_level_for(user_membership, 'global?')) do + content_tag(:li, class: active_level_for(user_membership, Notification::N_GLOBAL)) do link_to '#', class: 'update-notification', data: { notification_level: Notification::N_GLOBAL } do icon('globe fw', text: 'Global') end @@ -55,9 +55,6 @@ module NotificationsHelper end def active_level_for(user_membership, level) - value = Notification.new(user_membership) - if value.send(level) - 'active' - end + 'active' if user_membership.notification_level == level end end -- cgit v1.2.1