diff --git a/.erb-lint.yml b/.erb-lint.yml index e87a778f8..1643ea6f6 100644 --- a/.erb-lint.yml +++ b/.erb-lint.yml @@ -1,11 +1,15 @@ --- linters: + ClosingErbTagIndent: + enabled: true ErbSafety: enabled: true ExtraNewline: enabled: true FinalNewline: enabled: true + NoJavascriptTagHelper: + enabled: true SelfClosingTag: enabled: false SpaceAroundErbTag: @@ -18,29 +22,14 @@ linters: enabled: true Rubocop: enabled: true - only: - - Layout/EndOfLine - - Layout/SpaceAfterColon - - Layout/SpaceAfterComma - - Layout/SpaceAfterMethodName - - Layout/SpaceAfterNot - - Layout/SpaceAfterSemicolon - - Layout/SpaceAroundBlockParameters - - Layout/SpaceAroundOperators - - Layout/SpaceBeforeBlockBraces - - Layout/SpaceBeforeComma - - Layout/SpaceBeforeComment - - Layout/SpaceBeforeFirstArg - - Layout/SpaceBeforeSemicolon - - Layout/SpaceInsideArrayLiteralBrackets - - Layout/SpaceInsideArrayPercentLiteral - - Layout/SpaceInsideBlockBraces - - Layout/SpaceInsideHashLiteralBraces - - Layout/SpaceInsideParens - - Layout/SpaceInsidePercentLiteralDelimiters - - Layout/SpaceInsideRangeLiteral - - Layout/SpaceInsideReferenceBrackets - - Layout/SpaceInsideStringInterpolation - - Layout/Tab - - Lint/LiteralAsCondition - - Style/PercentLiteralDelimiters + rubocop_config: + inherit_from: + - .rubocop.yml + Layout/LineLength: + Enabled: false + Layout/TrailingEmptyLines: + Enabled: false + Lint/UselessAssignment: + Enabled: false + Rails/OutputSafety: + Enabled: false diff --git a/Gemfile b/Gemfile index 61c9b7a10..c8e81f860 100644 --- a/Gemfile +++ b/Gemfile @@ -99,7 +99,7 @@ group :development do gem "capistrano-rails", "~> 1.6.1", require: false gem "capistrano3-delayed-job", "~> 1.7.6" gem "capistrano3-puma", "~> 4.0.0" - gem "erb_lint", require: false + gem "erb_lint", "~> 0.0.35", require: false gem "github_changelog_generator", "~> 1.15.2" gem "mdl", "~> 0.11.0", require: false gem "rubocop", "~> 0.91.0", require: false diff --git a/Gemfile.lock b/Gemfile.lock index 59b833970..3dc9a30fb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -80,7 +80,7 @@ GEM babel-source (>= 4.0, < 6) execjs (~> 2.0) bcrypt (3.1.16) - better_html (1.0.13) + better_html (1.0.15) actionview (>= 4.0) activesupport (>= 4.0) ast (~> 2.0) @@ -208,12 +208,13 @@ GEM htmlentities (~> 4.3.3) launchy (~> 2.1) mail (~> 2.7) - erb_lint (0.0.28) + erb_lint (0.0.35) activesupport better_html (~> 1.0.7) html_tokenizer + parser (>= 2.7.1.4) rainbow - rubocop (~> 0.51) + rubocop (~> 0.79) smart_properties errbase (0.0.3) erubi (1.9.0) @@ -555,7 +556,7 @@ GEM simplecov-html (0.10.2) sitemap_generator (6.1.2) builder (~> 3.0) - smart_properties (1.13.1) + smart_properties (1.15.0) social-share-button (1.1.0) coffee-rails socksify (1.7.1) @@ -670,7 +671,7 @@ DEPENDENCIES devise-async (~> 1.0.0) devise-security (~> 0.11.1) email_spec (~> 2.2.0) - erb_lint + erb_lint (~> 0.0.35) factory_bot_rails (~> 4.8.2) faker (~> 1.8.7) font-awesome-sass (~> 5.15.1) diff --git a/app/controllers/admin/site_customization/content_blocks_controller.rb b/app/controllers/admin/site_customization/content_blocks_controller.rb index ed04b85a0..a7420c5e7 100644 --- a/app/controllers/admin/site_customization/content_blocks_controller.rb +++ b/app/controllers/admin/site_customization/content_blocks_controller.rb @@ -77,7 +77,7 @@ class Admin::SiteCustomization::ContentBlocksController < Admin::SiteCustomizati if @content_block.is_a? Budget::ContentBlock @selected_content_block = "hcb_#{@content_block.heading_id}" else - @selected_content_block = @content_block.heading.name + @selected_content_block = @content_block.name end @is_heading_content_block = true render :edit diff --git a/app/models/budget/content_block.rb b/app/models/budget/content_block.rb index 06de2bd19..fef73dc9a 100644 --- a/app/models/budget/content_block.rb +++ b/app/models/budget/content_block.rb @@ -4,5 +4,6 @@ class Budget validates :heading, presence: true, uniqueness: { scope: :locale } belongs_to :heading + delegate :name, to: :heading, allow_nil: true end end diff --git a/app/views/admin/budget_investments/edit.html.erb b/app/views/admin/budget_investments/edit.html.erb index 7aaddf857..e1bed238b 100644 --- a/app/views/admin/budget_investments/edit.html.erb +++ b/app/views/admin/budget_investments/edit.html.erb @@ -52,7 +52,7 @@
<%= f.select(:administrator_id, - @admins.collect { |a| [a.description_or_name_and_email, a.id] }, + @admins.map { |a| [a.description_or_name_and_email, a.id] }, { include_blank: t("admin.budget_investments.edit.undefined") }) %>
diff --git a/app/views/admin/budget_investments/show.html.erb b/app/views/admin/budget_investments/show.html.erb index 3727c5f4b..3d209eb57 100644 --- a/app/views/admin/budget_investments/show.html.erb +++ b/app/views/admin/budget_investments/show.html.erb @@ -25,7 +25,7 @@

