]> git.openstreetmap.org Git - rails.git/commitdiff
Merge remote-tracking branch 'upstream/pull/2921' into master
authorTom Hughes <tom@compton.nu>
Fri, 13 Nov 2020 10:49:35 +0000 (10:49 +0000)
committerTom Hughes <tom@compton.nu>
Fri, 13 Nov 2020 10:49:35 +0000 (10:49 +0000)
12 files changed:
.rubocop_todo.yml
app/helpers/note_helper.rb
app/helpers/title_helper.rb
app/views/browse/_relation_member.html.erb
app/views/issues/show.html.erb
app/views/layouts/_head.html.erb
app/views/oauth_clients/show.html.erb
app/views/traces/_trace.html.erb
app/views/users/_popup.html.erb
app/views/users/terms.html.erb
lib/bounding_box.rb
lib/osm.rb

index 4e0bad7f9650eff28c271ffcd6a51f7ee9b8a0f2..2a960db7a109bc44bca80d2b71124f1eaae64c47 100644 (file)
@@ -173,7 +173,20 @@ Style/FrozenStringLiteralComment:
 Style/NumericLiterals:
   MinDigits: 11
 
-# Offense count: 28
+# Offense count: 19
 # Cop supports --auto-correct.
 Style/StringConcatenation:
-  Enabled: false
+  Exclude:
+    - 'app/helpers/browse_tags_helper.rb'
+    - 'app/helpers/user_roles_helper.rb'
+    - 'app/jobs/trace_importer_job.rb'
+    - 'app/models/client_application.rb'
+    - 'app/views/changesets/index.atom.builder'
+    - 'lib/migrate.rb'
+    - 'lib/potlatch.rb'
+    - 'script/cleanup'
+    - 'script/deliver-message'
+    - 'script/statistics'
+    - 'script/update-spam-blocks'
+    - 'test/controllers/api/relations_controller_test.rb'
+    - 'test/helpers/user_roles_helper_test.rb'
index d85881a3111027cb3fe8f5b178deb0fc1acb6486..7e52937a008f94903a9e2c9fe57ea2c3e541f275 100644 (file)
@@ -3,11 +3,11 @@ module NoteHelper
 
   def note_event(event, at, by)
     if by.nil?
