summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-11-01 00:04:19 -0200
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-11-15 16:08:21 -0200
commitc56e776fa6ac0c6dc168f30f955e4599b8b8dc4f (patch)
treee506d8f6712d863b47c89c1cf1e06913ca255899
parent70f8f9cedbb72174b1dc29cddddfb13577ec687d (diff)
downloadgitlab-ce-c56e776fa6ac0c6dc168f30f955e4599b8b8dc4f.tar.gz
Refactoring label subscription toggle button text to accept a project
-rw-r--r--app/helpers/labels_helper.rb4
-rw-r--r--app/views/shared/_label.html.haml4
2 files changed, 4 insertions, 4 deletions
diff --git a/app/helpers/labels_helper.rb b/app/helpers/labels_helper.rb
index e1db6007c09..74f6f1b1478 100644
--- a/app/helpers/labels_helper.rb
+++ b/app/helpers/labels_helper.rb
@@ -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
diff --git a/app/views/shared/_label.html.haml b/app/views/shared/_label.html.haml
index b985ce4884e..f3c49870770 100644
--- a/app/views/shared/_label.html.haml
+++ b/app/views/shared/_label.html.haml
@@ -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')