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
Jérome Perrin
gitlab-ce
Commits
adcae6eb
Commit
adcae6eb
authored
Sep 14, 2015
by
Patricio Cano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Notification level can now be saved from within the project view.
parent
ab56718f
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
32 additions
and
21 deletions
+32
-21
app/assets/javascripts/project.js.coffee
app/assets/javascripts/project.js.coffee
+6
-0
app/assets/stylesheets/pages/projects.scss
app/assets/stylesheets/pages/projects.scss
+4
-0
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+1
-1
app/helpers/notifications_helper.rb
app/helpers/notifications_helper.rb
+12
-8
app/models/notification.rb
app/models/notification.rb
+1
-1
app/views/projects/buttons/_notifications.html.haml
app/views/projects/buttons/_notifications.html.haml
+8
-11
No files found.
app/assets/javascripts/project.js.coffee
View file @
adcae6eb
...
...
@@ -24,3 +24,9 @@ class @Project
$
.
cookie
(
'hide_no_password_message'
,
'false'
,
{
path
:
path
})
$
(
@
).
parents
(
'.no-password-message'
).
remove
()
e
.
preventDefault
()
$
(
'.update-notification'
).
on
'click'
,
(
e
)
->
e
.
preventDefault
()
level
=
$
(
this
).
data
(
'notification-level'
)
$
(
'#notification_level'
).
val
(
level
)
$
(
'#notification-form'
).
submit
()
\ No newline at end of file
app/assets/stylesheets/pages/projects.scss
View file @
adcae6eb
...
...
@@ -338,3 +338,7 @@ pre.light-well {
margin-top
:
-1px
;
}
}
.inline-form
{
display
:
inline-block
;
}
app/controllers/projects_controller.rb
View file @
adcae6eb
...
...
@@ -82,7 +82,7 @@ class ProjectsController < ApplicationController
if
@project
.
empty_repo?
render
'projects/empty'
else
@membership_id
=
@project
.
project_members
.
where
(
user_id:
current_user
.
id
).
first
@membership_id
=
@project
.
project_members
.
where
(
user_id:
current_user
.
id
).
first
.
id
render
:show
end
else
...
...
app/helpers/notifications_helper.rb
View file @
adcae6eb
...
...
@@ -17,23 +17,27 @@ module NotificationsHelper
case
notification_level
when
Notification
::
N_DISABLED
content_tag
(
:li
)
do
icon
(
'microphone-slash'
)
'Disabled'
link_to
'#'
,
class:
'update-notification'
,
data:
{
notification_level:
Notification
::
N_DISABLED
}
do
icon
(
'microphone-slash'
,
text:
'Disabled'
)
end
end
when
Notification
::
N_PARTICIPATING
content_tag
(
:li
)
do
icon
(
'volume-up'
)
'Participating'
link_to
'#'
,
class:
'update-notification'
,
data:
{
notification_level:
Notification
::
N_PARTICIPATING
}
do
icon
(
'volume-up'
,
text:
'Participating'
)
end
end
when
Notification
::
N_WATCH
content_tag
(
:li
)
do
icon
(
'globe'
)
'Watch'
link_to
'#'
,
class:
'update-notification'
,
data:
{
notification_level:
Notification
::
N_WATCH
}
do
icon
(
'globe'
,
text:
'Watch'
)
end
end
when
Notification
::
N_MENTION
content_tag
(
:li
)
do
icon
(
'at'
)
'Mention'
link_to
'#'
,
class:
'update-notification'
,
data:
{
notification_level:
Notification
::
N_MENTION
}
do
icon
(
'at'
,
text:
'Mention'
)
end
end
else
# do nothing
...
...
app/models/notification.rb
View file @
adcae6eb
...
...
@@ -12,7 +12,7 @@ class Notification
class
<<
self
def
notification_levels
[
N_DISABLED
,
N_
PARTICIPATING
,
N_WATCH
,
N_MENTION
]
[
N_DISABLED
,
N_
MENTION
,
N_PARTICIPATING
,
N_WATCH
]
end
def
options_with_labels
...
...
app/views/projects/buttons/_notifications.html.haml
View file @
adcae6eb
-
if
current_user
and
!
@membership_id
.
nil?
%span
.dropdown
=
form_tag
profile_notifications_path
,
method: :put
,
remote:
true
do
=
form_tag
profile_notifications_path
,
method: :put
,
remote:
true
,
class:
'inline-form'
,
id:
'notification-form'
do
=
hidden_field_tag
:notification_type
,
'project'
=
hidden_field_tag
:notification_id
,
@membership_id
=
hidden_field_tag
:notification_level
%span
.dropdown
%a
.dropdown-toggle.btn.btn-new
{
href:
'#'
,
"data-toggle"
=>
"dropdown"
}
=
icon
(
'bell'
)
Notifications
%ul
.dropdown-menu.dropdown-menu-right.project-home-dropdown
-
Notification
.
notification_levels
.
each
do
|
level
|
-
Notification
.
notification_levels
.
each
do
|
level
|
=
notification_list_item
(
level
)
\ No newline at end of file
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