diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-09-12 13:39:56 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-09-12 13:39:56 +0300 |
commit | 318d5d93e3ce01096b05063dbc01b9deb2844c66 (patch) | |
tree | fe53e89f43a35ccda0c20510bbd6a765129999ed | |
parent | a6084a7608d0c479173982c65a1729aadaa8114c (diff) | |
parent | 37a274a56861803f8387822062a2d2c1e6662f33 (diff) | |
download | gitlab-ce-318d5d93e3ce01096b05063dbc01b9deb2844c66.tar.gz |
Merge pull request #7522 from Razer6/fix_tags_count
[UX] Update tag count if tag gets deleted via web interface
-rw-r--r-- | app/controllers/projects/tags_controller.rb | 2 | ||||
-rw-r--r-- | app/views/projects/commits/_head.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/tags/destroy.js.haml | 3 | ||||
-rw-r--r-- | app/views/projects/tags/index.html.haml | 25 | ||||
-rw-r--r-- | features/project/commits/tags.feature | 10 | ||||
-rw-r--r-- | features/steps/project/browse_tags.rb | 28 |
6 files changed, 56 insertions, 14 deletions
diff --git a/app/controllers/projects/tags_controller.rb b/app/controllers/projects/tags_controller.rb index 86788b9963b..c80ad8355d5 100644 --- a/app/controllers/projects/tags_controller.rb +++ b/app/controllers/projects/tags_controller.rb @@ -34,7 +34,7 @@ class Projects::TagsController < Projects::ApplicationController respond_to do |format| format.html { redirect_to project_tags_path } - format.js { render nothing: true } + format.js end end end diff --git a/app/views/projects/commits/_head.html.haml b/app/views/projects/commits/_head.html.haml index b636e8ffe16..2dcd84af010 100644 --- a/app/views/projects/commits/_head.html.haml +++ b/app/views/projects/commits/_head.html.haml @@ -12,7 +12,7 @@ = nav_link(controller: :tags) do = link_to project_tags_path(@project) do Tags - %span.badge= @repository.tags.length + %span.badge.js-totaltags-count= @repository.tags.length = nav_link(controller: :repositories, action: :stats) do = link_to stats_project_repository_path(@project) do diff --git a/app/views/projects/tags/destroy.js.haml b/app/views/projects/tags/destroy.js.haml new file mode 100644 index 00000000000..ada6710f940 --- /dev/null +++ b/app/views/projects/tags/destroy.js.haml @@ -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) diff --git a/app/views/projects/tags/index.html.haml b/app/views/projects/tags/index.html.haml index dc3188d43b8..6cbf99239ee 100644 --- a/app/views/projects/tags/index.html.haml +++ b/app/views/projects/tags/index.html.haml @@ -12,18 +12,19 @@ Tags give the ability to mark specific points in history as being important %hr -- unless @tags.empty? - %ul.bordered-list - - @tags.each do |tag| - = render 'tag', tag: @repository.find_tag(tag) +.tags + - unless @tags.empty? + %ul.bordered-list + - @tags.each do |tag| + = render 'tag', tag: @repository.find_tag(tag) - = paginate @tags, theme: 'gitlab' + = paginate @tags, theme: 'gitlab' -- else - .nothing-here-block - Repository has no tags yet. - %br - %small - Use git tag command to add a new one: + - else + .nothing-here-block + Repository has no tags yet. %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' diff --git a/features/project/commits/tags.feature b/features/project/commits/tags.feature index 36c7a6492ff..bea463cb786 100644 --- a/features/project/commits/tags.feature +++ b/features/project/commits/tags.feature @@ -27,5 +27,15 @@ Feature: Project Browse tags And I submit new tag form with tag that 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 # Scenario: I can download project by tag diff --git a/features/steps/project/browse_tags.rb b/features/steps/project/browse_tags.rb index 64c0c284f6c..6ccf5a87927 100644 --- a/features/steps/project/browse_tags.rb +++ b/features/steps/project/browse_tags.rb @@ -51,4 +51,32 @@ class ProjectBrowseTags < Spinach::FeatureSteps step 'I should see new an error that tag already exists' do page.should have_content 'Tag already exists' 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 |