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
Léo-Paul Géneau
gitlab-ce
Commits
48d851d2
Commit
48d851d2
authored
Nov 01, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactoring label subscription toggle button text to accept a project
parent
d45c6eca
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 @
48d851d2
...
...
@@ -155,10 +155,10 @@ module LabelsHelper
end
end
def
label_subscription_toggle_button_text
(
label
)
def
label_subscription_toggle_button_text
(
label
,
project
)
case
label
when
GroupLabel
then
'Subscribing to group labels is currently not supported.'
when
ProjectLabel
then
label
.
subscribed?
(
current_user
)
?
'Unsubscribe'
:
'Subscribe'
when
ProjectLabel
then
label
.
subscribed?
(
current_user
,
project
)
?
'Unsubscribe'
:
'Subscribe'
end
end
...
...
app/views/shared/_label.html.haml
View file @
48d851d2
...
...
@@ -20,8 +20,8 @@
=
pluralize
open_issues_count
,
'open issue'
-
if
current_user
%li
.label-subscription
{
data:
toggle_subscription_data
(
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
)
}
}
%span
=
label_subscription_toggle_button_text
(
label
,
@project
)
-
if
can?
(
current_user
,
:admin_label
,
label
)
%li
=
link_to
'Edit'
,
edit_label_path
(
label
)
...
...
@@ -36,8 +36,8 @@
-
if
current_user
.label-subscription.inline
{
data:
toggle_subscription_data
(
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
)
}
}
%span
.sr-only
=
label_subscription_toggle_button_text
(
label
,
@project
)
=
icon
(
'eye'
,
class:
'label-subscribe-button-icon'
,
disabled:
label
.
is_a?
(
GroupLabel
))
=
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