Use double quotes inside string interpolation

This commit is contained in:
Javi Martín
2019-03-25 13:29:58 +01:00
parent d894d24bff
commit 4c35df4812
35 changed files with 54 additions and 54 deletions

View File

@@ -24,6 +24,6 @@ class StatsController < ApplicationController
private
def daily_cache(key, &block)
Rails.cache.fetch("public_stats/#{Time.current.strftime('%Y-%m-%d')}/#{key}", &block)
Rails.cache.fetch("public_stats/#{Time.current.strftime("%Y-%m-%d")}/#{key}", &block)
end
end

View File

@@ -18,7 +18,7 @@ module DocumentablesHelper
def accepted_content_types_extensions(documentable_class)
documentable_class.accepted_content_types
.collect{ |content_type| ".#{content_type.split('/').last}" }
.collect{ |content_type| ".#{content_type.split("/").last}" }
.join(",")
end

View File

@@ -22,7 +22,7 @@ module ImageablesHelper
def imageable_accepted_content_types_extensions
Image::ACCEPTED_CONTENT_TYPE
.collect{ |content_type| ".#{content_type.split('/').last}" }
.collect{ |content_type| ".#{content_type.split("/").last}" }
.join(",")
end

View File

@@ -57,9 +57,9 @@ module MapLocationsHelper
map_tiles_provider_attribution: Rails.application.secrets.map_tiles_provider_attribution,
marker_editable: editable,
marker_remove_selector: "##{map_location_remove_marker_link_id(map_location)}",
latitude_input_selector: "##{map_location_input_id(parent_class, 'latitude')}",
longitude_input_selector: "##{map_location_input_id(parent_class, 'longitude')}",
zoom_input_selector: "##{map_location_input_id(parent_class, 'zoom')}",
latitude_input_selector: "##{map_location_input_id(parent_class, "latitude")}",
longitude_input_selector: "##{map_location_input_id(parent_class, "longitude")}",
zoom_input_selector: "##{map_location_input_id(parent_class, "zoom")}",
marker_investments_coordinates: investments_coordinates
}
options[:marker_latitude] = map_location.latitude if map_location.latitude.present?

View File

@@ -18,7 +18,7 @@ module ValuationHelper
when 0
t("valuation.budget_investments.index.no_valuators_assigned")
when 1
"<span title=\"#{t('valuation.budget_investments.index.valuators_assigned', count: 1)}\">".html_safe +
"<span title=\"#{t("valuation.budget_investments.index.valuators_assigned", count: 1)}\">".html_safe +
valuators.first.name +
"</span>".html_safe
else

View File

@@ -1,5 +1,5 @@
class ApplicationMailer < ActionMailer::Base
helper :settings
default from: "#{Setting['mailer_from_name']} <#{Setting['mailer_from_address']}>"
default from: "#{Setting["mailer_from_name"]} <#{Setting["mailer_from_address"]}>"
layout "mailer"
end

View File

@@ -218,7 +218,7 @@ class Budget
end
def code
"#{created_at.strftime('%Y')}-#{id}" + (administrator.present? ? "-A#{administrator.id}" : "")
"#{created_at.strftime("%Y")}-#{id}" + (administrator.present? ? "-A#{administrator.id}" : "")
end
def send_unfeasible_email

View File

@@ -120,7 +120,7 @@ class Legislation::Proposal < ActiveRecord::Base
end
def code
"#{Setting['proposal_code_prefix']}-#{created_at.strftime('%Y-%m')}-#{id}"
"#{Setting["proposal_code_prefix"]}-#{created_at.strftime("%Y-%m")}-#{id}"
end
def after_commented

View File

@@ -163,7 +163,7 @@ class Proposal < ActiveRecord::Base
end
def code
"#{Setting['proposal_code_prefix']}-#{created_at.strftime('%Y-%m')}-#{id}"
"#{Setting["proposal_code_prefix"]}-#{created_at.strftime("%Y-%m")}-#{id}"
end
def after_commented

