]> git.openstreetmap.org Git - rails.git/commitdiff
Prefer string interpolation to concatenation in erb files
authorAndy Allan <git@gravitystorm.co.uk>
Wed, 11 Nov 2020 14:44:42 +0000 (14:44 +0000)
committerAndy Allan <git@gravitystorm.co.uk>
Wed, 11 Nov 2020 14:44:42 +0000 (14:44 +0000)
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

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 %>