fix the failing tests and some changes

This commit is contained in:
Arinde Eniola 2016-04-04 18:38:16 +01:00
parent 8d28f94e7b
commit ffe2f8e679
4 changed files with 18 additions and 14 deletions

View file

@ -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')

View file

@ -53,7 +53,7 @@
.label-name {
display: inline-block;
width: 200px;
vertical-align: top;
vertical-align: baseline;
@media (max-width: $screen-xs-min) {
display: block;
@ -85,12 +85,13 @@
.prepend-left-10 {
display: inline-block;
width: 45%;
width: 40%;
vertical-align: text-top;
@media (max-width: $screen-xs-min) {
display: block;
width: 100%;
margin-left: 0px;
margin-left: 0;
padding: 10px 0;
}
}
@ -104,7 +105,13 @@
.action-buttons {
border-color: transparent;
padding: 6px
padding: 6px;
color: $gl-text-color;
vertical-align: initial;
&.subscribe-button {
padding-left: 0;
}
}
i {

View file

@ -14,13 +14,13 @@
.label-subscription{data: {url: toggle_subscription_namespace_project_label_path(@project.namespace, @project, label)}}
.subscription-status{data: {status: label_subscription_status(label)}}
%a.subscribe-icon.btn.action-buttons{data: {toggle: "tooltip", original_title: label_subscription_status(label)}}
%i.fa.fa-rss
%a.subscribe-button.btn.action-buttons{data: {toggle: "tooltip"}}
%span= label_subscription_toggle_button_text(label)
- if can? current_user, :admin_label, @project
= link_to edit_namespace_project_label_path(@project.namespace, @project, label), class: 'btn action-buttons', data: {toggle: "tooltip", original_title: "Edit"} do
= link_to edit_namespace_project_label_path(@project.namespace, @project, label), title: "Edit", class: 'btn action-buttons', data: {toggle: "tooltip"} do
%i.fa.fa-pencil-square-o
= link_to namespace_project_label_path(@project.namespace, @project, label), class: 'btn action-buttons remove-row', method: :delete, remote: true, data: {confirm: "Remove this label? Are you sure?", toggle: "tooltip", original_title: "Delete"} do
= link_to namespace_project_label_path(@project.namespace, @project, label), title: "Delete", class: 'btn action-buttons remove-row', method: :delete, remote: true, data: {confirm: "Remove this label? Are you sure?", toggle: "tooltip"} do
%i.fa.fa-trash-o
- if current_user

View file

@ -15,7 +15,7 @@ class Spinach::Features::ProjectIssuesLabels < Spinach::FeatureSteps
step 'I delete all labels' do
page.within '.labels' do
page.all('.btn-remove').each do |remove|
page.all('.remove-row').each do |remove|
remove.click
sleep 0.05
end