Skip to content

Commit

Permalink
Add 'tag deleted successfully' flash message
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonKhorev committed Nov 9, 2024
1 parent 974366a commit 3c06e24
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/controllers/changeset_tags_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def delete
end

@changeset_tag.delete
flash[:notice] = t ".success", :k => @changeset_tag.k, :v => @changeset_tag.v
redirect_to changeset_tags_path(@changeset)
end
end
2 changes: 2 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,8 @@ en:
tag_not_found:
heading: Changeset tag does not exist
body: "Sorry, tag %{k} could not be found in changeset #%{id}."
delete:
success: Tag %{k}=%{v} deleted successfully.
changesets:
changeset:
no_edits: "(no edits)"
Expand Down
1 change: 1 addition & 0 deletions test/controllers/changeset_tags_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ def test_delete_success
assert_redirected_to changeset_tags_path(changeset)
end
assert_equal({ "tested-2nd-tag-key" => "tested-2nd-tag-value" }, changeset.tags)
assert_match(/tested-1st-tag-key=tested-1st-tag-value deleted successfully/, flash[:notice])
end

def test_delete_success_empty_tag
Expand Down

0 comments on commit 3c06e24

Please sign in to comment.