From 3c06e24f3799956de8303ceef2debf57aa1fc6a0 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Sat, 9 Nov 2024 13:37:39 +0300 Subject: [PATCH] Add 'tag deleted successfully' flash message --- app/controllers/changeset_tags_controller.rb | 1 + config/locales/en.yml | 2 ++ test/controllers/changeset_tags_controller_test.rb | 1 + 3 files changed, 4 insertions(+) diff --git a/app/controllers/changeset_tags_controller.rb b/app/controllers/changeset_tags_controller.rb index cda709baa3..799c17c6f3 100644 --- a/app/controllers/changeset_tags_controller.rb +++ b/app/controllers/changeset_tags_controller.rb @@ -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 diff --git a/config/locales/en.yml b/config/locales/en.yml index b62f2e751b..30470e3a8a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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)" diff --git a/test/controllers/changeset_tags_controller_test.rb b/test/controllers/changeset_tags_controller_test.rb index ff271ccc9f..8b9bdbf7d8 100644 --- a/test/controllers/changeset_tags_controller_test.rb +++ b/test/controllers/changeset_tags_controller_test.rb @@ -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