summaryrefslogtreecommitdiff
path: root/app/assets
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-03-15 18:08:45 +0000
committerRémy Coutable <remy@rymai.me>2016-03-15 18:08:45 +0000
commitbc590ce63bd2f1af5545b648e6d028a557e7c792 (patch)
tree572c40bc0e3dc45f6970247073c4423284591c92 /app/assets
parentac8c6f24e3070c28ab6f246599c95fd8f3b7e3a5 (diff)
parente90d6ec1d83ff86743e70931b49647eaf3e3e67a (diff)
downloadgitlab-ce-bc590ce63bd2f1af5545b648e6d028a557e7c792.tar.gz
Merge branch '12743-subscribe-to-label' into 'master'
Allow subscribing to labels This implement #12743 and supersedes !2799 (thanks @timothyandrew!). - Subscribe (and unsubscribe) for labels - When an issue/merge request is created, notify all subscribers of all its labels - When an issue/merge request is edited, notify all subscribers of all its newly-added labels ## Done - [x] Verify that a user is signed in to subscribe/unsubscribe from a label. - [x] Merge conflicts - [x] Integration tests - [x] `issuable.subscribed?` should check subscribers and participants - [x] When an issuable is relabeled, notify subscribers of the *newly added* labels only - [x] Screenshots: ### Labels page ![Screen_Shot_2016-03-07_at_19.05.44](/uploads/3e69064e9e1a06ee2e27c778776c1407/Screen_Shot_2016-03-07_at_19.05.44.png) ### HTML email ![Screen_Shot_2016-03-07_at_19.07.36](/uploads/e484e06366a738385f1f6d71b52eecf7/Screen_Shot_2016-03-07_at_19.07.36.png) ### Plain text email ![Screen_Shot_2016-03-07_at_19.07.50](/uploads/dc05f710a8f7ab5eae9f72aa2110e741/Screen_Shot_2016-03-07_at_19.07.50.png) PS: I've set the milestone to 8.6 since it's getting late for 8.5... See merge request !3115
Diffstat (limited to 'app/assets')
-rw-r--r--app/assets/javascripts/subscription.js.coffee34
-rw-r--r--app/assets/stylesheets/pages/labels.scss4
2 files changed, 23 insertions, 15 deletions
diff --git a/app/assets/javascripts/subscription.js.coffee b/app/assets/javascripts/subscription.js.coffee
index 7f41616d4e7..084f0e0dc65 100644
--- a/app/assets/javascripts/subscription.js.coffee
+++ b/app/assets/javascripts/subscription.js.coffee
@@ -1,17 +1,21 @@
class @Subscription
- constructor: (url) ->
- $(".subscribe-button").unbind("click").click (event)=>
- btn = $(event.currentTarget)
- action = btn.find("span").text()
- current_status = $(".subscription-status").attr("data-status")
- btn.prop("disabled", true)
-
- $.post url, =>
- btn.prop("disabled", false)
- status = if current_status == "subscribed" then "unsubscribed" else "subscribed"
- $(".subscription-status").attr("data-status", status)
- action = if status == "subscribed" then "Unsubscribe" else "Subscribe"
- btn.find("span").text(action)
- $(".subscription-status>div").toggleClass("hidden")
+ constructor: (container) ->
+ $container = $(container)
+ @url = $container.attr('data-url')
+ @subscribe_button = $container.find('.subscribe-button')
+ @subscription_status = $container.find('.subscription-status')
+ @subscribe_button.unbind('click').click(@toggleSubscription)
-
+ toggleSubscription: (event) =>
+ btn = $(event.currentTarget)
+ action = btn.find('span').text()
+ current_status = @subscription_status.attr('data-status')
+ btn.prop('disabled', true)
+
+ $.post @url, =>
+ btn.prop('disabled', false)
+ status = if current_status == 'subscribed' then 'unsubscribed' else 'subscribed'
+ @subscription_status.attr('data-status', status)
+ action = if status == 'subscribed' then 'Unsubscribe' else 'Subscribe'
+ btn.find('span').text(action)
+ @subscription_status.find('>div').toggleClass('hidden')
diff --git a/app/assets/stylesheets/pages/labels.scss b/app/assets/stylesheets/pages/labels.scss
index 5ec0966194c..61ee34b695e 100644
--- a/app/assets/stylesheets/pages/labels.scss
+++ b/app/assets/stylesheets/pages/labels.scss
@@ -41,3 +41,7 @@
.color-label {
padding: 3px 4px;
}
+
+.label-subscription {
+ display: inline-block;
+}