]> git.openstreetmap.org Git - rails.git/commitdiff
Merge remote-tracking branch 'upstream/pull/3999'
authorTom Hughes <tom@compton.nu>
Sun, 2 Apr 2023 17:39:12 +0000 (18:39 +0100)
committerTom Hughes <tom@compton.nu>
Sun, 2 Apr 2023 17:39:12 +0000 (18:39 +0100)
app/assets/javascripts/leaflet.map.js
app/helpers/note_helper.rb
app/views/geocoder/search.html.erb
app/views/site/fixthemap.html.erb
app/views/users/new.html.erb
config/locales/en.yml
test/helpers/note_helper_test.rb

index 44aa530d9b39e2dd4aa8399dba5cedbca42b4500..88d16bc8e4595801c1b389e05a886ea094803c23 100644 (file)
@@ -15,13 +15,55 @@ L.OSM.Map = L.Map.extend({
   initialize: function (id, options) {
     L.Map.prototype.initialize.call(this, id, options);
 
-    var copyright = I18n.t("javascripts.map.copyright", { copyright_url: "/copyright" });
-    var donate = I18n.t("javascripts.map.donate_link_text", { donate_url: "https://donate.openstreetmap.org" });
-    var terms = I18n.t("javascripts.map.terms", { terms_url: "https://wiki.osmfoundation.org/wiki/Terms_of_Use" });
-    var cyclosm = I18n.t("javascripts.map.cyclosm", { cyclosm_url: "https://www.cyclosm.org", osmfrance_url: "https://openstreetmap.fr/" });
-    var thunderforest = I18n.t("javascripts.map.thunderforest", { thunderforest_url: "https://www.thunderforest.com/" });
-    var memomaps = I18n.t("javascripts.map.opnvkarte", { memomaps_url: "https://memomaps.de/" });
-    var hotosm = I18n.t("javascripts.map.hotosm", { hotosm_url: "https://www.hotosm.org/", osmfrance_url: "https://openstreetmap.fr/" });
+    var copyright_link = $("<a>", {
+      href: "/copyright",
+      text: I18n.t("javascripts.map.openstreetmap_contributors")
+    }).prop("outerHTML");
+    var copyright = I18n.t("javascripts.map.copyright_text", { copyright_link: copyright_link });
+
+    var donate = $("<a>", {
+      "href": "https://donate.openstreetmap.org",
+      "class": "donate-attr",
+      "text": I18n.t("javascripts.map.make_a_donation")
+    }).prop("outerHTML");
+
+    var terms = $("<a>", {
+      href: "https://wiki.osmfoundation.org/wiki/Terms_of_Use",
+      text: I18n.t("javascripts.map.website_and_api_terms")
+    }).prop("outerHTML");
+
+    var cyclosm_link = $("<a>", {
+      href: "https://www.cyclosm.org",
+      target: "_blank",
+      text: I18n.t("javascripts.map.cyclosm_name")
+    }).prop("outerHTML");
+    var osm_france_link = $("<a>", {
+      href: "https://openstreetmap.fr/",
+      target: "_blank",
+      text: I18n.t("javascripts.map.osm_france")
+    }).prop("outerHTML");
+    var cyclosm = I18n.t("javascripts.map.cyclosm_credit", { cyclosm_link: cyclosm_link, osm_france_link: osm_france_link });
+
+    var thunderforest_link = $("<a>", {
+      href: "https://www.thunderforest.com/",
+      target: "_blank",
+      text: I18n.t("javascripts.map.andy_allan")
+    }).prop("outerHTML");
+    var thunderforest = I18n.t("javascripts.map.thunderforest_credit", { thunderforest_link: thunderforest_link });
+
+    var memomaps_link = $("<a>", {
+      href: "https://memomaps.de/",
+      target: "_blank",
+      text: I18n.t("javascripts.map.memomaps")
+    }).prop("outerHTML");
+    var memomaps = I18n.t("javascripts.map.opnvkarte_credit", { memomaps_link: memomaps_link });
+
+    var hotosm_link = $("<a>", {
+      href: "https://www.hotosm.org/",
+      target: "_blank",
+      text: I18n.t("javascripts.map.hotosm_name")
+    }).prop("outerHTML");
+    var hotosm = I18n.t("javascripts.map.hotosm_credit", { hotosm_link: hotosm_link, osm_france_link: osm_france_link });
 
     this.baseLayers = [];
 
index 86e5c40f8d3d8bb3427814a55f93ac84d65bcb37..42fd089e47ef1105b09a4e1a0c5e024044bd4ab4 100644 (file)
@@ -3,13 +3,13 @@ module NoteHelper
 
   def note_event(event, at, by)
     if by.nil?
-      t("notes.show.#{event}_by_anonymous_html",
-        :when => friendly_date_ago(at),
-        :exact_time => l(at))
+      t("notes.show.event_#{event}_by_anonymous_html",
+        :time_ago => tag.abbr(friendly_date_ago(at),
+                              :title => l(at)))
     else
-      t("notes.show.#{event}_by_html",
-        :when => friendly_date_ago(at),
-        :exact_time => l(at),
+      t("notes.show.event_#{event}_by_html",
+        :time_ago => tag.abbr(friendly_date_ago(at),
+                              :title => l(at)),
         :user => note_author(by))
     end
   end
index ceb099421a1ee2ef6e1cbf878b489a6669411b41..86048b0ad8b272fa5efef49c5b934ed70f0b4de0 100644 (file)
@@ -3,7 +3,10 @@
 <%= render "sidebar_header", :title => t("site.sidebar.search_results") %>
 
 <% @sources.each do |source| %>
-  <h4><%= t(".title.#{source}_html") %></h4>
+  <h4>
+    <%= t(".title.results_from_html", :results_link => link_to(t(".title.#{source}"),
+                                                               t(".title.#{source}_url"))) %>
+  </h4>
   <div class="search_results_entry mx-n3" data-href="<%= url_for @params.merge(:action => "search_#{source}") %>">
     <div class="text-center loader">
       <div class="spinner-border" role="status">
index ab8684116b4f580bd431243ada702d4ac189c465..c1a61362fdaa36ce61cb41610acc56b9e02b9a16 100644 (file)
@@ -22,7 +22,7 @@
   <div class='col-sm'>
     <h5><%= t "site.welcome.add_a_note.title" %></h5>
     <p><%= t "site.welcome.add_a_note.para_1" %></p>
-    <p><%= t ".how_to_help.add_a_note.instructions_html", :map_url => root_path %></p>
+    <p><%= t ".how_to_help.add_a_note.instructions_1_html", :note_icon => tag.a(:class => "icon note") %></p>
   </div>
 </div>
 
index f160de9130892403c41ba612c4a1269815c0c23d..27e98b45b3df544fea3f8fa7bfcc698a80d3a9e0 100644 (file)
       <%= hidden_field_tag("referer", h(@referer)) unless @referer.nil? %>
 
       <%= f.email_field :email, :tabindex => 1 %>
-      <%= f.email_field :email_confirmation, :tabindex => 2 %>
+      <%= f.email_field :email_confirmation, :help => t(".email_confirmation_help_html",
+                                                        :privacy_policy_link => link_to(t(".privacy_policy"),
+                                                                                        t(".privacy_policy_url"),
+                                                                                        :title => t(".privacy_policy_title"))),
+                                             :tabindex => 2 %>
 
       <%= f.text_field :display_name, :help => t(".display name description"), :tabindex => 3 %>
 
index f431ccde7896b1f05d3225e393457db64b4c3ecf..8e60a9a67f540233d7ff48c545315b26564a4d84 100644 (file)
@@ -154,7 +154,6 @@ en:
         reason: The reason why the user is being blocked. Please be as calm and as reasonable as possible, giving as much detail as you can about the situation, remembering that the message will be publicly visible. Bear in mind that not all users understand the community jargon, so please try to use layman's terms.
         needs_view: Does the user need to log in before this block will be cleared?
       user:
-        email_confirmation: 'Your address is not displayed publicly, see our <a href="https://wiki.osmfoundation.org/wiki/Privacy_Policy" title="OSMF privacy policy including section on email addresses">privacy policy</a> for more information.'
         new_email: "(never displayed publicly)"
   datetime:
     distance_in_words_ago:
@@ -591,9 +590,13 @@ en:
   geocoder:
     search:
       title:
-        latlon_html: 'Results from <a href="https://openstreetmap.org/">Internal</a>'
-        osm_nominatim_html: 'Results from <a href="https://nominatim.openstreetmap.org/">OpenStreetMap Nominatim</a>'
-        osm_nominatim_reverse_html: 'Results from <a href="https://nominatim.openstreetmap.org/">OpenStreetMap Nominatim</a>'
+        results_from_html: 'Results from %{results_link}'
+        latlon: Internal
+        latlon_url: https://openstreetmap.org/
+        osm_nominatim: OpenStreetMap Nominatim
+        osm_nominatim_url: https://nominatim.openstreetmap.org/
+        osm_nominatim_reverse: OpenStreetMap Nominatim
+        osm_nominatim_reverse_url: https://nominatim.openstreetmap.org/
     search_osm_nominatim:
       prefix_format: "%{name}"
       prefix:
@@ -2141,8 +2144,8 @@ en:
             If you have noticed a problem with our map data, for example a road is missing or your address, the best way to
             proceed is to join the OpenStreetMap community and add or repair the data yourself.
         add_a_note:
-          instructions_html: |
-            Just click <a class='icon note'></a> or the same icon on the map display.
+          instructions_1_html: |
+            Just click %{note_icon} or the same icon on the map display.
             This will add a marker to the map, which you can move
             by dragging. Add your message, then click save, and other mappers will investigate.
       other_concerns:
@@ -2623,6 +2626,10 @@ en:
       auth no password: "With third party authentication a password is not required, but some extra tools or server may still need one."
       continue: Sign Up
       terms accepted: "Thanks for accepting the new contributor terms!"
+      email_confirmation_help_html: 'Your address is not displayed publicly, see our %{privacy_policy_link} for more information.'
+      privacy_policy: privacy policy
+      privacy_policy_url: https://wiki.osmfoundation.org/wiki/Privacy_Policy
+      privacy_policy_title: OSMF privacy policy including section on email addresses
     terms:
       title: "Terms"
       heading: "Terms"
@@ -2873,15 +2880,15 @@ en:
       open_title: "Unresolved note #%{note_name}"
       closed_title: "Resolved note #%{note_name}"
       hidden_title: "Hidden note #%{note_name}"
-      opened_by_html: "Created by %{user} <abbr title='%{exact_time}'>%{when}</abbr>"
-      opened_by_anonymous_html: "Created by anonymous <abbr title='%{exact_time}'>%{when}</abbr>"
-      commented_by_html: "Comment from %{user} <abbr title='%{exact_time}'>%{when}</abbr>"
-      commented_by_anonymous_html: "Comment from anonymous <abbr title='%{exact_time}'>%{when}</abbr>"
-      closed_by_html: "Resolved by %{user} <abbr title='%{exact_time}'>%{when}</abbr>"
-      closed_by_anonymous_html: "Resolved by anonymous <abbr title='%{exact_time}'>%{when}</abbr>"
-      reopened_by_html: "Reactivated by %{user} <abbr title='%{exact_time}'>%{when}</abbr>"
-      reopened_by_anonymous_html: "Reactivated by anonymous <abbr title='%{exact_time}'>%{when}</abbr>"
-      hidden_by_html: "Hidden by %{user} <abbr title='%{exact_time}'>%{when}</abbr>"
+      event_opened_by_html: "Created by %{user} %{time_ago}"
+      event_opened_by_anonymous_html: "Created by anonymous %{time_ago}"
+      event_commented_by_html: "Comment from %{user} %{time_ago}"
+      event_commented_by_anonymous_html: "Comment from anonymous %{time_ago}"
+      event_closed_by_html: "Resolved by %{user} %{time_ago}"
+      event_closed_by_anonymous_html: "Resolved by anonymous %{time_ago}"
+      event_reopened_by_html: "Reactivated by %{user} %{time_ago}"
+      event_reopened_by_anonymous_html: "Reactivated by anonymous %{time_ago}"
+      event_hidden_by_html: "Hidden by %{user} %{time_ago}"
       report: report this note
       coordinates_html: "%{latitude}, %{longitude}"
       anonymous_warning: This note includes comments from anonymous users which should be independently verified.
@@ -2953,13 +2960,19 @@ en:
         gps: Public GPS Traces
         overlays: Enable overlays for troubleshooting the map
         title: "Layers"
-      copyright: "© <a href='%{copyright_url}'>OpenStreetMap contributors</a>"
-      donate_link_text: "<a class='donate-attr' href='%{donate_url}'>Make a Donation</a>"
-      terms: "<a href='%{terms_url}' target='_blank'>Website and API terms</a>"
-      cyclosm: "Tiles style by <a href='%{cyclosm_url}' target='_blank'>CyclOSM</a> hosted by <a href='%{osmfrance_url}' target='_blank'>OpenStreetMap France</a>"
-      thunderforest: "Tiles courtesy of <a href='%{thunderforest_url}' target='_blank'>Andy Allan</a>"
-      opnvkarte: "Tiles courtesy of <a href='%{memomaps_url}' target='_blank'>MeMoMaps</a>"
-      hotosm: "Tiles style by <a href='%{hotosm_url}' target='_blank'>Humanitarian OpenStreetMap Team</a> hosted by <a href='%{osmfrance_url}' target='_blank'>OpenStreetMap France</a>"
+      copyright_text: "© %{copyright_link}"
+      openstreetmap_contributors: "OpenStreetMap contributors"
+      make_a_donation: Make a Donation
+      website_and_api_terms: Website and API terms
+      cyclosm_credit: "Tiles style by %{cyclosm_link} hosted by %{osm_france_link}"
+      cyclosm_name: CyclOSM
+      osm_france: OpenStreetMap France
+      thunderforest_credit: "Tiles courtesy of %{thunderforest_link}"
+      andy_allan: Andy Allan
+      opnvkarte_credit: "Tiles courtesy of %{memomaps_link}"
+      memomaps: MeMoMaps
+      hotosm_credit: "Tiles style by %{hotosm_link} hosted by %{osm_france_link}"
+      hotosm_name: Humanitarian OpenStreetMap Team
     site:
       edit_tooltip: Edit the map
       edit_disabled_tooltip: Zoom in to edit the map
index d5f3021fbf6dc97a90920558336d4eef918fdb20..75a0e521ee88acd657aba7e01a9f1f0b3ad3edf6 100644 (file)
@@ -8,8 +8,8 @@ class NoteHelperTest < ActionView::TestCase
     date = Time.new(2014, 3, 5, 21, 37, 45, "+00:00")
     user = create(:user)
 
-    assert_match %r{^Created by anonymous <abbr title='Wed, 05 Mar 2014 21:37:45 \+0000'><span title=" 5 March 2014 at 21:37">.* ago</span></abbr>$}, note_event("opened", date, nil)
-    assert_match %r{^Resolved by <a href="/user/#{ERB::Util.u(user.display_name)}">#{user.display_name}</a> <abbr title='Wed, 05 Mar 2014 21:37:45 \+0000'><span title=" 5 March 2014 at 21:37">.* ago</span></abbr>$}, note_event("closed", date, user)
+    assert_match %r{^Created by anonymous <abbr title="Wed, 05 Mar 2014 21:37:45 \+0000"><span title=" 5 March 2014 at 21:37">.* ago</span></abbr>$}, note_event("opened", date, nil)
+    assert_match %r{^Resolved by <a href="/user/#{ERB::Util.u(user.display_name)}">#{user.display_name}</a> <abbr title="Wed, 05 Mar 2014 21:37:45 \+0000"><span title=" 5 March 2014 at 21:37">.* ago</span></abbr>$}, note_event("closed", date, user)
   end
 
   def test_note_author