Make the tags delete button remote in the tags list

This commit is contained in:
Rémy Coutable 2016-03-01 18:42:56 +01:00
parent 550d314839
commit 722d74c7e9
3 changed files with 10 additions and 2 deletions

View File

@ -34,6 +34,11 @@ class Projects::TagsController < Projects::ApplicationController
def destroy
DeleteTagService.new(project, current_user).execute(params[:id])
redirect_to namespace_project_tags_path(@project.namespace, @project)
respond_to do |format|
format.html do
redirect_to namespace_project_tags_path(@project.namespace, @project)
end
format.js
end
end
end

View File

@ -19,7 +19,7 @@
= icon("pencil")
- if can?(current_user, :admin_project, @project)
= link_to namespace_project_tag_path(@project.namespace, @project, tag.name), class: 'btn btn-grouped btn-xs btn-remove remove-row has_tooltip', title: "Delete tag", method: :delete, data: { confirm: "Deleting the '#{tag.name}' tag cannot be undone. Are you sure?", container: 'body' } do
= link_to namespace_project_tag_path(@project.namespace, @project, tag.name), class: 'btn btn-grouped btn-xs btn-remove remove-row has_tooltip', title: "Delete tag", method: :delete, data: { confirm: "Deleting the '#{tag.name}' tag cannot be undone. Are you sure?", container: 'body' }, remote: true do
= icon("trash-o")
- if commit

View File

@ -0,0 +1,3 @@
$('.js-totaltags-count').html("#{@repository.tags.size}");
- if @repository.tags.empty?
$('.tags').load(document.URL + ' .nothing-here-block').hide().fadeIn(1000)