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
d45c6eca
Commit
d45c6eca
authored
Nov 01, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactoring label subscription status to accept a project
parent
38f16582
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
app/helpers/labels_helper.rb
app/helpers/labels_helper.rb
+2
-2
app/views/shared/_label.html.haml
app/views/shared/_label.html.haml
+2
-2
No files found.
app/helpers/labels_helper.rb
View file @
d45c6eca
...
@@ -148,10 +148,10 @@ module LabelsHelper
...
@@ -148,10 +148,10 @@ module LabelsHelper
end
end
end
end
def
label_subscription_status
(
label
)
def
label_subscription_status
(
label
,
project
)
case
label
case
label
when
GroupLabel
then
'Subscribing to group labels is currently not supported.'
when
GroupLabel
then
'Subscribing to group labels is currently not supported.'
when
ProjectLabel
then
label
.
subscribed?
(
current_user
)
?
'subscribed'
:
'unsubscribed'
when
ProjectLabel
then
label
.
subscribed?
(
current_user
,
project
)
?
'subscribed'
:
'unsubscribed'
end
end
end
end
...
...
app/views/shared/_label.html.haml
View file @
d45c6eca
...
@@ -20,8 +20,8 @@
...
@@ -20,8 +20,8 @@
=
pluralize
open_issues_count
,
'open issue'
=
pluralize
open_issues_count
,
'open issue'
-
if
current_user
-
if
current_user
%li
.label-subscription
{
data:
toggle_subscription_data
(
label
)
}
%li
.label-subscription
{
data:
toggle_subscription_data
(
label
)
}
%a
.js-subscribe-button.label-subscribe-button.subscription-status
{
role:
"button"
,
href:
"#"
,
data:
{
toggle:
"tooltip"
,
status:
label_subscription_status
(
label
)
}
}
%span
=
label_subscription_toggle_button_text
(
label
)
%span
=
label_subscription_toggle_button_text
(
label
)
%a
.js-subscribe-button.label-subscribe-button.subscription-status
{
role:
"button"
,
href:
"#"
,
data:
{
toggle:
"tooltip"
,
status:
label_subscription_status
(
label
,
@project
)
}
}
-
if
can?
(
current_user
,
:admin_label
,
label
)
-
if
can?
(
current_user
,
:admin_label
,
label
)
%li
%li
=
link_to
'Edit'
,
edit_label_path
(
label
)
=
link_to
'Edit'
,
edit_label_path
(
label
)
...
@@ -36,8 +36,8 @@
...
@@ -36,8 +36,8 @@
-
if
current_user
-
if
current_user
.label-subscription.inline
{
data:
toggle_subscription_data
(
label
)
}
.label-subscription.inline
{
data:
toggle_subscription_data
(
label
)
}
%button
.js-subscribe-button.label-subscribe-button.btn.btn-transparent.btn-action.subscription-status
{
type:
"button"
,
title:
label_subscription_toggle_button_text
(
label
),
data:
{
toggle:
"tooltip"
,
status:
label_subscription_status
(
label
)
}
}
%span
.sr-only
=
label_subscription_toggle_button_text
(
label
)
%span
.sr-only
=
label_subscription_toggle_button_text
(
label
)
%button
.js-subscribe-button.label-subscribe-button.btn.btn-transparent.btn-action.subscription-status
{
type:
"button"
,
title:
label_subscription_toggle_button_text
(
label
,
@project
),
data:
{
toggle:
"tooltip"
,
status:
label_subscription_status
(
label
,
@project
)
}
}
=
icon
(
'eye'
,
class:
'label-subscribe-button-icon'
,
disabled:
label
.
is_a?
(
GroupLabel
))
=
icon
(
'eye'
,
class:
'label-subscribe-button-icon'
,
disabled:
label
.
is_a?
(
GroupLabel
))
=
icon
(
'spinner spin'
,
class:
'label-subscribe-button-loading'
)
=
icon
(
'spinner spin'
,
class:
'label-subscribe-button-loading'
)
...
...
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