From c8e1b3c6623b96f5a99dcc4202d28fec1bd0ba6a Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Wed, 11 Nov 2020 14:44:42 +0000 Subject: [PATCH 1/1] Prefer string interpolation to concatenation in erb files --- app/views/browse/_relation_member.html.erb | 2 +- app/views/issues/show.html.erb | 4 ++-- app/views/layouts/_head.html.erb | 4 ++-- app/views/oauth_clients/show.html.erb | 2 +- app/views/traces/_trace.html.erb | 2 +- app/views/users/_popup.html.erb | 2 +- app/views/users/terms.html.erb | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/views/browse/_relation_member.html.erb b/app/views/browse/_relation_member.html.erb index 51b2bb3e6..5c96dadaf 100644 --- a/app/views/browse/_relation_member.html.erb +++ b/app/views/browse/_relation_member.html.erb @@ -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}" %>
  • <%= if relation_member.member_role.blank? t ".entry_html", :type => type_str, :name => linked_name diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index 65bd9ced3..5a457cea7 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -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 %>

    diff --git a/app/views/layouts/_head.html.erb b/app/views/layouts/_head.html.erb index 19fd31343..9fdb2637f 100644 --- a/app/views/layouts/_head.html.erb +++ b/app/views/layouts/_head.html.erb @@ -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 + " | " if @title %><%= t "layouts.project_name.title" %> + <%= "#{@title} | " if @title %><%= t "layouts.project_name.title" %> <% end %> diff --git a/app/views/oauth_clients/show.html.erb b/app/views/oauth_clients/show.html.erb index 5f828a057..e6aa85e3e 100644 --- a/app/views/oauth_clients/show.html.erb +++ b/app/views/oauth_clients/show.html.erb @@ -19,7 +19,7 @@

    <%= t ".requests" %>

    <%= t ".support_notice" %>

    diff --git a/app/views/traces/_trace.html.erb b/app/views/traces/_trace.html.erb index ff15836b7..c2f4183eb 100644 --- a/app/views/traces/_trace.html.erb +++ b/app/views/traces/_trace.html.erb @@ -21,7 +21,7 @@ when "public", "identifiable" then "success" else "danger" end %> - <%= t("." + trace.visibility) %> + <%= t(".#{trace.visibility}") %>
    <%= trace.description %> diff --git a/app/views/users/_popup.html.erb b/app/views/users/_popup.html.erb index 684cf3237..a643b5c90 100644 --- a/app/views/users/_popup.html.erb +++ b/app/views/users/_popup.html.erb @@ -1,5 +1,5 @@
    <%= user_thumbnail popup %> -

    <%= t("." + type) %>

    +

    <%= t(".#{type}") %>

    <%= link_to popup.display_name, user_path(popup) %>

    diff --git a/app/views/users/terms.html.erb b/app/views/users/terms.html.erb index bc8b86ef2..b3e42189b 100644 --- a/app/views/users/terms.html.erb +++ b/app/views/users/terms.html.erb @@ -23,7 +23,7 @@
    <% end %> -- 2.39.5