diff options
author | Rémy Coutable <remy@rymai.me> | 2016-03-01 17:33:13 +0100 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-03-15 18:22:02 +0100 |
commit | 54ec7e959900493b6e9174bf4dfe09ed0afd1e46 (patch) | |
tree | 22b79458e9d5ad2aa8ccf7ae00935c9a14aae33c /app/views/projects/labels | |
parent | 0444fa560acd07255960284f19b1de6499cd5910 (diff) | |
download | gitlab-ce-54ec7e959900493b6e9174bf4dfe09ed0afd1e46.tar.gz |
Improving the original label-subscribing implementation
1. Make the "subscribed" text in Issuable sidebar reflect the labels
subscription status
2. Current user mut be logged-in to toggle issue/MR/label subscription
Diffstat (limited to 'app/views/projects/labels')
-rw-r--r-- | app/views/projects/labels/_label.html.haml | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/app/views/projects/labels/_label.html.haml b/app/views/projects/labels/_label.html.haml index 3b14a925c46..4927d239c1e 100644 --- a/app/views/projects/labels/_label.html.haml +++ b/app/views/projects/labels/_label.html.haml @@ -11,17 +11,15 @@ = pluralize label.open_issues_count, 'open issue' - if current_user - %div{class: "label-subscription", data: {id: label.id}} - - subscribed = label.subscribed?(current_user) - - subscription_status = subscribed ? 'subscribed' : 'unsubscribed' - .subscription-status{data: {status: subscription_status}} - %button.btn.btn-sm.btn-info.subscribe-button{:type => 'button'} - %span= subscribed ? 'Unsubscribe' : 'Subscribe' + .label-subscription{data: {url: toggle_subscription_namespace_project_label_path(@project.namespace, @project, label)}} + .subscription-status{data: {status: label_subscription_status(label)}} + %button.btn.btn-sm.btn-info.subscribe-button + %span= label_subscription_toggle_button_text(label) - if can? current_user, :admin_label, @project = link_to 'Edit', edit_namespace_project_label_path(@project.namespace, @project, label), class: 'btn btn-sm' = link_to 'Delete', namespace_project_label_path(@project.namespace, @project, label), class: 'btn btn-sm btn-remove remove-row', method: :delete, remote: true, data: {confirm: "Remove this label? Are you sure?"} -:javascript - new Subscription("#{toggle_subscription_namespace_project_label_path(@project.namespace, @project, label)}", - ".label-subscription[data-id='#{label.id}']"); +- if current_user + :javascript + new Subscription('##{dom_id(label)} .label-subscription'); |