From 10e035df932b194c13cc319d8db0f41212454cee Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Wed, 8 Feb 2023 14:33:46 +0000 Subject: [PATCH] Refactor trace guidance to avoid raw html in translations Also rearrange to avoid multiple sentences in a heading. --- app/views/traces/index.html.erb | 4 +++- config/locales/en.yml | 6 +++++- test/controllers/traces_controller_test.rb | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/views/traces/index.html.erb b/app/views/traces/index.html.erb index b930491c6..71b25afe0 100644 --- a/app/views/traces/index.html.erb +++ b/app/views/traces/index.html.erb @@ -76,5 +76,7 @@ <%= render "trace_paging_nav", :page => @page, :page_size => @page_size, :traces => @traces, :params => @params %> <% else %> -

<%= t ".empty_html", :upload_link => new_trace_path %>

+

<%= t ".empty_title" %>

+

<%= t ".empty_upload_html", :upload_link => link_to(t(".upload_new"), new_trace_path), + :wiki_link => link_to(t(".wiki_page"), t(".wiki_page_url")) %>

<% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 2f9e20e79..025f24fb0 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2396,7 +2396,11 @@ en: public_traces_from: "Public GPS Traces from %{user}" description: "Browse recent GPS trace uploads" tagged_with: " tagged with %{tags}" - empty_html: "Nothing here yet. Upload a new trace or learn more about GPS tracing on the wiki page." + empty_title: Nothing here yet + empty_upload_html: "%{upload_link} or learn more about GPS tracing on the %{wiki_link}." + upload_new: Upload a new trace + wiki_page: wiki page + wiki_page_url: https://wiki.openstreetmap.org/wiki/Beginners_Guide_1.2 upload_trace: "Upload a trace" all_traces: "All Traces" my_traces: "My Traces" diff --git a/test/controllers/traces_controller_test.rb b/test/controllers/traces_controller_test.rb index 8346debbf..cd9f5f127 100644 --- a/test/controllers/traces_controller_test.rb +++ b/test/controllers/traces_controller_test.rb @@ -756,7 +756,7 @@ class TracesControllerTest < ActionDispatch::IntegrationTest assert_template "index" if traces.empty? - assert_select "h4", /Nothing here yet/ + assert_select "h2", /Nothing here yet/ else assert_select "table#trace_list tbody", :count => 1 do assert_select "tr", :count => traces.length do |rows| -- 2.39.5