<%= t("admin.budget_investments.show.classification") %>

<%= t("admin.budget_investments.show.assigned_admin") %>: - <%= @investment.administrator.try(:name_and_email) || t("admin.budget_investments.show.undefined") %> + <%= @investment.administrator&.name_and_email || t("admin.budget_investments.show.undefined") %>

@@ -37,7 +37,7 @@

<%= t("admin.budget_investments.show.valuator_groups") %>: <% if @investment.valuator_groups.any? %> - <%= @investment.valuator_groups.collect(&:name).join(", ") %> + <%= @investment.valuator_groups.map(&:name).join(", ") %> <% else %> <%= t("admin.budget_investments.show.undefined") %> <% end %> @@ -46,7 +46,7 @@

<%= t("admin.budget_investments.show.assigned_valuators") %>: <% if @investment.valuators.any? %> - <%= @investment.valuators.collect(&:name_and_email).join(", ") %> + <%= @investment.valuators.map(&:name_and_email).join(", ") %> <% else %> <%= t("admin.budget_investments.show.undefined") %> <% end %> diff --git a/app/views/admin/hidden_users/show.html.erb b/app/views/admin/hidden_users/show.html.erb index 1d82fb301..81458cf8e 100644 --- a/app/views/admin/hidden_users/show.html.erb +++ b/app/views/admin/hidden_users/show.html.erb @@ -36,4 +36,4 @@ <% end %> -<%= paginate [@debates, @comments].sort_by { |x| x.size }.last %> +<%= paginate [@debates, @comments].sort_by(&:size).last %> diff --git a/app/views/admin/milestones/_form.html.erb b/app/views/admin/milestones/_form.html.erb index a10a09aab..07fe07e8b 100644 --- a/app/views/admin/milestones/_form.html.erb +++ b/app/views/admin/milestones/_form.html.erb @@ -5,7 +5,7 @@

