Merge pull request #7658 from Razer6/refresh_labels_page_on_delete
Show labels help message if last label is deleted
This commit is contained in:
commit
60a98584f6
5 changed files with 32 additions and 9 deletions
|
@ -52,7 +52,7 @@ class Projects::LabelsController < Projects::ApplicationController
|
|||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to project_labels_path(@project), notice: 'Label was removed' }
|
||||
format.js { render nothing: true }
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
|
|
2
app/views/projects/labels/destroy.js.haml
Normal file
2
app/views/projects/labels/destroy.js.haml
Normal file
|
@ -0,0 +1,2 @@
|
|||
- if @project.labels.size == 0
|
||||
$('.labels').load(document.URL + ' .light-well').hide().fadeIn(1000)
|
|
@ -7,11 +7,11 @@
|
|||
Labels
|
||||
%hr
|
||||
|
||||
- if @labels.present?
|
||||
.labels
|
||||
- if @labels.present?
|
||||
%ul.bordered-list.manage-labels-list
|
||||
= render @labels
|
||||
= paginate @labels, theme: 'gitlab'
|
||||
|
||||
- else
|
||||
- else
|
||||
.light-well
|
||||
.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
|
|||
When I remove 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
|
||||
Given I visit project "Shop" new label page
|
||||
When I submit new label with invalid color
|
||||
|
|
|
@ -25,6 +25,22 @@ class ProjectLabels < Spinach::FeatureSteps
|
|||
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
|
||||
fill_in 'Title', with: 'support'
|
||||
fill_in 'Background Color', with: '#F95610'
|
||||
|
|
Loading…
Reference in a new issue