summaryrefslogtreecommitdiff
path: root/app/views/profiles
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-03-28 18:17:42 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-03-30 10:44:20 +0200
commit359157c097993a9b917ca590e128e85cf358d95d (patch)
tree08a29f8221442621506f38fa8dce7095d630f7d0 /app/views/profiles
parent73c5a3410596165244bfa3d2f657c313ec1c558c (diff)
downloadgitlab-ce-359157c097993a9b917ca590e128e85cf358d95d.tar.gz
Introduce NotificationSetting to user interface
* visiting project will create notification setting if missing * change notification setting per project even without membership * use notification settings instead of membership on profile page Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/views/profiles')
-rw-r--r--app/views/profiles/notifications/_settings.html.haml18
-rw-r--r--app/views/profiles/notifications/show.html.haml30
2 files changed, 23 insertions, 25 deletions
diff --git a/app/views/profiles/notifications/_settings.html.haml b/app/views/profiles/notifications/_settings.html.haml
index d0d044136f6..c32de0b9925 100644
--- a/app/views/profiles/notifications/_settings.html.haml
+++ b/app/views/profiles/notifications/_settings.html.haml
@@ -1,17 +1,17 @@
%li.notification-list-item
%span.notification.fa.fa-holder.append-right-5
- - if notification.global?
- = notification_icon(@notification)
+ - if setting.global?
+ = notification_icon(current_user.notification_level)
- else
- = notification_icon(notification)
+ = notification_icon(setting.level)
%span.str-truncated
- - if membership.kind_of? GroupMember
- = link_to membership.group.name, membership.group
+ - if setting.source.kind_of? Project
+ = link_to_project(setting.source)
- else
- = link_to_project(membership.project)
+ = link_to setting.source.name, group_path(setting.source)
.pull-right
= form_tag profile_notifications_path, method: :put, remote: true, class: 'update-notifications' do
- = hidden_field_tag :notification_type, type, id: dom_id(membership, 'notification_type')
- = hidden_field_tag :notification_id, membership.id, id: dom_id(membership, 'notification_id')
- = select_tag :notification_level, options_for_select(Notification.options_with_labels, notification.level), class: 'form-control trigger-submit'
+ = hidden_field_tag :notification_id, setting.id
+ = hidden_field_tag :notification_level, setting.level
+ = select_tag :notification_level, options_for_select(User.notification_levels.keys, setting.level), class: 'form-control trigger-submit'
diff --git a/app/views/profiles/notifications/show.html.haml b/app/views/profiles/notifications/show.html.haml
index de80abd7f4d..f6900f61b2d 100644
--- a/app/views/profiles/notifications/show.html.haml
+++ b/app/views/profiles/notifications/show.html.haml
@@ -26,29 +26,29 @@
.form-group
= f.label :notification_level, class: 'label-light'
.radio
- = f.label :notification_level, value: Notification::N_DISABLED do
- = f.radio_button :notification_level, Notification::N_DISABLED
+ = f.label :notification_level, value: :disabled do
+ = f.radio_button :notification_level, :disabled
.level-title
Disabled
%p You will not get any notifications via email
.radio
- = f.label :notification_level, value: Notification::N_MENTION do
- = f.radio_button :notification_level, Notification::N_MENTION
+ = f.label :notification_level, value: :mention do
+ = f.radio_button :notification_level, :mention
.level-title
On Mention
%p You will receive notifications only for comments in which you were @mentioned
.radio
- = f.label :notification_level, value: Notification::N_PARTICIPATING do
- = f.radio_button :notification_level, Notification::N_PARTICIPATING
+ = f.label :notification_level, value: :participating do
+ = f.radio_button :notification_level, :participating
.level-title
Participating
%p You will only receive notifications from related resources (e.g. from your commits or assigned issues)
.radio
- = f.label :notification_level, value: Notification::N_WATCH do
- = f.radio_button :notification_level, Notification::N_WATCH
+ = f.label :notification_level, value: :watch do
+ = f.radio_button :notification_level, :watch
.level-title
Watch
%p You will receive notifications for any activity
@@ -57,18 +57,16 @@
= f.submit 'Update settings', class: "btn btn-create"
%hr
%h5
- Groups (#{@group_members.count})
+ Groups (#{@group_notifications.count})
%div
%ul.bordered-list
- - @group_members.each do |group_member|
- - notification = Notification.new(group_member)
- = render 'settings', type: 'group', membership: group_member, notification: notification
+ - @group_notifications.each do |setting|
+ = render 'settings', setting: setting
%h5
- Projects (#{@project_members.count})
+ Projects (#{@project_notifications.count})
%p.account-well
To specify the notification level per project of a group you belong to, you need to be a member of the project itself, not only its group.
.append-bottom-default
%ul.bordered-list
- - @project_members.each do |project_member|
- - notification = Notification.new(project_member)
- = render 'settings', type: 'project', membership: project_member, notification: notification
+ - @project_notifications.each do |setting|
+ = render 'settings', setting: setting