Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
936353ed
Commit
936353ed
authored
Feb 17, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve notification settings page
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
0744eac9
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
88 additions
and
83 deletions
+88
-83
app/assets/stylesheets/sections/dashboard.scss
app/assets/stylesheets/sections/dashboard.scss
+1
-0
app/assets/stylesheets/sections/profile.scss
app/assets/stylesheets/sections/profile.scss
+11
-0
app/helpers/notifications_helper.rb
app/helpers/notifications_helper.rb
+3
-3
app/models/notification.rb
app/models/notification.rb
+21
-6
app/views/profiles/notifications/_settings.html.haml
app/views/profiles/notifications/_settings.html.haml
+15
-29
app/views/profiles/notifications/show.html.haml
app/views/profiles/notifications/show.html.haml
+37
-44
features/steps/profile/profile_notifications.rb
features/steps/profile/profile_notifications.rb
+0
-1
No files found.
app/assets/stylesheets/sections/dashboard.scss
View file @
936353ed
...
@@ -67,6 +67,7 @@
...
@@ -67,6 +67,7 @@
a
{
a
{
display
:
block
;
display
:
block
;
color
:
#333
;
}
}
.project-name
,
.group-name
{
.project-name
,
.group-name
{
...
...
app/assets/stylesheets/sections/profile.scss
View file @
936353ed
...
@@ -114,3 +114,14 @@
...
@@ -114,3 +114,14 @@
height
:
50px
;
height
:
50px
;
}
}
}
}
.global-notifications-form
.level-title
{
font-size
:
15px
;
color
:
#333
;
font-weight
:
bold
;
}
.notification-icon-holder
{
width
:
20px
;
float
:
left
;
}
app/helpers/notifications_helper.rb
View file @
936353ed
module
NotificationsHelper
module
NotificationsHelper
def
notification_icon
(
notification
)
def
notification_icon
(
notification
)
if
notification
.
disabled?
if
notification
.
disabled?
content_tag
:i
,
nil
,
class:
'icon-
circle
cred'
content_tag
:i
,
nil
,
class:
'icon-
volume-off
cred'
elsif
notification
.
participating?
elsif
notification
.
participating?
content_tag
:i
,
nil
,
class:
'icon-
circle
cblue'
content_tag
:i
,
nil
,
class:
'icon-
volume-down
cblue'
elsif
notification
.
watch?
elsif
notification
.
watch?
content_tag
:i
,
nil
,
class:
'icon-
circle
cgreen'
content_tag
:i
,
nil
,
class:
'icon-
volume-up
cgreen'
else
else
content_tag
:i
,
nil
,
class:
'icon-circle-blank cblue'
content_tag
:i
,
nil
,
class:
'icon-circle-blank cblue'
end
end
...
...
app/models/notification.rb
View file @
936353ed
...
@@ -9,12 +9,23 @@ class Notification
...
@@ -9,12 +9,23 @@ class Notification
attr_accessor
:target
attr_accessor
:target
def
self
.
notification_levels
class
<<
self
[
N_DISABLED
,
N_PARTICIPATING
,
N_WATCH
]
def
notification_levels
end
[
N_DISABLED
,
N_PARTICIPATING
,
N_WATCH
]
end
def
self
.
project_notification_levels
[
N_DISABLED
,
N_PARTICIPATING
,
N_WATCH
,
N_GLOBAL
]
def
options_with_labels
{
disabled:
N_DISABLED
,
participating:
N_PARTICIPATING
,
watch:
N_WATCH
,
global:
N_GLOBAL
}
end
def
project_notification_levels
[
N_DISABLED
,
N_PARTICIPATING
,
N_WATCH
,
N_GLOBAL
]
end
end
end
def
initialize
(
target
)
def
initialize
(
target
)
...
@@ -36,4 +47,8 @@ class Notification
...
@@ -36,4 +47,8 @@ class Notification
def
global?
def
global?
target
.
notification_level
==
N_GLOBAL
target
.
notification_level
==
N_GLOBAL
end
end
def
level
target
.
notification_level
end
end
end
app/views/profiles/notifications/_settings.html.haml
View file @
936353ed
%li
%li
.row
%span
.notification-icon-holder
.col-sm-4
-
if
notification
.
global?
%span
=
notification_icon
(
@notification
)
=
notification_icon
(
notification
)
-
else
=
notification_icon
(
notification
)
-
if
membership
.
kind_of?
UsersGroup
=
link_to
membership
.
group
.
name
,
membership
.
group
-
else
=
link_to_project
(
membership
.
project
)
.col-sm-8
=
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'
)
=
label_tag
nil
,
class:
'radio-inline'
do
=
radio_button_tag
:notification_level
,
Notification
::
N_GLOBAL
,
notification
.
global?
,
id:
dom_id
(
membership
,
'notification_level'
),
class:
'trigger-submit'
%span
Use global setting
=
label_tag
nil
,
class:
'radio-inline'
do
=
radio_button_tag
:notification_level
,
Notification
::
N_DISABLED
,
notification
.
disabled?
,
id:
dom_id
(
membership
,
'notification_level'
),
class:
'trigger-submit'
%span
Disabled
=
label_tag
nil
,
class:
'radio-inline'
do
=
radio_button_tag
:notification_level
,
Notification
::
N_PARTICIPATING
,
notification
.
participating?
,
id:
dom_id
(
membership
,
'notification_level'
),
class:
'trigger-submit'
%span
Participating
=
label_tag
nil
,
class:
'radio-inline'
do
=
radio_button_tag
:notification_level
,
Notification
::
N_WATCH
,
notification
.
watch?
,
id:
dom_id
(
membership
,
'notification_level'
),
class:
'trigger-submit'
%span
Watch
%span
.str-truncated
-
if
membership
.
kind_of?
UsersGroup
=
link_to
membership
.
group
.
name
,
membership
.
group
-
else
=
link_to_project
(
membership
.
project
)
.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:
'trigger-submit'
app/views/profiles/notifications/show.html.haml
View file @
936353ed
...
@@ -3,56 +3,49 @@
...
@@ -3,56 +3,49 @@
%p
.light
%p
.light
GitLab uses the email specified in your profile for notifications
GitLab uses the email specified in your profile for notifications
%hr
%hr
.alert.alert-info
=
form_tag
profile_notifications_path
,
method: :put
,
remote:
true
,
class:
'update-notifications form-horizontal global-notifications-form'
do
%p
=
hidden_field_tag
:notification_type
,
'global'
%i
.icon-circle.cred
%strong
Disabled
–
You will not get any notifications via email
%p
%i
.icon-circle.cblue
%strong
Participating
–
You will only receive notifications from related resources (e.g. from your commits or assigned issues)
%p
%i
.icon-circle.cgreen
%strong
Watch
–
You will receive all notifications from projects in which you participate
.row
=
label_tag
:notification_level
,
'Notification level'
,
class:
'control-label'
.col-sm-4
.col-sm-10
%h4
.radio
=
notification_icon
(
@notification
)
=
label_tag
nil
,
class:
''
do
Global setting
.col-sm-8
=
form_tag
profile_notifications_path
,
method: :put
,
remote:
true
,
class:
'update-notifications'
do
=
hidden_field_tag
:notification_type
,
'global'
=
label_tag
nil
,
class:
'radio-inline'
do
=
radio_button_tag
:notification_level
,
Notification
::
N_DISABLED
,
@notification
.
disabled?
,
class:
'trigger-submit'
=
radio_button_tag
:notification_level
,
Notification
::
N_DISABLED
,
@notification
.
disabled?
,
class:
'trigger-submit'
%span
Disabled
.level-title
Disabled
%p
You will not get any notifications via email
=
label_tag
nil
,
class:
'radio-inline'
do
.radio
=
label_tag
nil
,
class:
''
do
=
radio_button_tag
:notification_level
,
Notification
::
N_PARTICIPATING
,
@notification
.
participating?
,
class:
'trigger-submit'
=
radio_button_tag
:notification_level
,
Notification
::
N_PARTICIPATING
,
@notification
.
participating?
,
class:
'trigger-submit'
%span
Participating
.level-title
Participating
%p
You will only receive notifications from related resources (e.g. from your commits or assigned issues)
=
label_tag
nil
,
class:
'radio-inline'
do
.radio
=
label_tag
nil
,
class:
''
do
=
radio_button_tag
:notification_level
,
Notification
::
N_WATCH
,
@notification
.
watch?
,
class:
'trigger-submit'
=
radio_button_tag
:notification_level
,
Notification
::
N_WATCH
,
@notification
.
watch?
,
class:
'trigger-submit'
%span
Watch
.level-title
Watch
%p
You will receive all notifications from projects in which you participate
%br
.clearfix
=
link_to
'#'
,
class:
'js-toggle-visibility-link'
do
%span
.btn.btn-tiny
%i
.icon-chevron-down
%span
Advanced notifications settings
.js-toggle-visibility-container.hide
%hr
%hr
%h4
Groups:
%p
%ul
.bordered-list
You can also specify notification level per group or per project
-
@users_groups
.
each
do
|
users_group
|
%br
-
notification
=
Notification
.
new
(
users_group
)
By default all projects and groups uses notification level set above
=
render
'settings'
,
type:
'group'
,
membership:
users_group
,
notification:
notification
.row.all-notifications
.col-md-6
%h4
Groups:
%ul
.bordered-list
-
@users_groups
.
each
do
|
users_group
|
-
notification
=
Notification
.
new
(
users_group
)
=
render
'settings'
,
type:
'group'
,
membership:
users_group
,
notification:
notification
%h4
Projects:
.col-md-6
%ul
.bordered-list
%h4
Projects:
-
@users_projects
.
each
do
|
users_project
|
%ul
.bordered-list
-
notification
=
Notification
.
new
(
users_project
)
-
@users_projects
.
each
do
|
users_project
|
=
render
'settings'
,
type:
'project'
,
membership:
users_project
,
notification:
notification
-
notification
=
Notification
.
new
(
users_project
)
=
render
'settings'
,
type:
'project'
,
membership:
users_project
,
notification:
notification
features/steps/profile/profile_notifications.rb
View file @
936353ed
...
@@ -8,6 +8,5 @@ class ProfileNotifications < Spinach::FeatureSteps
...
@@ -8,6 +8,5 @@ class ProfileNotifications < Spinach::FeatureSteps
step
'I should see global notifications settings'
do
step
'I should see global notifications settings'
do
page
.
should
have_content
"Notifications settings"
page
.
should
have_content
"Notifications settings"
page
.
should
have_content
"Global setting"
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment