summaryrefslogtreecommitdiff
path: root/app/helpers/notifications_helper.rb
diff options
context:
space:
mode:
authorFelipe Artur <felipefac@gmail.com>2016-06-06 12:50:54 -0300
committerFelipe Artur <felipefac@gmail.com>2016-06-10 10:58:13 -0300
commit8f6d43e0fea3ce62ec2e8e211755e557f19c51fd (patch)
tree72930d029dd905d7630ec07dd65acb0ac4b0739c /app/helpers/notifications_helper.rb
parentf29fd65cdde1d769fc89f0cc57ea989765b5068f (diff)
downloadgitlab-ce-8f6d43e0fea3ce62ec2e8e211755e557f19c51fd.tar.gz
Remove notification level from user model
Diffstat (limited to 'app/helpers/notifications_helper.rb')
-rw-r--r--app/helpers/notifications_helper.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/app/helpers/notifications_helper.rb b/app/helpers/notifications_helper.rb
index b8e64b3890a..9769458f79e 100644
--- a/app/helpers/notifications_helper.rb
+++ b/app/helpers/notifications_helper.rb
@@ -61,4 +61,36 @@ module NotificationsHelper
end
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(:notification_level, level, @global_notification_setting.level.to_sym == level) +
+ content_tag(:div, level.to_s.capitalize, class: "level-title") +
+ content_tag(:p, notification_level_description(level))
+ end
+ end
+ end
+
+ html.html_safe
+ end
+
+ def notification_level_description(level)
+ case level
+ when :disabled
+ "You will not get any notifications via email"
+ when :mention
+ "You will receive notifications only for comments in which you were @mentioned"
+ when :participating
+ "You will only receive notifications from related resources (e.g. from your commits or assigned issues)"
+ when :watch
+ "You will receive notifications for any activity"
+ end
+ end
end