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
iv
gitlab-ce
Commits
47e926be
Commit
47e926be
authored
Sep 20, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor code cleanup
parent
23f9a645
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
24 deletions
+23
-24
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+3
-2
app/helpers/notifications_helper.rb
app/helpers/notifications_helper.rb
+6
-9
app/views/projects/buttons/_notifications.html.haml
app/views/projects/buttons/_notifications.html.haml
+14
-13
No files found.
app/controllers/projects_controller.rb
View file @
47e926be
...
@@ -86,9 +86,10 @@ class ProjectsController < ApplicationController
...
@@ -86,9 +86,10 @@ class ProjectsController < ApplicationController
if
@project
.
empty_repo?
if
@project
.
empty_repo?
render
'projects/empty'
render
'projects/empty'
else
else
unless
current_user
.
nil?
if
current_user
@membership
=
@project
.
project_member
s
.
find_by_user
_id
(
current_user
.
id
)
@membership
=
@project
.
project_member
_by
_id
(
current_user
.
id
)
end
end
render
:show
render
:show
end
end
else
else
...
...
app/helpers/notifications_helper.rb
View file @
47e926be
...
@@ -16,31 +16,31 @@ module NotificationsHelper
...
@@ -16,31 +16,31 @@ module NotificationsHelper
def
notification_list_item
(
notification_level
,
user_membership
)
def
notification_list_item
(
notification_level
,
user_membership
)
case
notification_level
case
notification_level
when
Notification
::
N_DISABLED
when
Notification
::
N_DISABLED
content_tag
(
:li
,
class:
active_level_for
(
user_membership
,
'disabled?'
))
do
content_tag
(
:li
,
class:
active_level_for
(
user_membership
,
Notification
::
N_DISABLED
))
do
link_to
'#'
,
class:
'update-notification'
,
data:
{
notification_level:
Notification
::
N_DISABLED
}
do
link_to
'#'
,
class:
'update-notification'
,
data:
{
notification_level:
Notification
::
N_DISABLED
}
do
icon
(
'microphone-slash fw'
,
text:
'Disabled'
)
icon
(
'microphone-slash fw'
,
text:
'Disabled'
)
end
end
end
end
when
Notification
::
N_PARTICIPATING
when
Notification
::
N_PARTICIPATING
content_tag
(
:li
,
class:
active_level_for
(
user_membership
,
'participating?'
))
do
content_tag
(
:li
,
class:
active_level_for
(
user_membership
,
Notification
::
N_PARTICIPATING
))
do
link_to
'#'
,
class:
'update-notification'
,
data:
{
notification_level:
Notification
::
N_PARTICIPATING
}
do
link_to
'#'
,
class:
'update-notification'
,
data:
{
notification_level:
Notification
::
N_PARTICIPATING
}
do
icon
(
'volume-up fw'
,
text:
'Participate'
)
icon
(
'volume-up fw'
,
text:
'Participate'
)
end
end
end
end
when
Notification
::
N_WATCH
when
Notification
::
N_WATCH
content_tag
(
:li
,
class:
active_level_for
(
user_membership
,
'watch?'
))
do
content_tag
(
:li
,
class:
active_level_for
(
user_membership
,
Notification
::
N_WATCH
))
do
link_to
'#'
,
class:
'update-notification'
,
data:
{
notification_level:
Notification
::
N_WATCH
}
do
link_to
'#'
,
class:
'update-notification'
,
data:
{
notification_level:
Notification
::
N_WATCH
}
do
icon
(
'eye fw'
,
text:
'Watch'
)
icon
(
'eye fw'
,
text:
'Watch'
)
end
end
end
end
when
Notification
::
N_MENTION
when
Notification
::
N_MENTION
content_tag
(
:li
,
class:
active_level_for
(
user_membership
,
'mention?'
))
do
content_tag
(
:li
,
class:
active_level_for
(
user_membership
,
Notification
::
N_MENTION
))
do
link_to
'#'
,
class:
'update-notification'
,
data:
{
notification_level:
Notification
::
N_MENTION
}
do
link_to
'#'
,
class:
'update-notification'
,
data:
{
notification_level:
Notification
::
N_MENTION
}
do
icon
(
'at fw'
,
text:
'On mention'
)
icon
(
'at fw'
,
text:
'On mention'
)
end
end
end
end
when
Notification
::
N_GLOBAL
when
Notification
::
N_GLOBAL
content_tag
(
:li
,
class:
active_level_for
(
user_membership
,
'global?'
))
do
content_tag
(
:li
,
class:
active_level_for
(
user_membership
,
Notification
::
N_GLOBAL
))
do
link_to
'#'
,
class:
'update-notification'
,
data:
{
notification_level:
Notification
::
N_GLOBAL
}
do
link_to
'#'
,
class:
'update-notification'
,
data:
{
notification_level:
Notification
::
N_GLOBAL
}
do
icon
(
'globe fw'
,
text:
'Global'
)
icon
(
'globe fw'
,
text:
'Global'
)
end
end
...
@@ -55,9 +55,6 @@ module NotificationsHelper
...
@@ -55,9 +55,6 @@ module NotificationsHelper
end
end
def
active_level_for
(
user_membership
,
level
)
def
active_level_for
(
user_membership
,
level
)
value
=
Notification
.
new
(
user_membership
)
'active'
if
user_membership
.
notification_level
==
level
if
value
.
send
(
level
)
'active'
end
end
end
end
end
app/views/projects/buttons/_notifications.html.haml
View file @
47e926be
-
if
current_user
and
!
@membership
.
nil?
-
return
unless
@membership
=
form_tag
profile_notifications_path
,
method: :put
,
remote:
true
,
class:
'inline-form'
,
id:
'notification-form'
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_type
,
'project'
=
hidden_field_tag
:notification_id
,
@membership
.
id
=
hidden_field_tag
:notification_id
,
@membership
.
id
=
hidden_field_tag
:notification_level
=
hidden_field_tag
:notification_level
...
...
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