summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/subscription.js.coffee
diff options
context:
space:
mode:
authorArinde Eniola <eniolaarinde1@gmail.com>2016-04-04 18:38:16 +0100
committerArinde Eniola <eniolaarinde1@gmail.com>2016-04-06 20:27:30 +0100
commitffe2f8e679f7718e5064acb0c2504b2b3cc160de (patch)
tree0121eecc44248732d6d51280953bc50c3a3b6757 /app/assets/javascripts/subscription.js.coffee
parent8d28f94e7bbf09ecf49ae9d7fab8c9a76abeb7ac (diff)
downloadgitlab-ce-ffe2f8e679f7718e5064acb0c2504b2b3cc160de.tar.gz
fix the failing tests and some changes
Diffstat (limited to 'app/assets/javascripts/subscription.js.coffee')
-rw-r--r--app/assets/javascripts/subscription.js.coffee7
1 files changed, 2 insertions, 5 deletions
diff --git a/app/assets/javascripts/subscription.js.coffee b/app/assets/javascripts/subscription.js.coffee
index 6ebd0750ffd..e4b7a3172ec 100644
--- a/app/assets/javascripts/subscription.js.coffee
+++ b/app/assets/javascripts/subscription.js.coffee
@@ -3,22 +3,19 @@ class @Subscription
$container = $(container)
@url = $container.attr('data-url')
@subscribe_button = $container.find('.subscribe-button')
- @subscribe_icon = $container.find('.subscribe-icon')
@subscription_status = $container.find('.subscription-status')
@subscribe_button.unbind('click').click(@toggleSubscription)
- @subscribe_icon.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)
+ btn.addClass('disabled')
$.post @url, =>
- btn.prop('disabled', false)
+ btn.removeClass('disabled')
status = if current_status == 'subscribed' then 'unsubscribed' else 'subscribed'
@subscription_status.attr('data-status', status)
- @subscribe_icon.attr('data-original-title', status)
action = if status == 'subscribed' then 'Unsubscribe' else 'Subscribe'
btn.find('span').text(action)
@subscription_status.find('>div').toggleClass('hidden')