From: Anton Khorev Date: Thu, 9 Jan 2025 10:58:38 +0000 (+0300) Subject: Move trace descriptions out of success/failure sentences in emails X-Git-Tag: live~16^2 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/6c0366d2a2407184715ab97bc01410040b9612f5 Move trace descriptions out of success/failure sentences in emails --- diff --git a/app/views/user_mailer/_gpx_description.html.erb b/app/views/user_mailer/_gpx_description.html.erb index 85b4c7cae..d4eefeb25 100644 --- a/app/views/user_mailer/_gpx_description.html.erb +++ b/app/views/user_mailer/_gpx_description.html.erb @@ -1,9 +1,16 @@ -<% trace_name = tag.strong(@trace_name) %> -<% trace_name = link_to(trace_name, @trace_url) if @trace_url %> -<% trace_description = tag.em(@trace_description) %> -<% if @trace_tags.length > 0 %> - <% tags = safe_join @trace_tags.map { |trace_tag| tag.em trace_tag.tag }, ", " %> - <%= t ".description_with_tags_html", :trace_name => trace_name, :trace_description => trace_description, :tags => tags %> -<% else %> - <%= t ".description_with_no_tags_html", :trace_name => trace_name, :trace_description => trace_description %> -<% end %> +

<%= t ".details" %>

+ +
+
<%= t ".filename" %> + <% if @trace_url %> +
<%= link_to(@trace_name, @trace_url) %> + <% else %> +
<%= @trace_name %> + <% end %> +
<%= t ".description" %> +
<%= @trace_description %> + <% if @trace_tags.length > 0 %> +
<%= t ".tags" %> +
<%= @trace_tags.map(&:tag).join(", ") %> + <% end %> +
diff --git a/app/views/user_mailer/_gpx_description.text.erb b/app/views/user_mailer/_gpx_description.text.erb index 6f7a97844..f0ce97e61 100644 --- a/app/views/user_mailer/_gpx_description.text.erb +++ b/app/views/user_mailer/_gpx_description.text.erb @@ -1,8 +1,14 @@ -<% trace_name = @trace_name %> -<% trace_description = @trace_description %> +<%= t ".details" %> + +<%= t ".filename" %> + <%= @trace_name %> +<% if @trace_url %> +<%= t ".url" %> + <%= @trace_url %> +<% end %> +<%= t ".description" %> + <%= @trace_description %> <% if @trace_tags.length > 0 %> - <% tags = @trace_tags.map { |trace_tag| trace_tag.tag }.join(", ") %> - <%= t ".description_with_tags", :trace_name => trace_name, :trace_description => trace_description, :tags => tags %> -<% else %> - <%= t ".description_with_no_tags", :trace_name => trace_name, :trace_description => trace_description %> +<%= t ".tags" %> + <%= @trace_tags.map(&:tag).join(", ") %> <% end %> diff --git a/app/views/user_mailer/gpx_failure.html.erb b/app/views/user_mailer/gpx_failure.html.erb index d2059af38..5427339f9 100644 --- a/app/views/user_mailer/gpx_failure.html.erb +++ b/app/views/user_mailer/gpx_failure.html.erb @@ -1,9 +1,10 @@

<%= t ".hi", :to_user => @to_user %>

-

- <%= render :partial => "gpx_description" %> - <%= t ".failed_to_import" %> -

+

<%= t ".failed_to_import" %> + +<%= render :partial => "gpx_description" %> + +

<%= t ".verify" %>

<%= @error %> diff --git a/app/views/user_mailer/gpx_failure.text.erb b/app/views/user_mailer/gpx_failure.text.erb index 9544c74a9..860f67659 100644 --- a/app/views/user_mailer/gpx_failure.text.erb +++ b/app/views/user_mailer/gpx_failure.text.erb @@ -1,8 +1,11 @@ <%= t ".hi", :to_user => @to_user %> -<%= render :partial => "gpx_description" %> <%= t ".failed_to_import" %> +<%= render :partial => "gpx_description" %> + +<%= t ".verify" %> + == <%= @error %> == diff --git a/app/views/user_mailer/gpx_success.html.erb b/app/views/user_mailer/gpx_success.html.erb index 4354db20a..3307e471b 100644 --- a/app/views/user_mailer/gpx_success.html.erb +++ b/app/views/user_mailer/gpx_success.html.erb @@ -1,9 +1,8 @@

