diff options
author | Felipe Artur <felipefac@gmail.com> | 2016-06-17 06:17:20 +0300 |
---|---|---|
committer | Felipe Artur <felipefac@gmail.com> | 2016-06-17 06:17:20 +0300 |
commit | 33c61bd461d21dbb79db18e0c2424f53120e83c0 (patch) | |
tree | 2b0d60fe8b8a9c132c8c25f63131d333821f876e /app/helpers/notifications_helper.rb | |
parent | 24f5f071dcce529a3fbbc887ebce7bfc56353361 (diff) | |
parent | f82ab42d0534950c1ceb458e0152f329df80ae9d (diff) |
Re-use notifications dropdown/modal for user profile
Diffstat (limited to 'app/helpers/notifications_helper.rb')
-rw-r--r-- | app/helpers/notifications_helper.rb | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/app/helpers/notifications_helper.rb b/app/helpers/notifications_helper.rb index 70d56e4ac08..77783cd7640 100644 --- a/app/helpers/notifications_helper.rb +++ b/app/helpers/notifications_helper.rb @@ -64,22 +64,14 @@ module NotificationsHelper end end - def notification_level_radio_buttons - html = "" - - NotificationSetting.levels.each_key do |level| - level = level.to_sym - next if level == :global - - html << content_tag(:div, class: "radio") do - content_tag(:label, { value: level }) do - radio_button_tag(:"global_notification_setting[level]", level, @global_notification_setting.level.to_sym == level) + - content_tag(:div, level.to_s.capitalize, class: "level-title") + - content_tag(:p, notification_description(level)) - end - end - end + # Identifier to trigger individually dropdowns and custom settings modals in the same view + def notifications_menu_identifier(type, notification_setting) + "#{type}-#{notification_setting.user_id}-#{notification_setting.source_id}-#{notification_setting.source_type}" + end - html.html_safe + # Create hidden field to send notification setting source to controller + def hidden_setting_source_input(notification_setting) + return unless notification_setting.source_type + hidden_field_tag "#{notification_setting.source_type.downcase}[id]", notification_setting.source_id end end |