From be8d76926cb5e1cc5f9d3f81bda80e716f75a59d Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Sat, 11 Jan 2025 15:53:36 +0300 Subject: [PATCH 1/2] Move number of points to file details in gpx emails --- app/views/user_mailer/_gpx_description.html.erb | 8 ++++++++ app/views/user_mailer/_gpx_description.text.erb | 8 ++++++++ app/views/user_mailer/gpx_success.html.erb | 2 +- app/views/user_mailer/gpx_success.text.erb | 2 +- config/locales/en.yml | 6 +++--- 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/app/views/user_mailer/_gpx_description.html.erb b/app/views/user_mailer/_gpx_description.html.erb index d4eefeb25f..0ca88bb24e 100644 --- a/app/views/user_mailer/_gpx_description.html.erb +++ b/app/views/user_mailer/_gpx_description.html.erb @@ -13,4 +13,12 @@
<%= t ".tags" %>
<%= @trace_tags.map(&:tag).join(", ") %> <% end %> + <% if @possible_points %> +
<%= t ".total_points" %> +
<%= @possible_points %> + <% end %> + <% if @trace_points %> +
<%= t ".imported_points" %> +
<%= @trace_points %> + <% end %> diff --git a/app/views/user_mailer/_gpx_description.text.erb b/app/views/user_mailer/_gpx_description.text.erb index f0ce97e614..e828068b9f 100644 --- a/app/views/user_mailer/_gpx_description.text.erb +++ b/app/views/user_mailer/_gpx_description.text.erb @@ -12,3 +12,11 @@ <%= t ".tags" %> <%= @trace_tags.map(&:tag).join(", ") %> <% end %> +<% if @possible_points %> +<%= t ".total_points" %> + <%= @possible_points %> +<% end %> +<% if @trace_points %> +<%= t ".imported_points" %> + <%= @trace_points %> +<% end %> diff --git a/app/views/user_mailer/gpx_success.html.erb b/app/views/user_mailer/gpx_success.html.erb index 3307e471b5..803a85b4d1 100644 --- a/app/views/user_mailer/gpx_success.html.erb +++ b/app/views/user_mailer/gpx_success.html.erb @@ -1,6 +1,6 @@

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

-

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

<%= t ".imported_successfully" %>

<%= render :partial => "gpx_description" %> diff --git a/app/views/user_mailer/gpx_success.text.erb b/app/views/user_mailer/gpx_success.text.erb index 7ce08cf0be..6bb3e68792 100644 --- a/app/views/user_mailer/gpx_success.text.erb +++ b/app/views/user_mailer/gpx_success.text.erb @@ -1,6 +1,6 @@ <%= t ".hi", :to_user => @to_user %> -<%= t ".loaded_successfully", :trace_points => @trace_points, :count => @possible_points %> +<%= t ".imported_successfully" %> <%= render :partial => "gpx_description" %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 9e8502f4a2..0f2329a8d1 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1674,6 +1674,8 @@ en: url: URL description: Description tags: Tags + total_points: Total number of points + imported_points: Number of imported points gpx_failure: hi: "Hi %{to_user}," failed_to_import: "It looks like your file failed to be imported as a GPS trace." @@ -1684,9 +1686,7 @@ en: subject: "[OpenStreetMap] GPX Import failure" gpx_success: hi: "Hi %{to_user}," - 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." + imported_successfully: "It looks like your file was imported successfully as a GPS trace." 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" From 4c73b2651c345fa7ccc444b32377fb03c1e9c82a Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Sat, 11 Jan 2025 15:57:17 +0300 Subject: [PATCH 2/2] Rename gpx description template to details "Description" is just one of trace properties, details include description and other things. --- .../{_gpx_description.html.erb => _gpx_details.html.erb} | 0 .../{_gpx_description.text.erb => _gpx_details.text.erb} | 0 app/views/user_mailer/gpx_failure.html.erb | 2 +- app/views/user_mailer/gpx_failure.text.erb | 2 +- app/views/user_mailer/gpx_success.html.erb | 2 +- app/views/user_mailer/gpx_success.text.erb | 2 +- config/locales/en.yml | 2 +- 7 files changed, 5 insertions(+), 5 deletions(-) rename app/views/user_mailer/{_gpx_description.html.erb => _gpx_details.html.erb} (100%) rename app/views/user_mailer/{_gpx_description.text.erb => _gpx_details.text.erb} (100%) diff --git a/app/views/user_mailer/_gpx_description.html.erb b/app/views/user_mailer/_gpx_details.html.erb similarity index 100% rename from app/views/user_mailer/_gpx_description.html.erb rename to app/views/user_mailer/_gpx_details.html.erb diff --git a/app/views/user_mailer/_gpx_description.text.erb b/app/views/user_mailer/_gpx_details.text.erb similarity index 100% rename from app/views/user_mailer/_gpx_description.text.erb rename to app/views/user_mailer/_gpx_details.text.erb diff --git a/app/views/user_mailer/gpx_failure.html.erb b/app/views/user_mailer/gpx_failure.html.erb index 5427339f9f..2e5a283b84 100644 --- a/app/views/user_mailer/gpx_failure.html.erb +++ b/app/views/user_mailer/gpx_failure.html.erb @@ -2,7 +2,7 @@

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

<%= t ".verify" %>

diff --git a/app/views/user_mailer/gpx_failure.text.erb b/app/views/user_mailer/gpx_failure.text.erb index 860f676590..0c5edebdee 100644 --- a/app/views/user_mailer/gpx_failure.text.erb +++ b/app/views/user_mailer/gpx_failure.text.erb @@ -2,7 +2,7 @@ <%= t ".failed_to_import" %> -<%= render :partial => "gpx_description" %> +<%= render :partial => "gpx_details" %> <%= t ".verify" %> diff --git a/app/views/user_mailer/gpx_success.html.erb b/app/views/user_mailer/gpx_success.html.erb index 803a85b4d1..b7f6beadc8 100644 --- a/app/views/user_mailer/gpx_success.html.erb +++ b/app/views/user_mailer/gpx_success.html.erb @@ -2,7 +2,7 @@

<%= t ".imported_successfully" %>

-<%= render :partial => "gpx_description" %> +<%= render :partial => "gpx_details" %>

<%= 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 6bb3e68792..fa4fed7d6e 100644 --- a/app/views/user_mailer/gpx_success.text.erb +++ b/app/views/user_mailer/gpx_success.text.erb @@ -2,6 +2,6 @@ <%= t ".imported_successfully" %> -<%= render :partial => "gpx_description" %> +<%= render :partial => "gpx_details" %> <%= t ".all_your_traces", :url => @my_traces_url %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 0f2329a8d1..a62f4d34fc 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1668,7 +1668,7 @@ en: see_their_profile_html: "You can see their profile at %{userurl}." 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: + gpx_details: details: "Your file details:" filename: Filename url: URL