<%= t ".hi", :to_user => @to_user %>

-

- <%= render :partial => "gpx_description" %> - <%= t(".loaded", :trace_points => @trace_points, :count => @possible_points) %> -

+

<%= t ".loaded_successfully", :trace_points => @trace_points, :count => @possible_points %> + +<%= render :partial => "gpx_description" %>

<%= t ".all_your_traces_html", :url => link_to(@my_traces_url, @my_traces_url) %> diff --git a/app/views/user_mailer/gpx_success.text.erb b/app/views/user_mailer/gpx_success.text.erb index aee3a0f11..7ce08cf0b 100644 --- a/app/views/user_mailer/gpx_success.text.erb +++ b/app/views/user_mailer/gpx_success.text.erb @@ -1,8 +1,7 @@ <%= t ".hi", :to_user => @to_user %> -<%= render :partial => "gpx_description" %> -<%= t(".loaded", :trace_points => @trace_points, :count => @possible_points) %> +<%= t ".loaded_successfully", :trace_points => @trace_points, :count => @possible_points %> -<%= t ".trace_location", :trace_url => @trace_url %> +<%= render :partial => "gpx_description" %> <%= t ".all_your_traces", :url => @my_traces_url %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 69e220a21..9e8502f4a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1669,23 +1669,24 @@ en: befriend_them: "You can also add them as a friend at %{befriendurl}." befriend_them_html: "You can also add them as a friend at %{befriendurl}." gpx_description: - description_with_tags: "It looks like your file %{trace_name} with the description %{trace_description} and the following tags: %{tags}" - description_with_tags_html: "It looks like your file %{trace_name} with the description %{trace_description} and the following tags: %{tags}" - description_with_no_tags: "It looks like your file %{trace_name} with the description %{trace_description} and no tags" - description_with_no_tags_html: "It looks like your file %{trace_name} with the description %{trace_description} and no tags" + details: "Your file details:" + filename: Filename + url: URL + description: Description + tags: Tags gpx_failure: hi: "Hi %{to_user}," - failed_to_import: "failed to be imported as a GPS trace file. Please verify that your file is a valid GPX file or an archive containing GPX file(s) in the supported format (.tar.gz, .tar.bz2, .tar, .zip, .gpx.gz, .gpx.bz2). Could there be a format or syntax issue with your file? Here is the importing error:" - more_info: "More information about GPX import failures and how to avoid them can be found at %{url}." + failed_to_import: "It looks like your file failed to be imported as a GPS trace." + verify: "Please verify that your file is a valid GPX file or an archive containing GPX file(s) in the supported format (.tar.gz, .tar.bz2, .tar, .zip, .gpx.gz, .gpx.bz2). Could there be a format or syntax issue with your file? Here is the importing error:" + more_info: "More information about GPX import failures and how to avoid them can be found at %{url}" more_info_html: "More information about GPX import failures and how to avoid them can be found at %{url}." import_failures_url: "https://wiki.openstreetmap.org/wiki/GPX_Import_Failures" subject: "[OpenStreetMap] GPX Import failure" gpx_success: hi: "Hi %{to_user}," - loaded: - one: "loaded successfully with %{trace_points} out of a possible %{count} point." - other: "loaded successfully with %{trace_points} out of a possible %{count} points." - trace_location: "Your trace is available at %{trace_url}" + loaded_successfully: + one: "It looks like your file loaded successfully with %{trace_points} out of a possible %{count} point." + other: "It looks like your file loaded successfully with %{trace_points} out of a possible %{count} points." all_your_traces: "All your successfully uploaded GPX traces can be found at %{url}" all_your_traces_html: "All your successfully uploaded GPX traces can be found at %{url}." subject: "[OpenStreetMap] GPX Import success" diff --git a/test/mailers/user_mailer_test.rb b/test/mailers/user_mailer_test.rb index 2a547e752..3b7119ff6 100644 --- a/test/mailers/user_mailer_test.rb +++ b/test/mailers/user_mailer_test.rb @@ -15,7 +15,7 @@ class UserMailerTest < ActionMailer::TestCase end email = UserMailer.gpx_success(trace, 100) - assert_match("one, two&three, four<five", email.html_part.body.to_s) + assert_match("one, two&three, four<five", email.html_part.body.to_s) assert_match("one, two&three, four