From 88669ef8097f68ea3a299ce3adf07ac836959adc Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Thu, 29 Feb 2024 12:16:11 +0300 Subject: [PATCH] Move changeset created/closed popup/feed strings to changesets locale --- app/helpers/changesets_helper.rb | 2 +- app/views/changesets/index.atom.builder | 4 ++-- config/locales/en.yml | 6 ++++-- test/controllers/changesets_controller_test.rb | 11 +++++++++-- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/app/helpers/changesets_helper.rb b/app/helpers/changesets_helper.rb index 3a26c2001..f580ba549 100644 --- a/app/helpers/changesets_helper.rb +++ b/app/helpers/changesets_helper.rb @@ -18,7 +18,7 @@ module ChangesetsHelper else action = :closed time = time_ago_in_words(changeset.closed_at, :scope => :"datetime.distance_in_words_ago") - title = safe_join([t("browse.created"), ": ", l(changeset.created_at), " ".html_safe, t("browse.closed"), ": ", l(changeset.closed_at)]) + title = safe_join([t("changesets.show.created", :when => l(changeset.created_at)), " ".html_safe, t("changesets.show.closed", :when => l(changeset.closed_at))]) datetime = changeset.closed_at.xmlschema end diff --git a/app/views/changesets/index.atom.builder b/app/views/changesets/index.atom.builder index 13c6bd5a4..c8ffe1a81 100644 --- a/app/views/changesets/index.atom.builder +++ b/app/views/changesets/index.atom.builder @@ -41,11 +41,11 @@ atom_feed(:language => I18n.locale, :schema_date => 2009, xhtml.style "th { text-align: left } tr { vertical-align: top }" xhtml.table do |table| table.tr do |tr| - tr.th t("browse.created") + tr.th t(".feed.created") tr.td l(changeset.created_at) end table.tr do |tr| - tr.th t("browse.closed") + tr.th t(".feed.closed") tr.td l(changeset.closed_at) end if changeset.user.data_public? diff --git a/config/locales/en.yml b/config/locales/en.yml index aa0725ca6..eb0f034a6 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -308,8 +308,6 @@ en: destroy: success: "Account Deleted." browse: - created: "Created" - closed: "Closed" created_ago_html: "Created %{time_ago}" closed_ago_html: "Closed %{time_ago}" created_ago_by_html: "Created %{time_ago} by %{user}" @@ -448,6 +446,8 @@ en: feed: title: "Changeset %{id}" title_comment: "Changeset %{id} - %{comment}" + created: "Created" + closed: "Closed" belongs_to: "Author" subscribe: heading: Subscribe to the following changeset discussion? @@ -464,6 +464,8 @@ en: body: "Sorry, there is no changeset with the id %{id}. Please check your spelling, or maybe the link you clicked is wrong." show: title: "Changeset: %{id}" + created: "Created: %{when}" + closed: "Closed: %{when}" discussion: Discussion join_discussion: "Log in to join the discussion" still_open: "Changeset still open - discussion will open once the changeset is closed." diff --git a/test/controllers/changesets_controller_test.rb b/test/controllers/changesets_controller_test.rb index 09406e5ff..ce16b1406 100644 --- a/test/controllers/changesets_controller_test.rb +++ b/test/controllers/changesets_controller_test.rb @@ -125,8 +125,9 @@ class ChangesetsControllerTest < ActionDispatch::IntegrationTest # Checks the display of the user changesets listing def test_index_user user = create(:user) - create(:changeset, :user => user) - create(:changeset, :closed, :user => user) + create(:changeset, :user => user, :num_changes => 1) + create(:changeset, :closed, :user => user, :num_changes => 1) + user.reload get history_path(:format => "html", :display_name => user.display_name) assert_response :success @@ -270,6 +271,12 @@ class ChangesetsControllerTest < ActionDispatch::IntegrationTest end end + def test_show_closed_changeset + changeset = create(:changeset, :closed) + + sidebar_browse_check :changeset_path, changeset.id, "changesets/show" + end + def test_show_private_changeset user = create(:user) changeset = create(:changeset, :user => create(:user, :data_public => false)) -- 2.39.5