diff --git a/.rubocop.yml b/.rubocop.yml index 2442210e7..3dd4dad6d 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -64,6 +64,13 @@ Layout/FirstArrayElementIndentation: Enabled: true EnforcedStyle: consistent +Layout/FirstHashElementIndentation: + Enabled: true + EnforcedStyle: consistent + +Layout/HashAlignment: + Enabled: true + Layout/HeredocIndentation: Enabled: true @@ -92,6 +99,12 @@ Layout/MultilineArrayBraceLayout: Layout/MultilineBlockLayout: Enabled: true +Layout/MultilineHashBraceLayout: + Enabled: true + +Layout/MultilineHashKeyLineBreaks: + Enabled: true + Layout/SpaceAfterColon: Enabled: true diff --git a/app/components/admin/budgets/actions_component.rb b/app/components/admin/budgets/actions_component.rb index 0ac54df74..6637a1c5f 100644 --- a/app/components/admin/budgets/actions_component.rb +++ b/app/components/admin/budgets/actions_component.rb @@ -83,10 +83,10 @@ class Admin::Budgets::ActionsComponent < ApplicationComponent balloting_phase = budget.phases.find_by(kind: "balloting") admin_polls_path(poll: { - name: budget.name, + name: budget.name, budget_id: budget.id, starts_at: balloting_phase.starts_at, - ends_at: balloting_phase.ends_at + ends_at: balloting_phase.ends_at }) end diff --git a/app/components/admin/geozones/form_component.html.erb b/app/components/admin/geozones/form_component.html.erb index 7d55ecf00..bd6a00ab9 100644 --- a/app/components/admin/geozones/form_component.html.erb +++ b/app/components/admin/geozones/form_component.html.erb @@ -41,6 +41,6 @@
<%= f.submit(value: t("admin.geozones.edit.form.submit_button"), - class: "button success") %> + class: "button success") %>
<% end %> diff --git a/app/components/admin/site_customization/information_texts/form_field_component.html.erb b/app/components/admin/site_customization/information_texts/form_field_component.html.erb index dc0e18a3f..2bda944d7 100644 --- a/app/components/admin/site_customization/information_texts/form_field_component.html.erb +++ b/app/components/admin/site_customization/information_texts/form_field_component.html.erb @@ -5,5 +5,5 @@ rows: 5, class: "js-globalize-attribute", style: site_customization_display_translation_style(locale), - data: { locale: locale } %> + data: { locale: locale } %> <% end %> diff --git a/app/components/budgets/investments/form_component.html.erb b/app/components/budgets/investments/form_component.html.erb index 20b15c201..0b52328f3 100644 --- a/app/components/budgets/investments/form_component.html.erb +++ b/app/components/budgets/investments/form_component.html.erb @@ -51,10 +51,10 @@ <% if feature?(:map) %>
<%= render "map_locations/form_fields", - form: f, + form: f, map_location: investment.map_location || MapLocation.new, - label: t("budgets.investments.form.map_location"), - help: t("budgets.investments.form.map_location_instructions"), + label: t("budgets.investments.form.map_location"), + help: t("budgets.investments.form.map_location_instructions"), i18n_namespace: "budgets.investments" %>
<% end %> @@ -80,11 +80,11 @@
<%= f.text_field :tag_list, value: investment.tag_list.to_s, - label: false, - placeholder: t("budgets.investments.form.tags_placeholder"), - aria: { describedby: "tags-list-help-text" }, - class: "js-tag-list tag-autocomplete", - data: { js_url: suggest_tags_path } %> + label: false, + placeholder: t("budgets.investments.form.tags_placeholder"), + aria: { describedby: "tags-list-help-text" }, + class: "js-tag-list tag-autocomplete", + data: { js_url: suggest_tags_path } %> <%= render SDG::RelatedListSelectorComponent.new(f) %> diff --git a/app/components/budgets/investments/votes_component.html.erb b/app/components/budgets/investments/votes_component.html.erb index 0ce045d3d..89612f4b6 100644 --- a/app/components/budgets/investments/votes_component.html.erb +++ b/app/components/budgets/investments/votes_component.html.erb @@ -27,7 +27,7 @@ title: t("budgets.investments.investment.support_title"), method: "post", remote: !display_support_alert?, - data: ({ confirm: confirm_vote_message } if display_support_alert?), + data: ({ confirm: confirm_vote_message } if display_support_alert?), "aria-label": support_aria_label %> <% end %> <% end %> diff --git a/app/components/debates/form_component.html.erb b/app/components/debates/form_component.html.erb index f7d1b2098..42aa1d38f 100644 --- a/app/components/debates/form_component.html.erb +++ b/app/components/debates/form_component.html.erb @@ -29,10 +29,10 @@
<%= f.text_field :tag_list, value: debate.tag_list.to_s, - hint: t("debates.form.tags_instructions"), - placeholder: t("debates.form.tags_placeholder"), - data: { js_url: suggest_tags_path }, - class: "tag-autocomplete" %> + hint: t("debates.form.tags_instructions"), + placeholder: t("debates.form.tags_placeholder"), + data: { js_url: suggest_tags_path }, + class: "tag-autocomplete" %>
<%= render SDG::RelatedListSelectorComponent.new(f) %> diff --git a/app/components/documents/nested_component.rb b/app/components/documents/nested_component.rb index 2b4f6f909..f3adb214b 100644 --- a/app/components/documents/nested_component.rb +++ b/app/components/documents/nested_component.rb @@ -17,8 +17,8 @@ class Documents::NestedComponent < ApplicationComponent def note t "documents.form.note", max_documents_allowed: max_documents_allowed, - accepted_content_types: Document.humanized_accepted_content_types, - max_file_size: documentable.class.max_file_size + accepted_content_types: Document.humanized_accepted_content_types, + max_file_size: documentable.class.max_file_size end def max_documents_allowed? diff --git a/app/components/images/nested_component.rb b/app/components/images/nested_component.rb index 768f4d880..448e8d810 100644 --- a/app/components/images/nested_component.rb +++ b/app/components/images/nested_component.rb @@ -14,6 +14,6 @@ class Images::NestedComponent < ApplicationComponent def note t "images.form.note", accepted_content_types: Image.humanized_accepted_content_types, - max_file_size: Image.max_file_size + max_file_size: Image.max_file_size end end diff --git a/app/components/layout/footer_component.html.erb b/app/components/layout/footer_component.html.erb index 8b63dbab5..1dea274fc 100644 --- a/app/components/layout/footer_component.html.erb +++ b/app/components/layout/footer_component.html.erb @@ -8,7 +8,7 @@