-      t("browse.note." + event + "_by_anonymous_html",
+      t("browse.note.#{event}_by_anonymous_html",
         :when => friendly_date_ago(at),
         :exact_time => l(at))
     else
-      t("browse.note." + event + "_by_html",
+      t("browse.note.#{event}_by_html",
         :when => friendly_date_ago(at),
         :exact_time => l(at),
         :user => note_author(by))
index 16470343656a1880a25eae74e6be6ba4c6417f38..099af86815264d1f8bc4a3bb98e472e63aae7c86 100644 (file)
@@ -6,7 +6,7 @@ module TitleHelper
   def set_title(title = nil)
     if title
       @title = TitleHelper.coder.decode(title.gsub("<bdi>", "\u202a").gsub("</bdi>", "\u202c"))
-      response.headers["X-Page-Title"] = ERB::Util.u(@title + " | " + t("layouts.project_name.title"))
+      response.headers["X-Page-Title"] = ERB::Util.u("#{@title} | #{t('layouts.project_name.title')}")
     else
       @title = title
       response.headers["X-Page-Title"] = ERB::Util.u(t("layouts.project_name.title"))
index 51b2bb3e6dd05cc288f38c1cda03a64a029a4c4a..5c96dadaf84d9a31e97cc61c112dcb52ebdf4ad5 100644 (file)
@@ -1,6 +1,6 @@
 <% member_class = link_class(relation_member.member_type.downcase, relation_member.member)
    linked_name = link_to printable_name(relation_member.member), { :action => relation_member.member_type.downcase, :id => relation_member.member_id.to_s }, { :title => link_title(relation_member.member), :rel => link_follow(relation_member.member) }
-   type_str = t ".type." + relation_member.member_type.downcase %>
+   type_str = t ".type.#{relation_member.member_type.downcase}" %>
 <li class="<%= member_class %>">
   <%= if relation_member.member_role.blank?
         t ".entry_html", :type => type_str, :name => linked_name
index 65bd9ced3be35f7fad61b08a2e0e8f163449f911..5a457cea78d9146886fd186d72d4516d2cef03c1 100644 (file)
@@ -6,8 +6,8 @@
     <%= @issue.assigned_role %>
     | <%= t ".reports", :count => @issue.reports.count %>
     | <%= t ".report_created_at", :datetime => l(@issue.created_at.to_datetime, :format => :friendly) %>
-    <%= " | " + t(".last_resolved_at", :datetime => l(@issue.resolved_at.to_datetime, :format => :friendly)) if @issue.resolved_at? %>
-    <%= " | " + t(".last_updated_at", :datetime => l(@issue.updated_at.to_datetime, :format => :friendly), :displayname => @issue.user_updated.display_name) if @issue.user_updated %>
+    <%= " | #{t('.last_resolved_at', :datetime => l(@issue.resolved_at.to_datetime, :format => :friendly))}" if @issue.resolved_at? %>
+    <%= " | #{t('.last_updated_at', :datetime => l(@issue.updated_at.to_datetime, :format => :friendly), :displayname => @issue.user_updated.display_name)}" if @issue.user_updated %>
   </small>
 </p>
 <p>
index 19fd3134366a106cd4c9d8ee12d57adab0f3af59..9fdb2637f7f9550a9e143c82cb1800878901c427 100644 (file)
@@ -5,7 +5,7 @@
   <%= javascript_include_tag "es5" unless browser.es5? %>
   <%= javascript_include_tag "es6" unless browser.es6? %>
   <%= javascript_include_tag "application" %>
-  <%= javascript_include_tag "i18n/" + I18n.locale.to_s %>
+  <%= javascript_include_tag "i18n/#{I18n.locale}" %>
   <%= stylesheet_link_tag "screen-#{dir}", :media => "screen" %>
   <%= stylesheet_link_tag "print-#{dir}", :media => "print" %>
   <%= stylesheet_link_tag "leaflet-all", :media => "screen, print" %>
@@ -14,5 +14,5 @@
   <%= yield :auto_discovery_link_tag %>
   <%= csrf_meta_tag %>
   <%= csp_meta_tag %>
-  <title><%= @title + " | " if @title %><%= t "layouts.project_name.title" %></title>
+  <title><%= "#{@title} | " if @title %><%= t "layouts.project_name.title" %></title>
 <% end %>
index 5f828a05798495a1a146bdf10fc68eb4841b2236..e6aa85e3e7307f908c6bdc36bfd9187ec8a5c21c 100644 (file)
@@ -19,7 +19,7 @@
   <p><%= t ".requests" %></p>
   <ul>
     <% @client_application.permissions.each do |perm| %>
-      <li><%= t("activerecord.attributes.client_application." + perm.to_s) %></li>
+      <li><%= t("activerecord.attributes.client_application.#{perm}") %></li>
     <% end %>
   </ul>
   <p><%= t ".support_notice" %></p>
index ff15836b7b2596f2ea783a907bd31da480d14cbf..c2f4183eb433df939a52300a996fbc453a6fd21c 100644 (file)
@@ -21,7 +21,7 @@
                        when "public", "identifiable" then "success"
                        else "danger"
                        end %>
-      <span class="badge badge-<%= badge_class %> text-white"><%= t("." + trace.visibility) %></span>
+      <span class="badge badge-<%= badge_class %> text-white"><%= t(".#{trace.visibility}") %></span>
 
       <br />
       <%= trace.description %>
index 684cf3237b8f1621d260c9a11882979d66a5d40f..a643b5c90b932ee447818a304798a700ad0b94dc 100644 (file)
@@ -1,5 +1,5 @@
 <div class="user_popup">
   <%= user_thumbnail popup %>
-  <p><%= t("." + type) %></p>
+  <p><%= t(".#{type}") %></p>
   <p><%= link_to popup.display_name, user_path(popup) %></p>
 </div>
index bc8b86ef2256a269e25b0a6f8401fb419d3ea166..b3e42189be18ae6f6c155c85cd02a51bd4ce0c30 100644 (file)
@@ -23,7 +23,7 @@
       <div class="standard-form-row">
         <label for="legale_<%= legale %>">
           <%= radio_button_tag "legale", legale, @legale == legale, :data => { :url => url_for(:legale => legale) } %>
-          <%= t(".legale_names." + name) %>
+          <%= t(".legale_names.#{name}") %>
         </label>
       </div>
     <% end %>
index 0b9731b227223f454801f82b1e71fc1d92036511..44375ae5beb85aca7b5ece0ad2f20423975194fd 100644 (file)
@@ -72,7 +72,7 @@ class BoundingBox
   def check_size(max_area = Settings.max_request_area)
     # check the bbox isn't too large
     if area > max_area
-      raise OSM::APIBadBoundingBox, "The maximum bbox size is " + max_area.to_s +
+      raise OSM::APIBadBoundingBox, "The maximum bbox size is #{max_area}" \
                                     ", and your request was too large. Either request a smaller area, or use planet.osm"
     end
     self
index 04cbf17faf193e215463281e31bd2e031bb96ee3..a6d74067772c0d415aa98508002d5efc28c3c87d 100644 (file)
@@ -497,8 +497,8 @@ module OSM
 
   # Return the terms and conditions text for a given country
   def self.legal_text_for_country(country_code)
-    file_name = Rails.root.join("config", "legales", country_code.to_s + ".yml")
-    file_name = Rails.root.join("config", "legales", Settings.default_legale + ".yml") unless File.exist? file_name
+    file_name = Rails.root.join("config", "legales", "#{country_code}.yml")
+    file_name = Rails.root.join("config", "legales", "#{Settings.default_legale}.yml") unless File.exist? file_name
     YAML.load_file(file_name).transform_values!(&:html_safe)
   end