<%= f.select :status_id, - @statuses.collect { |s| [s.name, s.id] }, + @statuses.map { |s| [s.name, s.id] }, { include_blank: @statuses.any? ? "" : t("admin.milestones.form.no_statuses_defined") }, { disabled: @statuses.blank? } %> <%= link_to t("admin.milestones.form.admin_statuses"), diff --git a/app/views/admin/organizations/index.html.erb b/app/views/admin/organizations/index.html.erb index fb1dd0a58..c320087e8 100644 --- a/app/views/admin/organizations/index.html.erb +++ b/app/views/admin/organizations/index.html.erb @@ -22,7 +22,7 @@ <% @organizations.each do |organization| %> - <% hidden += 1 and next if organization.user.nil? || organization.user.hidden? %> + <% hidden += 1 and next if organization.user.nil? %> <%= organization.name %> <%= organization.email %> diff --git a/app/views/admin/settings/_featured_settings_table.html.erb b/app/views/admin/settings/_featured_settings_table.html.erb index 75dc5938b..8936b3cae 100644 --- a/app/views/admin/settings/_featured_settings_table.html.erb +++ b/app/views/admin/settings/_featured_settings_table.html.erb @@ -21,7 +21,7 @@ <% if feature.enabled? %> - <%= t ("admin.settings.index.features.enabled") %> + <%= t("admin.settings.index.features.enabled") %> <% else %> diff --git a/app/views/admin/settings/_map_form.html.erb b/app/views/admin/settings/_map_form.html.erb index 49d2496f2..8c85666f7 100644 --- a/app/views/admin/settings/_map_form.html.erb +++ b/app/views/admin/settings/_map_form.html.erb @@ -17,9 +17,9 @@ <%= form_tag admin_update_map_path, method: :put, id: "map-form" do |f| %> - <%= hidden_field_tag :latitude, Setting["map.latitude"] %> - <%= hidden_field_tag :longitude, Setting["map.longitude"] %> - <%= hidden_field_tag :zoom, Setting["map.zoom"] %> + <%= hidden_field_tag :latitude, Setting["map.latitude"] %> + <%= hidden_field_tag :longitude, Setting["map.longitude"] %> + <%= hidden_field_tag :zoom, Setting["map.zoom"] %>
<%= submit_tag t("admin.settings.index.map.form.submit"), diff --git a/app/views/admin/shared/_budget_investment_search.html.erb b/app/views/admin/shared/_budget_investment_search.html.erb index f29a3a0d1..86f77dfc5 100644 --- a/app/views/admin/shared/_budget_investment_search.html.erb +++ b/app/views/admin/shared/_budget_investment_search.html.erb @@ -7,8 +7,7 @@ <%= select_tag :heading_id, options_for_select(budget_heading_select_options(@budget), params[:heading_id]), - include_blank: true - %> + include_blank: true %>
diff --git a/app/views/admin/site_customization/content_blocks/edit.html.erb b/app/views/admin/site_customization/content_blocks/edit.html.erb index 6d0efd5e9..0a66bd5d5 100644 --- a/app/views/admin/site_customization/content_blocks/edit.html.erb +++ b/app/views/admin/site_customization/content_blocks/edit.html.erb @@ -1,5 +1,5 @@ <% provide :title do %> - <%= t("admin.header.title") %> - <%= t("admin.menu.site_customization.content_blocks") %> - <%= @content_block.try(:name) || @content_block.heading.try(:name) %> (<%= @content_block.locale %>) + <%= t("admin.header.title") %> - <%= t("admin.menu.site_customization.content_blocks") %> - <%= @content_block.name %> (<%= @content_block.locale %>) <% end %> <%= back_link_to admin_site_customization_content_blocks_path %> diff --git a/app/views/admin/site_customization/content_blocks/index.html.erb b/app/views/admin/site_customization/content_blocks/index.html.erb index ef069e448..d7a632709 100644 --- a/app/views/admin/site_customization/content_blocks/index.html.erb +++ b/app/views/admin/site_customization/content_blocks/index.html.erb @@ -43,7 +43,7 @@ <% end %> <% @headings_content_blocks.each do |content_block| %> - <%= link_to "#{content_block.heading.name} (#{content_block.locale})", admin_site_customization_edit_heading_content_block_path(content_block) %> + <%= link_to "#{content_block.name} (#{content_block.locale})", admin_site_customization_edit_heading_content_block_path(content_block) %> <%= raw content_block.body %> <%= render Admin::TableActionsComponent.new( diff --git a/app/views/admin/site_customization/information_texts/_tabs.html.erb b/app/views/admin/site_customization/information_texts/_tabs.html.erb index 4947e2a8c..a4a5b1822 100644 --- a/app/views/admin/site_customization/information_texts/_tabs.html.erb +++ b/app/views/admin/site_customization/information_texts/_tabs.html.erb @@ -2,7 +2,7 @@ <% information_texts_tabs.each do |tab| %>
  • <% if tab.to_s == @tab %> - <%= link_to t("admin.menu.site_customization.information_texts_menu.#{tab}"), admin_site_customization_information_texts_path(tab: tab), :class => "is-active" %> + <%= link_to t("admin.menu.site_customization.information_texts_menu.#{tab}"), admin_site_customization_information_texts_path(tab: tab), class: "is-active" %> <% else %> <%= link_to t("admin.menu.site_customization.information_texts_menu.#{tab}"), admin_site_customization_information_texts_path(tab: tab) %> <% end %> diff --git a/app/views/admin/valuators/_valuator_row.html.erb b/app/views/admin/valuators/_valuator_row.html.erb index c85e159cd..47ff21947 100644 --- a/app/views/admin/valuators/_valuator_row.html.erb +++ b/app/views/admin/valuators/_valuator_row.html.erb @@ -10,7 +10,7 @@ <% if valuator.valuator_group.present? %> - <%= valuator.valuator_group.try(:name) %> + <%= valuator.valuator_group&.name %> <% else %> <%= t("admin.valuators.index.no_group") %> <% end %> diff --git a/app/views/budgets/investments/_form.html.erb b/app/views/budgets/investments/_form.html.erb index 2156b9d60..f00bfaab7 100644 --- a/app/views/budgets/investments/_form.html.erb +++ b/app/views/budgets/investments/_form.html.erb @@ -4,7 +4,7 @@
    - <%= f.select :heading_id, budget_heading_select_options(@budget), { include_blank: true, } %> + <%= f.select :heading_id, budget_heading_select_options(@budget), { include_blank: true } %>
    diff --git a/app/views/budgets/investments/_investment.html.erb b/app/views/budgets/investments/_investment.html.erb index c3863f9ce..8d1464a9f 100644 --- a/app/views/budgets/investments/_investment.html.erb +++ b/app/views/budgets/investments/_investment.html.erb @@ -63,8 +63,7 @@ <%= render "/budgets/investments/votes", investment: investment, investment_votes: investment_votes, - vote_url: namespaced_budget_investment_vote_path(investment, value: "yes") - %> + vote_url: namespaced_budget_investment_vote_path(investment, value: "yes") %>
    <% elsif investment.should_show_vote_count? %>
    + ballot: ballot %>
    <% elsif investment.should_show_price? %>
    + vote_url: vote_budget_investment_path(investment.budget, investment, value: "yes") %>
    <% elsif investment.should_show_vote_count? %> diff --git a/app/views/budgets/investments/_votes.html.erb b/app/views/budgets/investments/_votes.html.erb index b4733a29b..e520ec3cc 100644 --- a/app/views/budgets/investments/_votes.html.erb +++ b/app/views/budgets/investments/_votes.html.erb @@ -50,8 +50,7 @@ image_url: image_absolute_url(investment.image, :thumb), url: budget_investment_url(investment.budget, investment), description: investment.title, - mobile: investment.title - %> + mobile: investment.title %>
    <% end %>
  • diff --git a/app/views/budgets/investments/show.html.erb b/app/views/budgets/investments/show.html.erb index b0eee0ec3..bc3976ead 100644 --- a/app/views/budgets/investments/show.html.erb +++ b/app/views/budgets/investments/show.html.erb @@ -7,8 +7,7 @@ investment: @investment, investment_ids: @investment_ids, investment_votes: @investment_votes, - ballot: @ballot -%> + ballot: @ballot %>
    diff --git a/app/views/debates/show.html.erb b/app/views/debates/show.html.erb index 6889122f8..deebcaf54 100644 --- a/app/views/debates/show.html.erb +++ b/app/views/debates/show.html.erb @@ -61,8 +61,7 @@ title: @debate.title, url: debate_url(@debate), description: @debate.title, - mobile: @debate.title - %> + mobile: @debate.title %>
    diff --git a/app/views/devise/password_expired/show.html.erb b/app/views/devise/password_expired/show.html.erb index ac3fd10ae..8eb10f6b4 100644 --- a/app/views/devise/password_expired/show.html.erb +++ b/app/views/devise/password_expired/show.html.erb @@ -1,6 +1,6 @@

    <%= t("devise.password_expired.expire_password") %>

    -<%= form_for(resource, :as => resource_name, :url => [resource_name, :password_expired], :html => { :method => :put }) do |f| %> +<%= form_for(resource, as: resource_name, url: [resource_name, :password_expired], html: { method: :put }) do |f| %> <%= f.password_field :current_password %>

    <%= f.password_field :password, label: t("devise.password_expired.new_password") %>

    diff --git a/app/views/kaminari/_first_page.html.erb b/app/views/kaminari/_first_page.html.erb index c97a20740..439f3257c 100644 --- a/app/views/kaminari/_first_page.html.erb +++ b/app/views/kaminari/_first_page.html.erb @@ -1,3 +1,3 @@
  • - <%= link_to t("views.pagination.first"), url, :remote => remote %> + <%= link_to t("views.pagination.first"), url, remote: remote %>
  • diff --git a/app/views/kaminari/_last_page.html.erb b/app/views/kaminari/_last_page.html.erb index cc2929aa0..c5a7831f5 100644 --- a/app/views/kaminari/_last_page.html.erb +++ b/app/views/kaminari/_last_page.html.erb @@ -1,3 +1,3 @@
  • - <%= link_to t("views.pagination.last"), url, :remote => remote %> + <%= link_to t("views.pagination.last"), url, remote: remote %>
  • diff --git a/app/views/kaminari/_next_page.html.erb b/app/views/kaminari/_next_page.html.erb index 6da585a67..0d1b188f0 100644 --- a/app/views/kaminari/_next_page.html.erb +++ b/app/views/kaminari/_next_page.html.erb @@ -1,3 +1,3 @@
  • - <%= link_to t("views.pagination.next"), url, :rel => "next", :remote => remote %> + <%= link_to t("views.pagination.next"), url, rel: "next", remote: remote %>
  • diff --git a/app/views/kaminari/_page.html.erb b/app/views/kaminari/_page.html.erb index c82b8968c..1a2625540 100644 --- a/app/views/kaminari/_page.html.erb +++ b/app/views/kaminari/_page.html.erb @@ -5,6 +5,6 @@ <% else %>
  • - <%= link_to page, url, { :remote => remote, :rel => page.next? ? "next" : page.prev? ? "prev" : nil } %> + <%= link_to page, url, { remote: remote, rel: page.next? ? "next" : page.prev? ? "prev" : nil } %>
  • <% end %> diff --git a/app/views/kaminari/_prev_page.html.erb b/app/views/kaminari/_prev_page.html.erb index 2ee045967..5ed7ef3a3 100644 --- a/app/views/kaminari/_prev_page.html.erb +++ b/app/views/kaminari/_prev_page.html.erb @@ -1,3 +1,3 @@
  • - <%= link_to t("views.pagination.previous"), url, :rel => "prev", :remote => remote %> + <%= link_to t("views.pagination.previous"), url, rel: "prev", remote: remote %>
  • diff --git a/app/views/layouts/_common_head.html.erb b/app/views/layouts/_common_head.html.erb index f034f7baf..d4c0d4daf 100644 --- a/app/views/layouts/_common_head.html.erb +++ b/app/views/layouts/_common_head.html.erb @@ -6,4 +6,3 @@ <%= javascript_include_tag "application", "data-turbolinks-track" => "reload" %> <%= csrf_meta_tags %> <%= favicon_link_tag "favicon.ico" %> -<%= render "layouts/disable_animations_in_tests" if Rails.env.test? %> diff --git a/app/views/layouts/_disable_animations_in_tests.html.erb b/app/views/layouts/_disable_animations_in_tests.html.erb deleted file mode 100644 index e2df3fe4e..000000000 --- a/app/views/layouts/_disable_animations_in_tests.html.erb +++ /dev/null @@ -1,8 +0,0 @@ -<%= javascript_tag "jQuery.fx.off = true" %> - diff --git a/app/views/layouts/_officing_booth.html.erb b/app/views/layouts/_officing_booth.html.erb index bee7e78d7..4b039584a 100644 --- a/app/views/layouts/_officing_booth.html.erb +++ b/app/views/layouts/_officing_booth.html.erb @@ -1,5 +1,5 @@ <% if current_user.poll_officer? %>
    - <%= t("admin.officing_booth.title", booth: try(:current_booth).try(:location)) %> + <%= t("admin.officing_booth.title", booth: try(:current_booth)&.location) %>
    <% end %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index f8ec90b25..dd3ad8add 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,5 +1,5 @@ - + <%= render "layouts/common_head", default_title: setting["org_name"] %> <%= render "layouts/tracking_data" %> diff --git a/app/views/layouts/dashboard.html.erb b/app/views/layouts/dashboard.html.erb index 1e6f413cc..045f061b8 100644 --- a/app/views/layouts/dashboard.html.erb +++ b/app/views/layouts/dashboard.html.erb @@ -1,5 +1,5 @@ - + diff --git a/app/views/legislation/annotations/_slim_version_chooser.html.erb b/app/views/legislation/annotations/_slim_version_chooser.html.erb index 996a93bfb..4cd42df39 100644 --- a/app/views/legislation/annotations/_slim_version_chooser.html.erb +++ b/app/views/legislation/annotations/_slim_version_chooser.html.erb @@ -20,7 +20,6 @@

    <%= t("legislation.shared.share") %>

    <%= render "/shared/social_share", title: t("legislation.shared.share_comment", version_name: @draft_version.title.downcase, process_name: @process.title), - url: legislation_process_draft_version_path(process, draft_version) - %> + url: legislation_process_draft_version_path(process, draft_version) %>
    diff --git a/app/views/legislation/annotations/show.html.erb b/app/views/legislation/annotations/show.html.erb index 6b4cbd331..3015cdd4c 100644 --- a/app/views/legislation/annotations/show.html.erb +++ b/app/views/legislation/annotations/show.html.erb @@ -39,8 +39,7 @@

    <%= t("legislation.shared.share") %>

    <%= render "/shared/social_share", title: t("legislation.shared.share_comment", version_name: @draft_version.title.downcase, process_name: @process.title), - url: legislation_process_draft_version_annotations_path(@process, @draft_version) - %> + url: legislation_process_draft_version_annotations_path(@process, @draft_version) %> diff --git a/app/views/legislation/processes/_header.html.erb b/app/views/legislation/processes/_header.html.erb index c5e462040..f0be35496 100644 --- a/app/views/legislation/processes/_header.html.erb +++ b/app/views/legislation/processes/_header.html.erb @@ -41,8 +41,7 @@ title: @process.title, url: legislation_process_url(@process), description: @process.title, - mobile: @process.title - %> + mobile: @process.title %> <% if @process.image.present? %>
    diff --git a/app/views/legislation/processes/_process.html.erb b/app/views/legislation/processes/_process.html.erb index 98e21d613..8919ee848 100644 --- a/app/views/legislation/processes/_process.html.erb +++ b/app/views/legislation/processes/_process.html.erb @@ -13,7 +13,7 @@
    - <%= markdown(process.summary.present? ? process.summary : first_paragraph(process.description)) %> + <%= markdown(process.summary.presence || first_paragraph(process.description)) %>
    diff --git a/app/views/legislation/proposals/_featured_votes.html.erb b/app/views/legislation/proposals/_featured_votes.html.erb index 979d2e90b..4c42406b0 100644 --- a/app/views/legislation/proposals/_featured_votes.html.erb +++ b/app/views/legislation/proposals/_featured_votes.html.erb @@ -36,8 +36,7 @@ title: proposal.title, url: proposal_url(proposal), description: proposal.summary, - mobile: proposal.title - %> + mobile: proposal.title %>
    <% end %> <% end %> diff --git a/app/views/legislation/proposals/_form.html.erb b/app/views/legislation/proposals/_form.html.erb index 9985bfa03..f1f8aef59 100644 --- a/app/views/legislation/proposals/_form.html.erb +++ b/app/views/legislation/proposals/_form.html.erb @@ -1,7 +1,7 @@ <%= form_for(@proposal, url: form_url) do |f| %> <%= render "shared/errors", resource: @proposal %> - <%= f.hidden_field(:legislation_process_id, :value => params[:process_id]) %> + <%= f.hidden_field(:legislation_process_id, value: params[:process_id]) %>
    diff --git a/app/views/legislation/proposals/_votes.html.erb b/app/views/legislation/proposals/_votes.html.erb index e60c4e2d4..d78c24c4d 100644 --- a/app/views/legislation/proposals/_votes.html.erb +++ b/app/views/legislation/proposals/_votes.html.erb @@ -70,8 +70,7 @@ title: proposal.title, url: proposal_url(proposal), description: proposal.summary, - mobile: proposal.title - %> + mobile: proposal.title %>
    <% end %>
    diff --git a/app/views/legislation/proposals/show.html.erb b/app/views/legislation/proposals/show.html.erb index fdf7347a7..6d0baea0e 100644 --- a/app/views/legislation/proposals/show.html.erb +++ b/app/views/legislation/proposals/show.html.erb @@ -110,8 +110,7 @@ title: @proposal.title, url: legislation_process_proposal_url(process_id: @process), description: @proposal.summary, - mobile: @proposal.title - %> + mobile: @proposal.title %> diff --git a/app/views/mailer/budget_investment_created.html.erb b/app/views/mailer/budget_investment_created.html.erb index c7a866112..3c0c29980 100644 --- a/app/views/mailer/budget_investment_created.html.erb +++ b/app/views/mailer/budget_investment_created.html.erb @@ -25,7 +25,7 @@ <%= link_to budget_investment_url(@investment.budget, @investment, anchor: "social-share"), style: "font-family: 'Open Sans','Helvetica Neue',arial,sans-serif; background: #f7f5f2; border-radius: 6px; color: #3d3d66!important; font-weight: bold; margin: 0px; padding: 10px 15px; text-align: center; text-decoration: none; min-width: 160px; display: inline-block;" do %> - <%= image_tag("icon_mailer_share.png", style: "border: 0; display: inline-block; width: 100%; max-width: 16px", alt: "") %> + <%= image_tag("icon_mailer_share.png", style: "border: 0; display: inline-block; width: 100%; max-width: 16px", alt: "") %> <%= t("mailers.budget_investment_created.share") %> <% end %> diff --git a/app/views/mailer/budget_investment_selected.html.erb b/app/views/mailer/budget_investment_selected.html.erb index 876c73443..08e3409b8 100644 --- a/app/views/mailer/budget_investment_selected.html.erb +++ b/app/views/mailer/budget_investment_selected.html.erb @@ -13,7 +13,7 @@ <%= link_to budget_investment_url(@investment.budget, @investment, anchor: "social-share"), style: "font-family: 'Open Sans','Helvetica Neue',arial,sans-serif; background: #f7f5f2; border-radius: 6px; color: #3d3d66 !important; font-weight: bold; margin: 0px; padding: 10px 15px; text-align: center; text-decoration: none; min-width: 160px; display: inline-block;" do %> - <%= image_tag("icon_mailer_share.png", style: "border: 0; display: inline-block; width: 100%; max-width: 16px", alt: "") %> + <%= image_tag("icon_mailer_share.png", style: "border: 0; display: inline-block; width: 100%; max-width: 16px", alt: "") %> <%= t("mailers.budget_investment_selected.share_button") %> <% end %> diff --git a/app/views/mailer/proposal_notification_digest.html.erb b/app/views/mailer/proposal_notification_digest.html.erb index d70ff3eef..576b592cd 100644 --- a/app/views/mailer/proposal_notification_digest.html.erb +++ b/app/views/mailer/proposal_notification_digest.html.erb @@ -38,12 +38,12 @@ <%= link_to proposal_url(notification.notifiable.proposal, anchor: "social-share"), style: "font-family: 'Open Sans','Helvetica Neue',arial,sans-serif; background: #f7f5f2; border-radius: 6px; color: #3d3d66!important; font-weight: bold; margin: 0px; padding: 10px 15px; text-align: center; text-decoration: none; min-width: 160px; display: inline-block;" do %> - <%= image_tag("icon_mailer_share.png", style: "border: 0; display: inline-block; width: 100%; max-width: 16px", alt: "") %> + <%= image_tag("icon_mailer_share.png", style: "border: 0; display: inline-block; width: 100%; max-width: 16px", alt: "") %> <%= t("mailers.proposal_notification_digest.share") %> <% end %> <%= link_to proposal_url(notification.notifiable.proposal, anchor: "comments"), style: "font-family: 'Open Sans','Helvetica Neue',arial,sans-serif; background: #f7f5f2; border-radius: 6px; color: #3d3d66!important; font-weight: bold; margin: 0px; padding: 10px 15px; text-align: center; text-decoration: none; min-width: 160px; display: inline-block; margin-left: 12px;" do %> - <%= image_tag("icon_mailer_comment.png", style: "border: 0; display: inline-block; width: 100%; max-width: 16px; vertical-align: middle;", alt: "") %> + <%= image_tag("icon_mailer_comment.png", style: "border: 0; display: inline-block; width: 100%; max-width: 16px; vertical-align: middle;", alt: "") %> <%= t("mailers.proposal_notification_digest.comment") %> <% end %> diff --git a/app/views/management/_user_permissions.html.erb b/app/views/management/_user_permissions.html.erb index b6c5d6b95..f083cd322 100644 --- a/app/views/management/_user_permissions.html.erb +++ b/app/views/management/_user_permissions.html.erb @@ -1,9 +1,7 @@ -<% - # Parameters: +<%# # Parameters: # message: A string explaining the permissions # permissions: An array of symbols containing the permissions - # (can be :debates, :proposal, :support_proposal, :votes) -%> + # (can be :debates, :proposal, :support_proposal, :votes) %>

    <%= message %>

    diff --git a/app/views/management/budgets/investments/index.html.erb b/app/views/management/budgets/investments/index.html.erb index 9343f3519..e44f904de 100644 --- a/app/views/management/budgets/investments/index.html.erb +++ b/app/views/management/budgets/investments/index.html.erb @@ -22,8 +22,7 @@ investment: investment, investment_ids: @investment_ids, investment_votes: @investment_votes, - ballot: @ballot - %> + ballot: @ballot %> <% end %> <%= paginate @investments %> diff --git a/app/views/management/budgets/investments/print.html.erb b/app/views/management/budgets/investments/print.html.erb index 79b991e69..f6fcc4bab 100644 --- a/app/views/management/budgets/investments/print.html.erb +++ b/app/views/management/budgets/investments/print.html.erb @@ -27,8 +27,7 @@ investment: investment, investment_ids: @investment_ids, investment_votes: @investment_votes, - ballot: @ballot - %> + ballot: @ballot %> <% end %>
    diff --git a/app/views/management/budgets/investments/show.html.erb b/app/views/management/budgets/investments/show.html.erb index a2451c239..99dea2eaa 100644 --- a/app/views/management/budgets/investments/show.html.erb +++ b/app/views/management/budgets/investments/show.html.erb @@ -4,5 +4,4 @@ <%= render "/budgets/investments/investment_show", investment: @investment, - investment_votes: @investment_votes -%> + investment_votes: @investment_votes %> diff --git a/app/views/officing/booth/new.html.erb b/app/views/officing/booth/new.html.erb index 6cbfeda0f..0b4cda988 100644 --- a/app/views/officing/booth/new.html.erb +++ b/app/views/officing/booth/new.html.erb @@ -11,7 +11,7 @@
    <%= f.select :id, - @booths.collect { |booth| [booth.location, booth.id] }, + @booths.map { |booth| [booth.location, booth.id] }, selected: @booths.first, label: false, tabindex: "1" %> diff --git a/app/views/organizations/registrations/new.html.erb b/app/views/organizations/registrations/new.html.erb index 1f6b4b22e..ce0d4a025 100644 --- a/app/views/organizations/registrations/new.html.erb +++ b/app/views/organizations/registrations/new.html.erb @@ -16,7 +16,7 @@ <%= f.email_field :email, placeholder: t("devise_views.organizations.registrations.new.email_label") %> - <%= f.text_field :phone_number, placeholder: t("devise_views.organizations.registrations.new.phone_number_label") %> + <%= f.text_field :phone_number, placeholder: t("devise_views.organizations.registrations.new.phone_number_label") %> <%= f.invisible_captcha :address %> diff --git a/app/views/polls/_poll_header.html.erb b/app/views/polls/_poll_header.html.erb index 71e9ae622..77e95679d 100644 --- a/app/views/polls/_poll_header.html.erb +++ b/app/views/polls/_poll_header.html.erb @@ -27,8 +27,7 @@ title: @poll.name, url: poll_url(@poll), description: @poll.name, - mobile: @poll.name - %> + mobile: @poll.name %>
    diff --git a/app/views/proposals/_featured_votes.html.erb b/app/views/proposals/_featured_votes.html.erb index 979d2e90b..4c42406b0 100644 --- a/app/views/proposals/_featured_votes.html.erb +++ b/app/views/proposals/_featured_votes.html.erb @@ -36,8 +36,7 @@ title: proposal.title, url: proposal_url(proposal), description: proposal.summary, - mobile: proposal.title - %> + mobile: proposal.title %>
    <% end %> <% end %> diff --git a/app/views/proposals/share.html.erb b/app/views/proposals/share.html.erb index bf474c284..9c390107a 100644 --- a/app/views/proposals/share.html.erb +++ b/app/views/proposals/share.html.erb @@ -25,8 +25,7 @@ title: @proposal.title, url: proposal_url(@proposal), description: @proposal.summary, - mobile: @proposal.title - %> + mobile: @proposal.title %> <% if can?(:dashboard, @proposal) %>
    diff --git a/app/views/shared/_wide_order_selector.html.erb b/app/views/shared/_wide_order_selector.html.erb index 10f7f962f..2aa092cbd 100644 --- a/app/views/shared/_wide_order_selector.html.erb +++ b/app/views/shared/_wide_order_selector.html.erb @@ -1,7 +1,6 @@ <% # Params: # - # i18n_namespace: for example "moderation.debates.index" -%> + # i18n_namespace: for example "moderation.debates.index" %> <% if @valid_orders.present? && @valid_orders.count > 1 %>
    diff --git a/app/views/users/registrations/new.html.erb b/app/views/users/registrations/new.html.erb index 7dafa264f..888acbac6 100644 --- a/app/views/users/registrations/new.html.erb +++ b/app/views/users/registrations/new.html.erb @@ -23,7 +23,7 @@ <%= f.invisible_captcha :address %> - <%= f.email_field :email, placeholder: t("devise_views.users.registrations.new.email_label") %> + <%= f.email_field :email, placeholder: t("devise_views.users.registrations.new.email_label") %> <%= f.password_field :password, autocomplete: "off", placeholder: t("devise_views.users.registrations.new.password_label") %> diff --git a/app/views/valuation/budget_investments/_dossier_form.html.erb b/app/views/valuation/budget_investments/_dossier_form.html.erb index a5229234d..56460f0ed 100644 --- a/app/views/valuation/budget_investments/_dossier_form.html.erb +++ b/app/views/valuation/budget_investments/_dossier_form.html.erb @@ -47,7 +47,7 @@
    <%= f.number_field :price_first_year, - label: t("valuation.budget_investments.edit.price_first_year", currency: budget.currency_symbol), + label: t("valuation.budget_investments.edit.price_first_year", currency: budget.currency_symbol), max: 1000000000000000 %>
    diff --git a/spec/models/budget/content_block_spec.rb b/spec/models/budget/content_block_spec.rb index 68d6f0a17..e8d1e4d28 100644 --- a/spec/models/budget/content_block_spec.rb +++ b/spec/models/budget/content_block_spec.rb @@ -19,4 +19,18 @@ describe Budget::ContentBlock do heading: heading_content_block_en.heading, locale: "es") expect(valid_block).to be_valid end + + describe "#name" do + it "uses the heading name" do + block = Budget::ContentBlock.new(heading: Budget::Heading.new(name: "Central")) + + expect(block.name).to eq "Central" + end + + it "returns nil on new records without heading" do + block = Budget::ContentBlock.new + + expect(block.name).to be_nil + end + end end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 44e369ffa..29fc2eece 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -47,5 +47,6 @@ end Capybara.exact = true Capybara.enable_aria_label = true +Capybara.disable_animation = true OmniAuth.config.test_mode = true