Commit 22fcb2f4 authored by Valery Sizov's avatar Valery Sizov

improve UI

parent 1b437ec3
class @Subscription
constructor: (url) ->
$(".subscribe-button").click (event)=>
$(".subscribe-button").unbind("click").click (event)=>
btn = $(event.currentTarget)
action = btn.prop("value")
current_status = $(".sub_status").text().trim()
$(".fa-spinner.subscription").removeClass("hidden")
$(".sub_status").empty()
action = btn.find("span").text()
current_status = $(".subscription-status").attr("data-status")
btn.prop("disabled", true)
$.post url, =>
$(".fa-spinner.subscription").addClass("hidden")
btn.prop("disabled", false)
status = if current_status == "subscribed" then "unsubscribed" else "subscribed"
$(".sub_status").text(status)
$(".subscription-status").attr("data-status", status)
action = if status == "subscribed" then "Unsubscribe" else "Subscribe"
btn.prop("value", action)
btn.find("span").text(action)
$(".subscription-status>div").toggleClass("hidden")
......@@ -31,11 +31,15 @@
.issuable-context-title
%label
Subscription:
%i.fa.fa-spinner.fa-spin.hidden.subscription
%span.sub_status
= @issue.subscribed?(current_user) ? "subscribed" : "unsubscribed"
- subscribe_action = @issue.subscribed?(current_user) ? "Unsubscribe" : "Subscribe"
%input.btn.subscribe-button{:type => "button", :value => subscribe_action}
%button.btn.btn-block.subscribe-button
%i.fa.fa-eye
%span= @issue.subscribed?(current_user) ? "Unsubscribe" : "Subscribe"
- subscribtion_status = @issue.subscribed?(current_user) ? "subscribed" : "unsubscribed"
.subscription-status{"data-status" => subscribtion_status}
.description-block.unsubscribed{class: ( "hidden" if @issue.subscribed?(current_user) )}
You're not receiving notifications from this thread.
.description-block.subscribed{class: ( "hidden" unless @issue.subscribed?(current_user) )}
You're receiving notifications because you're subscribed to this thread.
:coffeescript
$ ->
......
......@@ -33,11 +33,15 @@
.issuable-context-title
%label
Subscription:
%i.fa.fa-spinner.fa-spin.hidden.subscription
%span.sub_status
= @merge_request.subscribed?(current_user) ? "subscribed" : "unsubscribed"
- subscribe_action = @merge_request.subscribed?(current_user) ? "Unsubscribe" : "Subscribe"
%input.btn.subscribe-button{:type => "button", :value => subscribe_action}
%button.btn.btn-block.subscribe-button
%i.fa.fa-eye
%span= @merge_request.subscribed?(current_user) ? "Unsubscribe" : "Subscribe"
- subscribtion_status = @merge_request.subscribed?(current_user) ? "subscribed" : "unsubscribed"
.subscription-status{"data-status" => subscribtion_status}
.description-block.unsubscribed{class: ( "hidden" if @merge_request.subscribed?(current_user) )}
You're not receiving notifications from this thread.
.description-block.subscribed{class: ( "hidden" unless @merge_request.subscribed?(current_user) )}
You're receiving notifications because you're subscribed to this thread.
:coffeescript
$ ->
......
......@@ -19,12 +19,12 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
end
step 'I should see that I am subscribed' do
find(".sub_status").text.should == "subscribed"
find(".subscribe-button span").text.should == "Unsubscribe"
end
step 'I should see that I am unsubscribed' do
sleep 0.2
find(".sub_status").text.should == "unsubscribed"
find(".subscribe-button span").text.should == "Subscribe"
end
step 'I click link "Closed"' do
......
......@@ -57,12 +57,12 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end
step 'I should see that I am subscribed' do
find(".sub_status").text.should == "subscribed"
find(".subscribe-button span").text.should == "Unsubscribe"
end
step 'I should see that I am unsubscribed' do
sleep 0.2
find(".sub_status").text.should == "unsubscribed"
find(".subscribe-button span").text.should == "Subscribe"
end
step 'I click button "Unsubscribe"' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment