Commit 60a98584 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge pull request #7658 from Razer6/refresh_labels_page_on_delete

Show labels help message if last label is deleted
parents 3a971ca9 bd235519
...@@ -52,7 +52,7 @@ class Projects::LabelsController < Projects::ApplicationController ...@@ -52,7 +52,7 @@ class Projects::LabelsController < Projects::ApplicationController
respond_to do |format| respond_to do |format|
format.html { redirect_to project_labels_path(@project), notice: 'Label was removed' } format.html { redirect_to project_labels_path(@project), notice: 'Label was removed' }
format.js { render nothing: true } format.js
end end
end end
......
- if @project.labels.size == 0
$('.labels').load(document.URL + ' .light-well').hide().fadeIn(1000)
...@@ -7,11 +7,11 @@ ...@@ -7,11 +7,11 @@
Labels Labels
%hr %hr
- if @labels.present? .labels
- if @labels.present?
%ul.bordered-list.manage-labels-list %ul.bordered-list.manage-labels-list
= render @labels = render @labels
= paginate @labels, theme: 'gitlab' = paginate @labels, theme: 'gitlab'
- else
- else
.light-well .light-well
.nothing-here-block Create first label or #{link_to 'generate', generate_project_labels_path(@project), method: :post} default set of labels .nothing-here-block Create first label or #{link_to 'generate', generate_project_labels_path(@project), method: :post} default set of labels
...@@ -24,6 +24,11 @@ Feature: Project Labels ...@@ -24,6 +24,11 @@ Feature: Project Labels
When I remove label 'bug' When I remove label 'bug'
Then I should not see label 'bug' Then I should not see label 'bug'
@javascript
Scenario: I remove all labels
When I delete all labels
Then I should see labels help message
Scenario: I create a label with invalid color Scenario: I create a label with invalid color
Given I visit project "Shop" new label page Given I visit project "Shop" new label page
When I submit new label with invalid color When I submit new label with invalid color
......
...@@ -25,6 +25,22 @@ class ProjectLabels < Spinach::FeatureSteps ...@@ -25,6 +25,22 @@ class ProjectLabels < Spinach::FeatureSteps
end end
end end
step 'I delete all labels' do
within '.labels' do
all('.btn-remove').each do |remove|
remove.click
sleep 0.05
end
end
end
step 'I should see labels help message' do
within '.labels' do
page.should have_content 'Create first label or generate default set of '\
'labels'
end
end
step 'I submit new label \'support\'' do step 'I submit new label \'support\'' do
fill_in 'Title', with: 'support' fill_in 'Title', with: 'support'
fill_in 'Background Color', with: '#F95610' fill_in 'Background Color', with: '#F95610'
......
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