View File

@@ -109,7 +109,7 @@ class SpendingProposal < ActiveRecord::Base
end
def code
"#{created_at.strftime('%Y')}-#{id}" + (administrator.present? ? "-A#{administrator.id}" : "")
"#{created_at.strftime("%Y")}-#{id}" + (administrator.present? ? "-A#{administrator.id}" : "")
end
def send_unfeasible_email

View File

@@ -238,7 +238,7 @@ class User < ActiveRecord::Base
Poll::Voter.where(user_id: other_user.id).update_all(user_id: id)
Budget::Ballot.where(user_id: other_user.id).update_all(user_id: id)
Vote.where("voter_id = ? AND voter_type = ?", other_user.id, "User").update_all(voter_id: id)
data_log = "id: #{other_user.id} - #{Time.current.strftime('%Y-%m-%d %H:%M:%S')}"
data_log = "id: #{other_user.id} - #{Time.current.strftime("%Y-%m-%d %H:%M:%S")}"
update(former_users_data_log: "#{former_users_data_log} | #{data_log}")
end

View File

@@ -4,8 +4,8 @@
<%= f.hidden_field :value,
value: (setting.enabled? ? "" : "active") %>
<%= f.submit(t("admin.settings.index.features.#{setting.enabled? ? 'disable' : 'enable'}"),
class: "button #{setting.enabled? ? 'hollow alert' : 'success'}",
<%= f.submit(t("admin.settings.index.features.#{setting.enabled? ? "disable" : "enable"}"),
class: "button #{setting.enabled? ? "hollow alert" : "success"}",
data: {confirm: t("admin.actions.confirm")}) %>
<% end %>
</div>

View File

@@ -38,7 +38,7 @@
<td>
<% if draft_version.status == "draft" %>
<%= t("admin.legislation.draft_versions.statuses.draft") %>
<%= link_to "(#{t('.preview')})", legislation_process_draft_version_path(@process, draft_version) %>
<%= link_to "(#{t(".preview")})", legislation_process_draft_version_path(@process, draft_version) %>
<% else %>
<%= t("admin.legislation.draft_versions.statuses.published") %>
<% end %>

View File

@@ -35,8 +35,8 @@
<%= form_for(feature, url: admin_setting_path(feature), html: { id: "edit_#{dom_id(feature)}"}) do |f| %>
<%= f.hidden_field :value, id: dom_id(feature), value: (feature.enabled? ? "" : "active") %>
<%= f.submit(t("admin.settings.index.features.#{feature.enabled? ? 'disable' : 'enable'}"),
class: "button expanded #{feature.enabled? ? 'hollow alert' : 'success'}",
<%= f.submit(t("admin.settings.index.features.#{feature.enabled? ? "disable" : "enable"}"),
class: "button expanded #{feature.enabled? ? "hollow alert" : "success"}",
data: {confirm: t("admin.actions.confirm")}) %>
<% end %>
</td>

View File

@@ -37,5 +37,5 @@
</div>
</div>
<%= f.submit(t("admin.homepage.#{action_name}.#{@card.header? ? 'submit_header' : 'submit_card'}"), class: "button success") %>
<%= f.submit(t("admin.homepage.#{action_name}.#{@card.header? ? "submit_header" : "submit_card"}"), class: "button success") %>
<% end %>

View File

@@ -2,7 +2,7 @@
<div class="row">
<div class="small-12 large-4 column">
<h1 class="logo">
<%= link_to t("layouts.header.open_gov", open: "#{t('layouts.header.open')}").html_safe %>
<%= link_to t("layouts.header.open_gov", open: "#{t("layouts.header.open")}").html_safe %>
</h1>
<p class="info">
@@ -37,7 +37,7 @@
<ul>
<% if setting["twitter_handle"] %>
<li class="inline-block">
<%= link_to "https://twitter.com/#{setting['twitter_handle']}", target: "_blank",
<%= link_to "https://twitter.com/#{setting["twitter_handle"]}", target: "_blank",
title: t("shared.go_to_page") + t("social.twitter", org: setting["org_name"]) + t("shared.target_blank_html") do %>
<span class="show-for-sr"><%= t("social.twitter", org: setting["org_name"]) %></span>
<span class="icon-twitter" aria-hidden="true"></span>
@@ -46,7 +46,7 @@
<% end %>
<% if setting["facebook_handle"] %>
<li class="inline-block">
<%= link_to "https://www.facebook.com/#{setting['facebook_handle']}/", target: "_blank",
<%= link_to "https://www.facebook.com/#{setting["facebook_handle"]}/", target: "_blank",
title: t("shared.go_to_page") + t("social.facebook", org: setting["org_name"]) + t("shared.target_blank_html") do %>
<span class="show-for-sr"><%= t("social.facebook", org: setting["org_name"]) %></span>
<span class="icon-facebook" aria-hidden="true"></span>
@@ -55,7 +55,7 @@
<% end %>
<% if setting["youtube_handle"] %>
<li class="inline-block">
<%= link_to "https://www.youtube.com/#{setting['youtube_handle']}", target: "_blank",
<%= link_to "https://www.youtube.com/#{setting["youtube_handle"]}", target: "_blank",
title: t("shared.go_to_page") + t("social.youtube", org: setting["org_name"]) + t("shared.target_blank_html") do %>
<span class="show-for-sr"><%= t("social.youtube", org: setting["org_name"]) %></span>
<span class="icon-youtube" aria-hidden="true"></span>
@@ -64,7 +64,7 @@
<% end %>
<% if setting["telegram_handle"] %>
<li class="inline-block">
<%= link_to "https://www.telegram.me/#{setting['telegram_handle']}", target: "_blank",
<%= link_to "https://www.telegram.me/#{setting["telegram_handle"]}", target: "_blank",
title: t("shared.go_to_page") + t("social.telegram", org: setting["org_name"]) + t("shared.target_blank_html") do %>
<span class="show-for-sr"><%= t("social.telegram", org: setting["org_name"]) %></span>
<span class="icon-telegram" aria-hidden="true"></span>
@@ -73,7 +73,7 @@
<% end %>
<% if setting["instagram_handle"] %>
<li class="inline-block">
<%= link_to "https://www.instagram.com/#{setting['instagram_handle']}", target: "_blank",
<%= link_to "https://www.instagram.com/#{setting["instagram_handle"]}", target: "_blank",
title: t("shared.go_to_page") + t("social.instagram", org: setting["org_name"]) + t("shared.target_blank_html") do %>
<span class="show-for-sr"><%= t("social.instagram", org: setting["org_name"]) %></span>
<span class="icon-instagram" aria-hidden="true"></span>

View File

@@ -1,4 +1,4 @@
<% provide :title do %><%= "#{t('.title')} - #{@draft_version.title} - #{@process.title}" %><% end %>
<% provide :title do %><%= "#{t(".title")} - #{@draft_version.title} - #{@process.title}" %><% end %>
<%= render "legislation/processes/header", process: @process, header: :small %>

View File

@@ -1,4 +1,4 @@
<% provide :title do %><%= "#{t('.title')} - #{@draft_version.title} - #{@process.title}" %><% end %>
<% provide :title do %><%= "#{t(".title")} - #{@draft_version.title} - #{@process.title}" %><% end %>
<%= render "legislation/processes/header", process: @process, header: :small %>

View File

@@ -1,4 +1,4 @@
<% provide :title do %><%= "#{@draft_version.title} - #{t('.title')} - #{@process.title}" %><% end %>
<% provide :title do %><%= "#{@draft_version.title} - #{t(".title")} - #{@process.title}" %><% end %>
<%= render "legislation/processes/header", process: @process, header: :small %>

View File

@@ -1,14 +1,14 @@
<% description = local_assigns.fetch(:description, "") %>
<% description = truncate(ActionView::Base.full_sanitizer.sanitize(description), length: 140) %>
<% mobile = local_assigns[:mobile] %>
<% mobile_url = mobile.present? ? "#{mobile.gsub(/\s+/, '%20')}%20" : "" %>
<% mobile_url = mobile.present? ? "#{mobile.gsub(/\s+/, "%20")}%20" : "" %>
<% if local_assigns[:share_title].present? %>
<div id="social-share" class="sidebar-divider"></div>
<p class="sidebar-title"><%= share_title %></p>
<% end %>
<div class="social-share-full">
<%= social_share_button_tag("#{title} #{setting['twitter_hashtag']} #{setting['twitter_handle']}",
<%= social_share_button_tag("#{title} #{setting["twitter_hashtag"]} #{setting["twitter_handle"]}",
url: local_assigns[:url],
image: local_assigns.fetch(:image_url, ""),
desc: description,

View File

@@ -6,7 +6,7 @@
<% if can? :destroy, budget_investment %>
<%= link_to t("shared.delete"), budget_investment_path(budget_investment.budget, budget_investment),
method: :delete, class: "button hollow alert expanded",
data: {confirm: "#{t('users.show.delete_alert')}"} %>
data: {confirm: "#{t("users.show.delete_alert")}"} %>
<% end %>
</td>
</tr>

View File

@@ -1,6 +1,6 @@
<%= link_to valuation_budget_budget_investment_path(@budget, @investment), class: "back" do %>
<span class="icon-angle-left"></span>
<%= "#{t('valuation.budget_investments.show.title')} #{@investment.id}"%>
<%= "#{t("valuation.budget_investments.show.title")} #{@investment.id}"%>
<% end %>
<h2><%= t("valuation.budget_investments.edit.dossier") %></h2>
@@ -50,12 +50,12 @@
<div class="row">
<div class="small-12 medium-6 column">
<%= f.label :price, "#{t('valuation.budget_investments.edit.price_html', currency: @budget.currency_symbol)}" %>
<%= f.label :price, "#{t("valuation.budget_investments.edit.price_html", currency: @budget.currency_symbol)}" %>
<%= f.number_field :price, label: false, max: 1000000000000000 %>
</div>
<div class="small-12 medium-6 column end">
<%= f.label :price_first_year, "#{t('valuation.budget_investments.edit.price_first_year_html', currency: @budget.currency_symbol)}" %>
<%= f.label :price_first_year, "#{t("valuation.budget_investments.edit.price_first_year_html", currency: @budget.currency_symbol)}" %>
<%= f.number_field :price_first_year, label: false, max: 1000000000000000 %>
</div>
</div>

View File

@@ -8,7 +8,7 @@
<div class="small-12 medium-4 column select-heading">
<% slice.each do |filter| %>
<%= link_to valuation_budget_budget_investments_path(budget_id: @budget.id, heading_id: filter[:id]),
class: "#{'is-active' if params[:heading_id].to_s == filter[:id].to_s}" do %>
class: "#{"is-active" if params[:heading_id].to_s == filter[:id].to_s}" do %>
<%= filter[:name] %> (<%= filter[:count] %>)
<% end %>
<% end %>

View File

@@ -1,4 +1,4 @@
<%= link_to "#{t('valuation.spending_proposals.show.heading')} #{@spending_proposal.id}", valuation_spending_proposal_path(@spending_proposal), class: "back" %>
<%= link_to "#{t("valuation.spending_proposals.show.heading")} #{@spending_proposal.id}", valuation_spending_proposal_path(@spending_proposal), class: "back" %>
<h2><%= t("valuation.spending_proposals.edit.dossier") %></h2>
<%= form_for(@spending_proposal, url: valuate_valuation_spending_proposal_path(@spending_proposal), html: {id: "valuation_spending_proposal_edit_form"}) do |f| %>
@@ -46,12 +46,12 @@
<div class="row">
<div class="small-12 medium-4 column">
<%= f.label :price, "#{t('valuation.spending_proposals.edit.price_html', currency: t('valuation.spending_proposals.edit.currency'))}" %>
<%= f.label :price, "#{t("valuation.spending_proposals.edit.price_html", currency: t("valuation.spending_proposals.edit.currency"))}" %>
<%= f.number_field :price, label: false, max: 1000000000000000 %>
</div>
<div class="small-12 medium-4 column end">
<%= f.label :price_first_year, "#{t('valuation.spending_proposals.edit.price_first_year_html', currency: t('valuation.spending_proposals.edit.currency'))}" %>
<%= f.label :price_first_year, "#{t("valuation.spending_proposals.edit.price_first_year_html", currency: t("valuation.spending_proposals.edit.currency"))}" %>
<%= f.number_field :price_first_year, label: false, max: 1000000000000000 %>
</div>
</div>

View File

@@ -5,7 +5,7 @@
<div class="small-12 medium-4 column select-geozone">
<% slice.each do |filter| %>
<%= link_to valuation_spending_proposals_path(geozone_id: filter[:id]),
class: "#{'is-active' if params[:geozone_id].to_s == filter[:id].to_s}" do %>
class: "#{"is-active" if params[:geozone_id].to_s == filter[:id].to_s}" do %>
<%= filter[:name] %>&nbsp;(<%= filter[:pending_count] %>)
<% end %>
<% end %>

View File

@@ -15,7 +15,7 @@ Devise.setup do |config|
if Rails.env.test? || !ActiveRecord::Base.connection.table_exists?("settings")
config.mailer_sender = "noreply@consul.dev"
else
config.mailer_sender = "'#{Setting['mailer_from_name']}' <#{Setting['mailer_from_address']}>"
config.mailer_sender = "'#{Setting["mailer_from_name"]}' <#{Setting["mailer_from_address"]}>"
end
# Configure the class responsible to send e-mails.

View File

@@ -127,7 +127,7 @@ section "Creating Investments" do
group: heading.group,
budget: heading.group.budget,
title: Faker::Lorem.sentence(3).truncate(60),
description: "<p>#{Faker::Lorem.paragraphs.join('</p><p>')}</p>",
description: "<p>#{Faker::Lorem.paragraphs.join("</p><p>")}</p>",
created_at: rand((Time.current - 1.week)..Time.current),
feasibility: %w[undecided unfeasible feasible feasible feasible feasible].sample,
unfeasibility_explanation: Faker::Lorem.paragraph,

View File

@@ -2,7 +2,7 @@ section "Creating Debates" do
tags = Faker::Lorem.words(25)
30.times do
author = User.all.sample
description = "<p>#{Faker::Lorem.paragraphs.join('</p><p>')}</p>"
description = "<p>#{Faker::Lorem.paragraphs.join("</p><p>")}</p>"
Debate.create!(author: author,
title: Faker::Lorem.sentence(3).truncate(60),
created_at: rand((Time.current - 1.week)..Time.current),
@@ -15,7 +15,7 @@ section "Creating Debates" do
tags = ActsAsTaggableOn::Tag.where(kind: "category")
30.times do
author = User.all.sample
description = "<p>#{Faker::Lorem.paragraphs.join('</p><p>')}</p>"
description = "<p>#{Faker::Lorem.paragraphs.join("</p><p>")}</p>"
Debate.create!(author: author,
title: Faker::Lorem.sentence(3).truncate(60),
created_at: rand((Time.current - 1.week)..Time.current),

View File

@@ -2,7 +2,7 @@ section "Creating comment notifications" do
User.find_each do |user|
debate = Debate.create!(author: user,
title: Faker::Lorem.sentence(3).truncate(60),
description: "<p>#{Faker::Lorem.paragraphs.join('</p><p>')}</p>",
description: "<p>#{Faker::Lorem.paragraphs.join("</p><p>")}</p>",
tag_list: ActsAsTaggableOn::Tag.all.sample(3).join(","),
geozone: Geozone.reorder("RANDOM()").first,
terms_of_service: "1")

View File

@@ -53,7 +53,7 @@ section "Creating Poll Questions & Answers" do
end
question.save!
Faker::Lorem.words((2..4).to_a.sample).each do |title|
description = "<p>#{Faker::Lorem.paragraphs.join('</p><p>')}</p>"
description = "<p>#{Faker::Lorem.paragraphs.join("</p><p>")}</p>"
answer = Poll::Question::Answer.new(question: question,
title: title.capitalize,
description: description)

View File

@@ -25,7 +25,7 @@ section "Creating Proposals" do
tags = Faker::Lorem.words(25)
30.times do
author = User.all.sample
description = "<p>#{Faker::Lorem.paragraphs.join('</p><p>')}</p>"
description = "<p>#{Faker::Lorem.paragraphs.join("</p><p>")}</p>"
proposal = Proposal.create!(author: author,
title: Faker::Lorem.sentence(3).truncate(60),
question: Faker::Lorem.sentence(3) + "?",
@@ -46,7 +46,7 @@ section "Creating Archived Proposals" do
tags = Faker::Lorem.words(25)
5.times do
author = User.all.sample
description = "<p>#{Faker::Lorem.paragraphs.join('</p><p>')}</p>"
description = "<p>#{Faker::Lorem.paragraphs.join("</p><p>")}</p>"
proposal = Proposal.create!(author: author,
title: Faker::Lorem.sentence(3).truncate(60),
question: Faker::Lorem.sentence(3) + "?",
@@ -67,7 +67,7 @@ section "Creating Successful Proposals" do
tags = Faker::Lorem.words(25)
10.times do
author = User.all.sample
description = "<p>#{Faker::Lorem.paragraphs.join('</p><p>')}</p>"
description = "<p>#{Faker::Lorem.paragraphs.join("</p><p>")}</p>"
proposal = Proposal.create!(author: author,
title: Faker::Lorem.sentence(3).truncate(60),
question: Faker::Lorem.sentence(3) + "?",

View File

@@ -3,8 +3,8 @@ section "Creating Spending Proposals" do
60.times do
geozone = Geozone.all.sample
author = User.all.sample
description = "<p>#{Faker::Lorem.paragraphs.join('</p><p>')}</p>"
feasible_explanation = "<p>#{Faker::Lorem.paragraphs.join('</p><p>')}</p>"
description = "<p>#{Faker::Lorem.paragraphs.join("</p><p>")}</p>"
feasible_explanation = "<p>#{Faker::Lorem.paragraphs.join("</p><p>")}</p>"
valuation_finished = [true, false].sample
feasible = [true, false].sample
created_at = rand((Time.current - 1.week)..Time.current)

View File

@@ -9,7 +9,7 @@ describe HasFilters do
has_filters ["all", "pending", "reviewed"], only: :index
def index
render text: "#{@current_filter} (#{@valid_filters.join(' ')})"
render text: "#{@current_filter} (#{@valid_filters.join(" ")})"
end
end

View File

@@ -10,11 +10,11 @@ describe HasOrders do
has_orders ->(c) { ["votes_count", "flags_count"] }, only: :new
def index
render text: "#{@current_order} (#{@valid_orders.join(' ')})"
render text: "#{@current_order} (#{@valid_orders.join(" ")})"
end
def new
render text: "#{@current_order} (#{@valid_orders.join(' ')})"
render text: "#{@current_order} (#{@valid_orders.join(" ")})"
end
end

View File

@@ -6,7 +6,7 @@ FactoryBot.define do
postal_code "28002"
end
sequence(:document_number) { |n| "#{n.to_s.rjust(8, '0')}X" }
sequence(:document_number) { |n| "#{n.to_s.rjust(8, "0")}X" }
factory :verification_residence, class: Verification::Residence do
user