diff options
-rw-r--r-- | app/assets/javascripts/subscription.js | 8 | ||||
-rw-r--r-- | app/views/shared/issuable/_sidebar.html.haml | 6 |
2 files changed, 11 insertions, 3 deletions
diff --git a/app/assets/javascripts/subscription.js b/app/assets/javascripts/subscription.js index 5f9a3e00c22..bc68d67615c 100644 --- a/app/assets/javascripts/subscription.js +++ b/app/assets/javascripts/subscription.js @@ -14,6 +14,7 @@ toggleSubscription(event) { const button = event.currentTarget; const buttonSpan = button.querySelector('span'); + const toggleButton = $('.toggle-button'); if (!buttonSpan || button.classList.contains('disabled')) { return; } @@ -33,6 +34,13 @@ ); } else { buttonSpan.innerHTML = isSubscribed ? 'Subscribe' : 'Unsubscribe'; + if (isSubscribed) { + toggleButton.addClass('unsubscribed') + toggleButton.removeClass('subscribed') + } else { + toggleButton.addClass('subscribed') + toggleButton.removeClass('unsubscribed') + } } }); } diff --git a/app/views/shared/issuable/_sidebar.html.haml b/app/views/shared/issuable/_sidebar.html.haml index e49bd5ebb13..2576bb4e2a0 100644 --- a/app/views/shared/issuable/_sidebar.html.haml +++ b/app/views/shared/issuable/_sidebar.html.haml @@ -123,9 +123,9 @@ = icon('rss', 'aria-hidden': 'true') %span.issuable-header-text.hide-collapsed.pull-left Notifications - - subscribtion_status = subscribed ? 'subscribed' : 'unsubscribed' - %button.btn.btn-default.pull-right.js-subscribe-button.issuable-subscribe-button.hide-collapsed{ type: "button" } - %span= subscribed ? 'Unsubscribe' : 'Subscribe' + .toggle-button-container + %button.btn.toggle-button.pull-right.js-subscribe-button.issuable-subscribe-button.hide-collapsed{ type: "button" , class: (subscribed ? "subscribed" : "unsubscribed") } + %span= subscribed ? 'Unsubscribe' : 'Subscribe' - project_ref = cross_project_reference(@project, issuable) .block.project-reference |