update tags count if tag gets deleted
This commit is contained in:
parent
6c9cb565f1
commit
37a274a568
6 changed files with 56 additions and 14 deletions
|
@ -34,7 +34,7 @@ class Projects::TagsController < Projects::ApplicationController
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { redirect_to project_tags_path }
|
format.html { redirect_to project_tags_path }
|
||||||
format.js { render nothing: true }
|
format.js
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
= nav_link(controller: :tags) do
|
= nav_link(controller: :tags) do
|
||||||
= link_to project_tags_path(@project) do
|
= link_to project_tags_path(@project) do
|
||||||
Tags
|
Tags
|
||||||
%span.badge= @repository.tags.length
|
%span.badge.js-totaltags-count= @repository.tags.length
|
||||||
|
|
||||||
= nav_link(controller: :repositories, action: :stats) do
|
= nav_link(controller: :repositories, action: :stats) do
|
||||||
= link_to stats_project_repository_path(@project) do
|
= link_to stats_project_repository_path(@project) do
|
||||||
|
|
3
app/views/projects/tags/destroy.js.haml
Normal file
3
app/views/projects/tags/destroy.js.haml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
$('.js-totaltags-count').html("#{@repository.tags.size}")
|
||||||
|
- if @repository.tags.size == 0
|
||||||
|
$('.tags').load(document.URL + ' .nothing-here-block').hide().fadeIn(1000)
|
|
@ -12,18 +12,19 @@
|
||||||
Tags give the ability to mark specific points in history as being important
|
Tags give the ability to mark specific points in history as being important
|
||||||
%hr
|
%hr
|
||||||
|
|
||||||
- unless @tags.empty?
|
.tags
|
||||||
%ul.bordered-list
|
- unless @tags.empty?
|
||||||
- @tags.each do |tag|
|
%ul.bordered-list
|
||||||
= render 'tag', tag: @repository.find_tag(tag)
|
- @tags.each do |tag|
|
||||||
|
= render 'tag', tag: @repository.find_tag(tag)
|
||||||
|
|
||||||
= paginate @tags, theme: 'gitlab'
|
= paginate @tags, theme: 'gitlab'
|
||||||
|
|
||||||
- else
|
- else
|
||||||
.nothing-here-block
|
.nothing-here-block
|
||||||
Repository has no tags yet.
|
Repository has no tags yet.
|
||||||
%br
|
|
||||||
%small
|
|
||||||
Use git tag command to add a new one:
|
|
||||||
%br
|
%br
|
||||||
%span.monospace git tag -a v1.4 -m 'version 1.4'
|
%small
|
||||||
|
Use git tag command to add a new one:
|
||||||
|
%br
|
||||||
|
%span.monospace git tag -a v1.4 -m 'version 1.4'
|
||||||
|
|
|
@ -27,5 +27,15 @@ Feature: Project Browse tags
|
||||||
And I submit new tag form with tag that already exists
|
And I submit new tag form with tag that already exists
|
||||||
Then I should see new an error that tag already exists
|
Then I should see new an error that tag already exists
|
||||||
|
|
||||||
|
@javascript
|
||||||
|
Scenario: I delete a tag
|
||||||
|
Given I delete tag 'v1.1.0'
|
||||||
|
Then I should not see tag 'v1.1.0'
|
||||||
|
|
||||||
|
@javascript
|
||||||
|
Scenario: I delete all tags and see info message
|
||||||
|
Given I delete all tags
|
||||||
|
Then I should see tags info message
|
||||||
|
|
||||||
# @wip
|
# @wip
|
||||||
# Scenario: I can download project by tag
|
# Scenario: I can download project by tag
|
||||||
|
|
|
@ -51,4 +51,32 @@ class ProjectBrowseTags < Spinach::FeatureSteps
|
||||||
step 'I should see new an error that tag already exists' do
|
step 'I should see new an error that tag already exists' do
|
||||||
page.should have_content 'Tag already exists'
|
page.should have_content 'Tag already exists'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
step "I delete tag 'v1.1.0'" do
|
||||||
|
within '.tags' do
|
||||||
|
first('.btn-remove').click
|
||||||
|
sleep 0.05
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
step "I should not see tag 'v1.1.0'" do
|
||||||
|
within '.tags' do
|
||||||
|
page.all(visible: true).should_not have_content 'v1.1.0'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
step 'I delete all tags' do
|
||||||
|
within '.tags' do
|
||||||
|
all('.btn-remove').each do |remove|
|
||||||
|
remove.click
|
||||||
|
sleep 0.05
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
step 'I should see tags info message' do
|
||||||
|
within '.tags' do
|
||||||
|
page.should have_content 'Repository has no tags yet.'
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue