Skip to content

Commit

Permalink
Move trace descriptions out of success/failure sentences in emails
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonKhorev committed Jan 9, 2025
1 parent d877cd1 commit cb20917
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 37 deletions.
25 changes: 16 additions & 9 deletions app/views/user_mailer/_gpx_description.html.erb
Original file line number Diff line number Diff line change
@@ -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 %>
<p><%= t ".details" %></p>

<dl>
<dt><%= t ".filename" %>
<% if @trace_url %>
<dd><%= link_to(@trace_name, @trace_url) %>
<% else %>
<dd><%= @trace_name %>
<% end %>
<dt><%= t ".description" %>
<dd><%= @trace_description %>
<% if @trace_tags.length > 0 %>
<dt><%= t ".tags" %>
<dd><%= safe_join @trace_tags.map(&:tag), ", " %>
<% end %>
</dl>
18 changes: 12 additions & 6 deletions app/views/user_mailer/_gpx_description.text.erb
Original file line number Diff line number Diff line change
@@ -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 %>
9 changes: 5 additions & 4 deletions app/views/user_mailer/gpx_failure.html.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<p><%= t ".hi", :to_user => @to_user %></p>

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

<%= render :partial => "gpx_description" %>

<p><%= t ".verify" %></p>

<blockquote>
<%= @error %>
Expand Down
5 changes: 4 additions & 1 deletion app/views/user_mailer/gpx_failure.text.erb
Original file line number Diff line number Diff line change
@@ -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 %>
==
Expand Down
7 changes: 3 additions & 4 deletions app/views/user_mailer/gpx_success.html.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<p><%= t ".hi", :to_user => @to_user %></p>

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

<%= render :partial => "gpx_description" %>

<p>
<%= t ".all_your_traces_html", :url => link_to(@my_traces_url, @my_traces_url) %>
Expand Down
5 changes: 2 additions & 3 deletions app/views/user_mailer/gpx_success.text.erb
Original file line number Diff line number Diff line change
@@ -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 %>
21 changes: 11 additions & 10 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit cb20917

Please sign in to comment.