<%= sanitize(t("layouts.footer.description", open_source: link_to(t("layouts.footer.open_source"), t("layouts.footer.open_source_url"), target: "blank", rel: "nofollow"), - consul: link_to(t("layouts.footer.consul"), t("layouts.footer.consul_url"), target: "blank", rel: "nofollow"))) %> + consul: link_to(t("layouts.footer.consul"), t("layouts.footer.consul_url"), target: "blank", rel: "nofollow"))) %>

diff --git a/app/components/layout/notification_item_component.html.erb b/app/components/layout/notification_item_component.html.erb index 363c2fd2d..8be3090d3 100644 --- a/app/components/layout/notification_item_component.html.erb +++ b/app/components/layout/notification_item_component.html.erb @@ -1,7 +1,8 @@ <% if user %>
  • - <%= link_to notifications_path, rel: "nofollow", title: text, - class: "notifications #{notifications_class}" do %> + <%= link_to notifications_path, rel: "nofollow", + title: text, + class: "notifications #{notifications_class}" do %> <%= t("layouts.header.notification_item.notifications") %> diff --git a/app/components/proposals/form_component.html.erb b/app/components/proposals/form_component.html.erb index 658ca2f90..727606511 100644 --- a/app/components/proposals/form_component.html.erb +++ b/app/components/proposals/form_component.html.erb @@ -59,10 +59,10 @@ <% if feature?(:map) %>
    <%= render "map_locations/form_fields", - form: f, + form: f, map_location: proposal.map_location || MapLocation.new, - label: t("proposals.form.map_location"), - help: t("proposals.form.map_location_instructions"), + label: t("proposals.form.map_location"), + help: t("proposals.form.map_location_instructions"), i18n_namespace: "proposals" %>
    <% end %> @@ -80,11 +80,11 @@
    <%= f.text_field :tag_list, value: proposal.tag_list.to_s, - label: false, - placeholder: t("proposals.form.tags_placeholder"), - class: "js-tag-list tag-autocomplete", - aria: { describedby: "tag-list-help-text" }, - data: { js_url: suggest_tags_path } %> + label: false, + placeholder: t("proposals.form.tags_placeholder"), + class: "js-tag-list tag-autocomplete", + aria: { describedby: "tag-list-help-text" }, + data: { js_url: suggest_tags_path } %> <% if current_user.unverified? %> diff --git a/app/controllers/admin/budgets_wizard/budgets_controller.rb b/app/controllers/admin/budgets_wizard/budgets_controller.rb index 51952f78f..84b92f890 100644 --- a/app/controllers/admin/budgets_wizard/budgets_controller.rb +++ b/app/controllers/admin/budgets_wizard/budgets_controller.rb @@ -37,8 +37,10 @@ class Admin::BudgetsWizard::BudgetsController < Admin::BudgetsWizard::BaseContro end def allowed_params - valid_attributes = [:currency_symbol, :voting_style, :hide_money, administrator_ids: [], - valuator_ids: [], image_attributes: image_attributes] + valid_attributes = [:currency_symbol, :voting_style, :hide_money, + administrator_ids: [], + valuator_ids: [], + image_attributes: image_attributes] [*valid_attributes, translation_params(Budget)] end diff --git a/app/controllers/admin/site_customization/content_blocks_controller.rb b/app/controllers/admin/site_customization/content_blocks_controller.rb index 585711f59..d553c1446 100644 --- a/app/controllers/admin/site_customization/content_blocks_controller.rb +++ b/app/controllers/admin/site_customization/content_blocks_controller.rb @@ -1,10 +1,10 @@ class Admin::SiteCustomization::ContentBlocksController < Admin::SiteCustomization::BaseController load_and_authorize_resource :content_block, class: "SiteCustomization::ContentBlock", - except: [ - :delete_heading_content_block, - :edit_heading_content_block, - :update_heading_content_block - ] + except: [ + :delete_heading_content_block, + :edit_heading_content_block, + :update_heading_content_block + ] def index @content_blocks = SiteCustomization::ContentBlock.order(:name, :locale) diff --git a/app/controllers/admin/system_emails_controller.rb b/app/controllers/admin/system_emails_controller.rb index b112ac414..502e735bb 100644 --- a/app/controllers/admin/system_emails_controller.rb +++ b/app/controllers/admin/system_emails_controller.rb @@ -4,17 +4,17 @@ class Admin::SystemEmailsController < Admin::BaseController def index @system_emails = { proposal_notification_digest: %w[view preview_pending], - budget_investment_created: %w[view edit_info], - budget_investment_selected: %w[view edit_info], + budget_investment_created: %w[view edit_info], + budget_investment_selected: %w[view edit_info], budget_investment_unfeasible: %w[view edit_info], budget_investment_unselected: %w[view edit_info], - comment: %w[view edit_info], - reply: %w[view edit_info], - direct_message_for_receiver: %w[view edit_info], - direct_message_for_sender: %w[view edit_info], - email_verification: %w[view edit_info], - user_invite: %w[view edit_info], - evaluation_comment: %w[view edit_info] + comment: %w[view edit_info], + reply: %w[view edit_info], + direct_message_for_receiver: %w[view edit_info], + direct_message_for_sender: %w[view edit_info], + email_verification: %w[view edit_info], + user_invite: %w[view edit_info], + evaluation_comment: %w[view edit_info] } end diff --git a/app/controllers/dashboard/actions_controller.rb b/app/controllers/dashboard/actions_controller.rb index 0a0b0d907..1de3f91d5 100644 --- a/app/controllers/dashboard/actions_controller.rb +++ b/app/controllers/dashboard/actions_controller.rb @@ -30,8 +30,9 @@ class Dashboard::ActionsController < Dashboard::BaseController def execute authorize! :dashboard, proposal - Dashboard::ExecutedAction.create(proposal: proposal, action: dashboard_action, - executed_at: Time.current) + Dashboard::ExecutedAction.create(proposal: proposal, + action: dashboard_action, + executed_at: Time.current) redirect_to request.referer end diff --git a/app/controllers/dashboard/poster_controller.rb b/app/controllers/dashboard/poster_controller.rb index 6c796973f..0d3955da6 100644 --- a/app/controllers/dashboard/poster_controller.rb +++ b/app/controllers/dashboard/poster_controller.rb @@ -10,7 +10,7 @@ class Dashboard::PosterController < Dashboard::BaseController dpi: 300, zoom: 0.32, show_as_html: Rails.env.test? || params.key?("debug"), - margin: { top: 0 } + margin: { top: 0 } end end end diff --git a/app/controllers/officing/voters_controller.rb b/app/controllers/officing/voters_controller.rb index bd7e4cd24..26b1a7f53 100644 --- a/app/controllers/officing/voters_controller.rb +++ b/app/controllers/officing/voters_controller.rb @@ -13,7 +13,7 @@ class Officing::VotersController < Officing::BaseController def create @poll = Poll.find(voter_params[:poll_id]) @user = User.find(voter_params[:user_id]) - @voter = Poll::Voter.new(document_type: @user.document_type, + @voter = Poll::Voter.new(document_type: @user.document_type, document_number: @user.document_number, user: @user, poll: @poll, diff --git a/app/controllers/valuation/budget_investments_controller.rb b/app/controllers/valuation/budget_investments_controller.rb index 185606ff1..3adee9d37 100644 --- a/app/controllers/valuation/budget_investments_controller.rb +++ b/app/controllers/valuation/budget_investments_controller.rb @@ -86,10 +86,10 @@ class Valuation::BudgetInvestmentsController < Valuation::BaseController investment_headings.reduce(all_headings_filter) do |filters, heading| filters << { - name: heading.name, - id: heading.id, - count: investments.count { |i| i.heading_id == heading.id } - } + name: heading.name, + id: heading.id, + count: investments.count { |i| i.heading_id == heading.id } + } end end diff --git a/app/helpers/budgets_helper.rb b/app/helpers/budgets_helper.rb index 0352570ed..ffcfc548c 100644 --- a/app/helpers/budgets_helper.rb +++ b/app/helpers/budgets_helper.rb @@ -33,13 +33,13 @@ module BudgetsHelper def budget_subnav_items_for(budget) { - results: t("budgets.results.link"), - stats: t("stats.budgets.link"), + results: t("budgets.results.link"), + stats: t("stats.budgets.link"), executions: t("budgets.executions.link") }.select { |section, _| can?(:"read_#{section}", budget) }.map do |section, text| { text: text, - url: send("budget_#{section}_path", budget), + url: send("budget_#{section}_path", budget), active: controller_name == section.to_s } end diff --git a/app/helpers/legislation_helper.rb b/app/helpers/legislation_helper.rb index dcc968a72..a62111397 100644 --- a/app/helpers/legislation_helper.rb +++ b/app/helpers/legislation_helper.rb @@ -9,12 +9,12 @@ module LegislationHelper def legislation_process_tabs(process) { - "info" => edit_admin_legislation_process_path(process), - "homepage" => edit_admin_legislation_process_homepage_path(process), - "questions" => admin_legislation_process_questions_path(process), - "proposals" => admin_legislation_process_proposals_path(process), + "info" => edit_admin_legislation_process_path(process), + "homepage" => edit_admin_legislation_process_homepage_path(process), + "questions" => admin_legislation_process_questions_path(process), + "proposals" => admin_legislation_process_proposals_path(process), "draft_versions" => admin_legislation_process_draft_versions_path(process), - "milestones" => admin_legislation_process_milestones_path(process) + "milestones" => admin_legislation_process_milestones_path(process) } end diff --git a/app/helpers/milestones_helper.rb b/app/helpers/milestones_helper.rb index 888955e4e..e98ea3b1f 100644 --- a/app/helpers/milestones_helper.rb +++ b/app/helpers/milestones_helper.rb @@ -3,7 +3,7 @@ module MilestonesHelper text = number_to_percentage(progress_bar.percentage, precision: 0) tag.div class: "progress", - role: "progressbar", + role: "progressbar", "aria-valuenow": progress_bar.percentage, "aria-valuetext": "#{progress_bar.percentage}%", "aria-valuemax": ProgressBar::RANGE.max, diff --git a/app/helpers/translatable_form_helper.rb b/app/helpers/translatable_form_helper.rb index 6e73433c9..1ca593e1d 100644 --- a/app/helpers/translatable_form_helper.rb +++ b/app/helpers/translatable_form_helper.rb @@ -70,7 +70,7 @@ module TranslatableFormHelper { class: "translatable-fields js-globalize-attribute #{highlight_translation_html_class}", style: @template.display_translation_style(resource.globalized_model, locale), - data: { locale: locale } + data: { locale: locale } } end diff --git a/app/models/budget/heading.rb b/app/models/budget/heading.rb index 7b8fbde57..40cd75580 100644 --- a/app/models/budget/heading.rb +++ b/app/models/budget/heading.rb @@ -33,9 +33,9 @@ class Budget validates :slug, presence: true, format: /\A[a-z0-9\-_]+\z/ validates :population, numericality: { greater_than: 0 }, allow_nil: true validates :latitude, length: { maximum: 22 }, allow_blank: true, \ - format: /\A(-|\+)?([1-8]?\d(?:\.\d{1,})?|90(?:\.0{1,6})?)\z/ + format: /\A(-|\+)?([1-8]?\d(?:\.\d{1,})?|90(?:\.0{1,6})?)\z/ validates :longitude, length: { maximum: 22 }, allow_blank: true, \ - format: /\A(-|\+)?((?:1[0-7]|[1-9])?\d(?:\.\d{1,})?|180(?:\.0{1,})?)\z/ + format: /\A(-|\+)?((?:1[0-7]|[1-9])?\d(?:\.\d{1,})?|180(?:\.0{1,})?)\z/ validates :max_ballot_lines, numericality: { greater_than_or_equal_to: 1 } delegate :budget, :budget_id, to: :group, allow_nil: true diff --git a/app/models/budget/investment.rb b/app/models/budget/investment.rb index 7381ab78e..f19335baa 100644 --- a/app/models/budget/investment.rb +++ b/app/models/budget/investment.rb @@ -51,7 +51,7 @@ class Budget has_many :comments, -> { where(valuation: false) }, as: :commentable, inverse_of: :commentable has_one :summary_comment, as: :commentable, class_name: "MlSummaryComment", dependent: :destroy has_many :valuations, -> { where(valuation: true) }, - as: :commentable, + as: :commentable, inverse_of: :commentable, class_name: "Comment" @@ -203,8 +203,9 @@ class Budget end def searchable_values - { author.username => "B", - heading.name => "B", + { + author.username => "B", + heading.name => "B", tag_list.join(" ") => "B" }.merge(searchable_globalized_values) end @@ -394,7 +395,7 @@ class Budget end def searchable_translations_definitions - { title => "A", + { title => "A", description => "D" } end end diff --git a/app/models/comment.rb b/app/models/comment.rb index a3304e34e..762f1bdef 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -57,10 +57,10 @@ class Comment < ApplicationRecord def self.build(commentable, user, body, p_id = nil, valuation = false) new(commentable: commentable, - user_id: user.id, - body: body, - parent_id: p_id, - valuation: valuation) + user_id: user.id, + body: body, + parent_id: p_id, + valuation: valuation) end def self.find_commentable(c_type, c_id) @@ -134,7 +134,7 @@ class Comment < ApplicationRecord def searchable_values { - body => "A", + body => "A", commentable&.title => "B" } end diff --git a/app/models/concerns/relationable.rb b/app/models/concerns/relationable.rb index 6bbe678ca..ea73185d7 100644 --- a/app/models/concerns/relationable.rb +++ b/app/models/concerns/relationable.rb @@ -3,9 +3,9 @@ module Relationable included do has_many :related_contents, - as: :parent_relationable, + as: :parent_relationable, inverse_of: :parent_relationable, - dependent: :destroy + dependent: :destroy end def find_related_content(relationable) diff --git a/app/models/debate.rb b/app/models/debate.rb index 532144805..5333c08ad 100644 --- a/app/models/debate.rb +++ b/app/models/debate.rb @@ -57,15 +57,15 @@ class Debate < ApplicationRecord end def searchable_translations_definitions - { title => "A", + { title => "A", description => "D" } end def searchable_values { - author.username => "B", + author.username => "B", tag_list.join(" ") => "B", - geozone&.name => "B" + geozone&.name => "B" }.merge!(searchable_globalized_values) end diff --git a/app/models/legislation/draft_version.rb b/app/models/legislation/draft_version.rb index b36cb688a..a3a7f351a 100644 --- a/app/models/legislation/draft_version.rb +++ b/app/models/legislation/draft_version.rb @@ -12,8 +12,8 @@ class Legislation::DraftVersion < ApplicationRecord belongs_to :process, foreign_key: "legislation_process_id", inverse_of: :draft_versions has_many :annotations, foreign_key: "legislation_draft_version_id", - inverse_of: :draft_version, - dependent: :destroy + inverse_of: :draft_version, + dependent: :destroy validates_translation :title, presence: true validates_translation :body, presence: true diff --git a/app/models/legislation/process.rb b/app/models/legislation/process.rb index bd661338c..4e42b9a5d 100644 --- a/app/models/legislation/process.rb +++ b/app/models/legislation/process.rb @@ -28,20 +28,20 @@ class Legislation::Process < ApplicationRecord has_many :draft_versions, -> { order(:id) }, foreign_key: "legislation_process_id", - inverse_of: :process, - dependent: :destroy + inverse_of: :process, + dependent: :destroy has_one :final_draft_version, -> { where final_version: true, status: "published" }, - class_name: "Legislation::DraftVersion", + class_name: "Legislation::DraftVersion", foreign_key: "legislation_process_id", - inverse_of: :process + inverse_of: :process has_many :questions, -> { order(:id) }, foreign_key: "legislation_process_id", - inverse_of: :process, - dependent: :destroy + inverse_of: :process, + dependent: :destroy has_many :proposals, -> { order(:id) }, foreign_key: "legislation_process_id", - inverse_of: :process, - dependent: :destroy + inverse_of: :process, + dependent: :destroy validates_translation :title, presence: true validates :start_date, presence: true @@ -127,8 +127,8 @@ class Legislation::Process < ApplicationRecord def searchable_translations_definitions { - title => "A", - summary => "C", + title => "A", + summary => "C", description => "D" } end diff --git a/app/models/legislation/proposal.rb b/app/models/legislation/proposal.rb index 464bfd3fb..8a151e56b 100644 --- a/app/models/legislation/proposal.rb +++ b/app/models/legislation/proposal.rb @@ -57,12 +57,12 @@ class Legislation::Proposal < ApplicationRecord end def searchable_values - { title => "A", - author.username => "B", + { title => "A", + author.username => "B", tag_list.join(" ") => "B", - geozone&.name => "B", - summary => "C", - description => "D" } + geozone&.name => "B", + summary => "C", + description => "D" } end def self.search(terms) diff --git a/app/models/officing/residence.rb b/app/models/officing/residence.rb index 8d8f1fd57..711acb018 100644 --- a/app/models/officing/residence.rb +++ b/app/models/officing/residence.rb @@ -32,17 +32,17 @@ class Officing::Residence user.update!(verified_at: Time.current) else user_params = { - document_number: document_number, - document_type: document_type, - geozone: geozone, - date_of_birth: response_date_of_birth.in_time_zone.to_datetime, - gender: gender, + document_number: document_number, + document_type: document_type, + geozone: geozone, + date_of_birth: response_date_of_birth.in_time_zone.to_datetime, + gender: gender, residence_verified_at: Time.current, - verified_at: Time.current, - erased_at: Time.current, - password: random_password, - terms_of_service: "1", - email: nil + verified_at: Time.current, + erased_at: Time.current, + password: random_password, + terms_of_service: "1", + email: nil } self.user = User.create!(user_params) end diff --git a/app/models/poll.rb b/app/models/poll.rb index 18cba6d9b..8317ca3f0 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -205,8 +205,8 @@ class Poll < ApplicationRecord def searchable_translations_definitions { - name => "A", - summary => "C", + name => "A", + summary => "C", description => "D" } end diff --git a/app/models/poll/ballot_sheet.rb b/app/models/poll/ballot_sheet.rb index 62bf05726..1e2b65a39 100644 --- a/app/models/poll/ballot_sheet.rb +++ b/app/models/poll/ballot_sheet.rb @@ -36,8 +36,8 @@ class Poll::BallotSheet < ApplicationRecord def create_ballot(poll_ballot) Budget::Ballot.where(physical: true, - user: nil, - poll_ballot: poll_ballot, - budget: poll.budget).first_or_create! + user: nil, + poll_ballot: poll_ballot, + budget: poll.budget).first_or_create! end end diff --git a/app/models/poll/question.rb b/app/models/poll/question.rb index e513d3298..531972f4d 100644 --- a/app/models/poll/question.rb +++ b/app/models/poll/question.rb @@ -17,7 +17,7 @@ class Poll::Question < ApplicationRecord has_many :question_answers, -> { order "given_order asc" }, class_name: "Poll::Question::Answer", inverse_of: :question, - dependent: :destroy + dependent: :destroy has_many :partial_results belongs_to :proposal @@ -40,9 +40,9 @@ class Poll::Question < ApplicationRecord end def searchable_values - { title => "A", - proposal&.title => "A", - author.username => "C", + { title => "A", + proposal&.title => "A", + author.username => "C", author_visible_name => "C" } end diff --git a/app/models/poll/shift.rb b/app/models/poll/shift.rb index 080e6170c..452eb8b45 100644 --- a/app/models/poll/shift.rb +++ b/app/models/poll/shift.rb @@ -28,10 +28,10 @@ class Poll def create_officer_assignments booth.booth_assignments.order(:id).each do |booth_assignment| attrs = { - officer_id: officer_id, - date: date, + officer_id: officer_id, + date: date, booth_assignment_id: booth_assignment.id, - final: recount_scrutiny? + final: recount_scrutiny? } Poll::OfficerAssignment.create!(attrs) end diff --git a/app/models/progress_bar.rb b/app/models/progress_bar.rb index 700b9dc09..59d051da1 100644 --- a/app/models/progress_bar.rb +++ b/app/models/progress_bar.rb @@ -12,10 +12,10 @@ class ProgressBar < ApplicationRecord validates :progressable, presence: true validates :kind, presence: true, - uniqueness: { - scope: [:progressable_type, :progressable_id], - conditions: -> { primary } - } + uniqueness: { + scope: [:progressable_type, :progressable_id], + conditions: -> { primary } + } validates :percentage, presence: true, inclusion: { in: ->(*) { RANGE }}, numericality: { only_integer: true } validates_translation :title, presence: true, unless: :primary? diff --git a/app/models/proposal.rb b/app/models/proposal.rb index 92bcc2aa1..0382ad5e6 100644 --- a/app/models/proposal.rb +++ b/app/models/proposal.rb @@ -118,16 +118,16 @@ class Proposal < ApplicationRecord end def searchable_translations_definitions - { title => "A", - summary => "C", + { title => "A", + summary => "C", description => "D" } end def searchable_values { - author.username => "B", - tag_list.join(" ") => "B", - geozone&.name => "B" + author.username => "B", + tag_list.join(" ") => "B", + geozone&.name => "B" }.merge!(searchable_globalized_values) end diff --git a/app/models/proposal_notification.rb b/app/models/proposal_notification.rb index 8e24bca40..77ebde6f9 100644 --- a/app/models/proposal_notification.rb +++ b/app/models/proposal_notification.rb @@ -59,7 +59,7 @@ class ProposalNotification < ApplicationRecord def searchable_values { title => "A", - body => "B" + body => "B" } end diff --git a/app/models/sdg/local_target.rb b/app/models/sdg/local_target.rb index 2d593db8f..c5ee24650 100644 --- a/app/models/sdg/local_target.rb +++ b/app/models/sdg/local_target.rb @@ -9,7 +9,7 @@ class SDG::LocalTarget < ApplicationRecord validates_translation :description, presence: true validates :code, presence: true, uniqueness: true, - format: ->(local_target) { /\A#{local_target.target&.code}\.\d+/ } + format: ->(local_target) { /\A#{local_target.target&.code}\.\d+/ } validates :target, presence: true validates :goal, presence: true diff --git a/app/models/setting.rb b/app/models/setting.rb index a37e2a6d3..452daeb23 100644 --- a/app/models/setting.rb +++ b/app/models/setting.rb @@ -61,18 +61,18 @@ class Setting < ApplicationRecord def mime_types { "images" => { - "jpg" => "image/jpeg", - "png" => "image/png", - "gif" => "image/gif" + "jpg" => "image/jpeg", + "png" => "image/png", + "gif" => "image/gif" }, "documents" => { - "pdf" => "application/pdf", - "doc" => "application/msword", + "pdf" => "application/pdf", + "doc" => "application/msword", "docx" => "application/vnd.openxmlformats-officedocument.wordprocessingml.document", - "xls" => "application/x-ole-storage", + "xls" => "application/x-ole-storage", "xlsx" => "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", - "csv" => "text/plain", - "zip" => "application/zip" + "csv" => "text/plain", + "zip" => "application/zip" } } end diff --git a/app/models/user.rb b/app/models/user.rb index 6a400c5bc..2991a7842 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -26,55 +26,55 @@ class User < ApplicationRecord has_many :proposals, -> { with_hidden }, foreign_key: :author_id, inverse_of: :author has_many :activities has_many :budget_investments, -> { with_hidden }, - class_name: "Budget::Investment", + class_name: "Budget::Investment", foreign_key: :author_id, - inverse_of: :author + inverse_of: :author has_many :comments, -> { with_hidden }, inverse_of: :user has_many :failed_census_calls has_many :notifications has_many :direct_messages_sent, - class_name: "DirectMessage", + class_name: "DirectMessage", foreign_key: :sender_id, - inverse_of: :sender + inverse_of: :sender has_many :direct_messages_received, - class_name: "DirectMessage", + class_name: "DirectMessage", foreign_key: :receiver_id, - inverse_of: :receiver + inverse_of: :receiver has_many :legislation_answers, class_name: "Legislation::Answer", dependent: :destroy, inverse_of: :user has_many :follows has_many :legislation_annotations, - class_name: "Legislation::Annotation", + class_name: "Legislation::Annotation", foreign_key: :author_id, - inverse_of: :author + inverse_of: :author has_many :legislation_proposals, - class_name: "Legislation::Proposal", + class_name: "Legislation::Proposal", foreign_key: :author_id, - inverse_of: :author + inverse_of: :author has_many :legislation_questions, - class_name: "Legislation::Question", + class_name: "Legislation::Question", foreign_key: :author_id, - inverse_of: :author + inverse_of: :author has_many :polls, foreign_key: :author_id, inverse_of: :author has_many :poll_answers, - class_name: "Poll::Answer", + class_name: "Poll::Answer", foreign_key: :author_id, - inverse_of: :author + inverse_of: :author has_many :poll_pair_answers, - class_name: "Poll::PairAnswer", + class_name: "Poll::PairAnswer", foreign_key: :author_id, - inverse_of: :author + inverse_of: :author has_many :poll_partial_results, - class_name: "Poll::PartialResult", + class_name: "Poll::PartialResult", foreign_key: :author_id, - inverse_of: :author + inverse_of: :author has_many :poll_questions, - class_name: "Poll::Question", + class_name: "Poll::Question", foreign_key: :author_id, - inverse_of: :author + inverse_of: :author has_many :poll_recounts, - class_name: "Poll::Recount", + class_name: "Poll::Recount", foreign_key: :author_id, - inverse_of: :author + inverse_of: :author has_many :related_contents, foreign_key: :author_id, inverse_of: :author, dependent: nil has_many :topics, foreign_key: :author_id, inverse_of: :author belongs_to :geozone @@ -136,7 +136,7 @@ class User < ApplicationRecord oauth_user = User.find_by(email: oauth_email) if oauth_email_confirmed oauth_user || User.new( - username: auth.info.name || auth.uid, + username: auth.info.name || auth.uid, email: oauth_email, oauth_email: oauth_email, password: Devise.friendly_token[0, 20], diff --git a/app/models/verification/management/managed_user.rb b/app/models/verification/management/managed_user.rb index cbf5d29e3..e4a44e63d 100644 --- a/app/models/verification/management/managed_user.rb +++ b/app/models/verification/management/managed_user.rb @@ -3,7 +3,7 @@ class Verification::Management::ManagedUser def self.find(document_type, document_number) User.where.not(document_number: nil) - .find_or_initialize_by(document_type: document_type, - document_number: document_number) + .find_or_initialize_by(document_type: document_type, + document_number: document_number) end end diff --git a/app/models/verification/residence.rb b/app/models/verification/residence.rb index 539c3ef12..f266ed0db 100644 --- a/app/models/verification/residence.rb +++ b/app/models/verification/residence.rb @@ -29,11 +29,11 @@ class Verification::Residence user.take_votes_if_erased_document(document_number, document_type) - user.update(document_number: document_number, - document_type: document_type, - geozone: geozone, - date_of_birth: date_of_birth.in_time_zone.to_datetime, - gender: gender, + user.update(document_number: document_number, + document_type: document_type, + geozone: geozone, + date_of_birth: date_of_birth.in_time_zone.to_datetime, + gender: gender, residence_verified_at: Time.current) end diff --git a/app/views/admin/dashboard/actions/_form.html.erb b/app/views/admin/dashboard/actions/_form.html.erb index 178fe0596..151af1c54 100644 --- a/app/views/admin/dashboard/actions/_form.html.erb +++ b/app/views/admin/dashboard/actions/_form.html.erb @@ -44,18 +44,21 @@
    - <%= f.number_field :day_offset, step: 1, min: 0, - hint: t("admin.dashboard.actions.form.help_text") %> + <%= f.number_field :day_offset, step: 1, + min: 0, + hint: t("admin.dashboard.actions.form.help_text") %>
    - <%= f.number_field :required_supports, step: 1, min: 0, - hint: t("admin.dashboard.actions.form.help_text") %> + <%= f.number_field :required_supports, step: 1, + min: 0, + hint: t("admin.dashboard.actions.form.help_text") %>
    - <%= f.number_field :order, step: 1, min: 0, - hint: t("admin.dashboard.actions.form.help_text") %> + <%= f.number_field :order, step: 1, + min: 0, + hint: t("admin.dashboard.actions.form.help_text") %>
    diff --git a/app/views/admin/legislation/draft_versions/_form.html.erb b/app/views/admin/legislation/draft_versions/_form.html.erb index dd462837d..cb56e5ea2 100644 --- a/app/views/admin/legislation/draft_versions/_form.html.erb +++ b/app/views/admin/legislation/draft_versions/_form.html.erb @@ -1,8 +1,11 @@ <%= render "shared/globalize_locales", resource: @draft_version %> <%= translatable_form_for [:admin, @process, @draft_version], url: url, - html: { data: { markdown_changes_message: I18n.t("admin.legislation.draft_versions.edit.markdown_changes_message") }} do |f| %> - + html: { + data: { + markdown_changes_message: I18n.t("admin.legislation.draft_versions.edit.markdown_changes_message") + } + } do |f| %> <%= render "shared/errors", resource: @draft_version %>
    @@ -50,8 +53,9 @@
    - <%= translations_form.text_area :body, label: false, rows: 10, - class: "legislation-draft-version-body" %> + <%= translations_form.text_area :body, label: false, + rows: 10, + class: "legislation-draft-version-body" %>
    diff --git a/app/views/admin/legislation/proposals/_form.html.erb b/app/views/admin/legislation/proposals/_form.html.erb index 494d3fe14..fac27f829 100644 --- a/app/views/admin/legislation/proposals/_form.html.erb +++ b/app/views/admin/legislation/proposals/_form.html.erb @@ -4,11 +4,11 @@
    <%= f.text_field :custom_list, value: @process.tag_list_on(:customs).sort.join(", "), - label: t("admin.legislation.proposals.form.custom_categories"), - hint: t("admin.legislation.proposals.form.custom_categories_description"), - placeholder: t("admin.legislation.proposals.form.custom_categories_placeholder"), - class: "js-tag-list", - aria: { describedby: "tag-list-help-text" } %> + label: t("admin.legislation.proposals.form.custom_categories"), + hint: t("admin.legislation.proposals.form.custom_categories_description"), + placeholder: t("admin.legislation.proposals.form.custom_categories_placeholder"), + class: "js-tag-list", + aria: { describedby: "tag-list-help-text" } %>
    diff --git a/app/views/admin/poll/active_polls/_form.html.erb b/app/views/admin/poll/active_polls/_form.html.erb index 5794b641f..7e0af3329 100644 --- a/app/views/admin/poll/active_polls/_form.html.erb +++ b/app/views/admin/poll/active_polls/_form.html.erb @@ -9,7 +9,7 @@
    <%= t("admin.active_polls.form.description.help_text") %> <%= translations_form.text_area :description, class: "html-area", - maxlength: ActivePoll.description_max_length %> + maxlength: ActivePoll.description_max_length %>
    <% end %>
    diff --git a/app/views/admin/signature_sheets/new.html.erb b/app/views/admin/signature_sheets/new.html.erb index aa81aa5fd..5dd736d17 100644 --- a/app/views/admin/signature_sheets/new.html.erb +++ b/app/views/admin/signature_sheets/new.html.erb @@ -19,7 +19,7 @@
    <%= f.text_area :required_fields_to_verify, rows: "6", - hint: sanitize("#{required_fields_to_verify_text_help}
    #{example_text_help}") %> + hint: sanitize("#{required_fields_to_verify_text_help}
    #{example_text_help}") %> <%= f.submit(class: "button", value: t("admin.signature_sheets.new.submit")) %> <% end %> diff --git a/app/views/admin/site_customization/pages/_form.html.erb b/app/views/admin/site_customization/pages/_form.html.erb index a30395fc6..36e65c54e 100644 --- a/app/views/admin/site_customization/pages/_form.html.erb +++ b/app/views/admin/site_customization/pages/_form.html.erb @@ -21,8 +21,9 @@
    - <%= f.text_field :slug, size: 80, maxlength: 80, - hint: sanitize(t("admin.site_customization.pages.new.slug_help")) %> + <%= f.text_field :slug, size: 80, + maxlength: 80, + hint: sanitize(t("admin.site_customization.pages.new.slug_help")) %>
    diff --git a/app/views/admin/system_emails/preview_pending/_proposal_notification_digest.html.erb b/app/views/admin/system_emails/preview_pending/_proposal_notification_digest.html.erb index c0a80780f..2d86e0812 100644 --- a/app/views/admin/system_emails/preview_pending/_proposal_notification_digest.html.erb +++ b/app/views/admin/system_emails/preview_pending/_proposal_notification_digest.html.erb @@ -32,7 +32,7 @@ <%= link_to t("admin.system_emails.preview_pending.moderate_pending"), admin_system_email_moderate_pending_path(system_email_id: "proposal_notification_digest", - id: preview.id), + id: preview.id), method: :put, class: "button hollow float-right" %> diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb index 0ea042746..75d3887ca 100644 --- a/app/views/comments/_comment.html.erb +++ b/app/views/comments/_comment.html.erb @@ -100,8 +100,8 @@ <% if !valuation || can?(:comment_valuation, comment.commentable) %> <%= render "comments/form", { commentable: comment.commentable, - parent_id: comment.id, - valuation: valuation } %> + parent_id: comment.id, + valuation: valuation } %> <% end %> <% end %> diff --git a/app/views/dashboard/mailer/forward.html.erb b/app/views/dashboard/mailer/forward.html.erb index 95cea001c..d8ff79bc0 100644 --- a/app/views/dashboard/mailer/forward.html.erb +++ b/app/views/dashboard/mailer/forward.html.erb @@ -55,7 +55,7 @@ <%= link_to proposal_url(@proposal, anchor: "social-share") do %> <%= image_tag("social_buttons_mailer.png", alt: t("dashboard.mailer.forward.share_in"), - style: "max-width: 100%;") %> + style: "max-width: 100%;") %> <% end %> diff --git a/app/views/dashboard/mailer/new_actions_notification_on_published.html.erb b/app/views/dashboard/mailer/new_actions_notification_on_published.html.erb index e566ebd03..46d39c5ba 100644 --- a/app/views/dashboard/mailer/new_actions_notification_on_published.html.erb +++ b/app/views/dashboard/mailer/new_actions_notification_on_published.html.erb @@ -53,7 +53,7 @@ border-radius: 6px; color: #fff !important; font-weight: bold; padding: 17px 20px; text-align: center; text-decoration: none; font-size: 20px; min-width: 200px; display: inline-block;", - target: "_blank" do %> + target: "_blank" do %> <%= t("mailers.new_actions_notification_on_published.dashboard_button") %> <% end %> diff --git a/app/views/dashboard/polls/_poll.html.erb b/app/views/dashboard/polls/_poll.html.erb index bba6e946d..d858b1914 100644 --- a/app/views/dashboard/polls/_poll.html.erb +++ b/app/views/dashboard/polls/_poll.html.erb @@ -24,8 +24,9 @@ <% end %> - <%= form_for poll, remote: true, data: { type: :json }, - url: proposal_dashboard_poll_path(proposal, poll) do |f| %> + <%= form_for poll, remote: true, + data: { type: :json }, + url: proposal_dashboard_poll_path(proposal, poll) do |f| %> <%= f.check_box :results_enabled, class: "js-submit-on-change" %> <% end %>

    <%= t("dashboard.polls.poll.show_results_help") %>

    diff --git a/app/views/devise/passwords/edit.html.erb b/app/views/devise/passwords/edit.html.erb index 1466ea9a9..ba7dda780 100644 --- a/app/views/devise/passwords/edit.html.erb +++ b/app/views/devise/passwords/edit.html.erb @@ -6,13 +6,14 @@ <%= f.hidden_field :reset_password_token %>
    - <%= f.password_field :password, autofocus: true, autocomplete: "off", - label: t("devise_views.passwords.edit.password_label") %> + <%= f.password_field :password, autofocus: true, + autocomplete: "off", + label: t("devise_views.passwords.edit.password_label") %>
    <%= f.password_field :password_confirmation, autocomplete: "off", - label: t("devise_views.passwords.edit.password_confirmation_label") %> + label: t("devise_views.passwords.edit.password_confirmation_label") %>
    diff --git a/app/views/devise/unlocks/new.html.erb b/app/views/devise/unlocks/new.html.erb index ee0651187..ed250c31f 100644 --- a/app/views/devise/unlocks/new.html.erb +++ b/app/views/devise/unlocks/new.html.erb @@ -5,7 +5,7 @@
    <%= f.email_field :email, autofocus: true, - label: t("devise_views.unlocks.new.email_label") %> + label: t("devise_views.unlocks.new.email_label") %>
    diff --git a/app/views/documents/_document.html.erb b/app/views/documents/_document.html.erb index 977e3acc4..5f6b52378 100644 --- a/app/views/documents/_document.html.erb +++ b/app/views/documents/_document.html.erb @@ -1,7 +1,9 @@
  • <%= link_to t("documents.buttons.download_document"), - document.attachment, target: "_blank", - rel: "nofollow", class: "button hollow medium float-right" %> + document.attachment, + target: "_blank", + rel: "nofollow", + class: "button hollow medium float-right" %> <%= document.title %>
    diff --git a/app/views/legislation/processes/_process.html.erb b/app/views/legislation/processes/_process.html.erb index 8919ee848..42e333b40 100644 --- a/app/views/legislation/processes/_process.html.erb +++ b/app/views/legislation/processes/_process.html.erb @@ -6,7 +6,7 @@
    <%= link_to process, class: "button hollow big expanded", - title: t("legislation.processes.process.see_latest_comments_title") do %> + title: t("legislation.processes.process.see_latest_comments_title") do %>   <%= t("legislation.processes.process.see_latest_comments") %> <% end %> diff --git a/app/views/legislation/proposals/_form.html.erb b/app/views/legislation/proposals/_form.html.erb index 23e645d3b..83b6b9dd2 100644 --- a/app/views/legislation/proposals/_form.html.erb +++ b/app/views/legislation/proposals/_form.html.erb @@ -12,7 +12,7 @@
    <%= f.text_area :summary, rows: 4, maxlength: 200, - hint: t("proposals.form.proposal_summary_note") %> + hint: t("proposals.form.proposal_summary_note") %>
    @@ -54,10 +54,10 @@
    <%= f.text_field :tag_list, value: @proposal.tag_list.to_s, - label: false, - placeholder: t("proposals.form.tags_placeholder"), - class: "js-tag-list", - aria: { describedby: "tag-list-help-text" } %> + label: false, + placeholder: t("proposals.form.tags_placeholder"), + class: "js-tag-list", + aria: { describedby: "tag-list-help-text" } %>
    diff --git a/app/views/management/email_verifications/new.html.erb b/app/views/management/email_verifications/new.html.erb index 5245528e1..756ede6de 100644 --- a/app/views/management/email_verifications/new.html.erb +++ b/app/views/management/email_verifications/new.html.erb @@ -23,8 +23,9 @@

    <%= link_to t("management.users.create_user"), new_management_user_path(user: { - document_number: @email_verification.document_number, - document_type: @email_verification.document_type }), + document_number: @email_verification.document_number, + document_type: @email_verification.document_type + }), class: "button success" %>

  • diff --git a/app/views/management/user_invites/new.html.erb b/app/views/management/user_invites/new.html.erb index 59256c130..826e6115d 100644 --- a/app/views/management/user_invites/new.html.erb +++ b/app/views/management/user_invites/new.html.erb @@ -4,7 +4,7 @@

    <%= t("management.user_invites.new.info") %>

    <%= text_area_tag "emails", nil, rows: 5, - aria: { describedby: "emails-help-text" } %> + aria: { describedby: "emails-help-text" } %>
    " class="button expanded">
    diff --git a/app/views/notifications/index.html.erb b/app/views/notifications/index.html.erb index b4eef105b..e232b8fed 100644 --- a/app/views/notifications/index.html.erb +++ b/app/views/notifications/index.html.erb @@ -6,7 +6,8 @@ <%= link_to t("notifications.index.mark_all_as_read"), - mark_all_as_read_notifications_path, method: :put, + mark_all_as_read_notifications_path, + method: :put, class: "button hollow float-right-medium" %>