diff --git a/.rubocop.yml b/.rubocop.yml index 8bd439eae..1652ce3e3 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -18,9 +18,41 @@ Bundler/OrderedGems: Enabled: true ConsiderPunctuation: true +Layout/ArgumentAlignment: + Enabled: true + +Layout/ArrayAlignment: + Enabled: true + Layout/AssignmentIndentation: Enabled: true +Layout/BeginEndAlignment: + Enabled: true + EnforcedStyleAlignWith: begin + +Layout/BlockAlignment: + Enabled: true + +Layout/BlockEndNewline: + Enabled: true + +Layout/ClosingHeredocIndentation: + Enabled: true + +Layout/ClosingParenthesisIndentation: + Enabled: true + +Layout/DefEndAlignment: + Enabled: true + EnforcedStyleAlignWith: def + +Layout/DotPosition: + Enabled: true + +Layout/ElseAlignment: + Enabled: true + Layout/EmptyLineAfterGuardClause: Enabled: true @@ -45,12 +77,26 @@ Layout/EmptyLinesAroundMethodBody: Layout/EmptyLinesAroundModuleBody: Enabled: true +Layout/EndAlignment: + Enabled: true + Layout/EndOfLine: EnforcedStyle: lf Layout/ExtraSpacing: Enabled: true +Layout/FirstArrayElementIndentation: + Enabled: true + EnforcedStyle: consistent + +Layout/FirstHashElementIndentation: + Enabled: true + EnforcedStyle: consistent + +Layout/HashAlignment: + Enabled: true + Layout/HeredocIndentation: Enabled: true @@ -66,6 +112,9 @@ Layout/IndentationWidth: Layout/LeadingEmptyLines: Enabled: true +Layout/LineContinuationSpacing: + Enabled: true + Layout/LineEndStringConcatenationIndentation: Enabled: true @@ -73,9 +122,33 @@ Layout/LineLength: Max: 110 Severity: refactor +Layout/MultilineArrayBraceLayout: + Enabled: true + Layout/MultilineBlockLayout: Enabled: true +Layout/MultilineHashBraceLayout: + Enabled: true + +Layout/MultilineHashKeyLineBreaks: + Enabled: true + +Layout/MultilineMethodCallBraceLayout: + Enabled: true + +Layout/MultilineMethodCallIndentation: + Enabled: true + +Layout/MultilineOperationIndentation: + Enabled: true + +Layout/ParameterAlignment: + Enabled: true + +Layout/RescueEnsureAlignment: + Enabled: true + Layout/SpaceAfterColon: Enabled: true @@ -523,6 +596,9 @@ Style/IdenticalConditionalBranches: Style/IfWithBooleanLiteralBranches: Enabled: true +Style/LineEndConcatenation: + Enabled: true + Style/MapToHash: Enabled: true diff --git a/app/components/admin/budget_headings/form_component.html.erb b/app/components/admin/budget_headings/form_component.html.erb index af488f177..f41f0d14b 100644 --- a/app/components/admin/budget_headings/form_component.html.erb +++ b/app/components/admin/budget_headings/form_component.html.erb @@ -20,20 +20,20 @@ <% if feature?(:map) %> <%= f.select :geozone_id, - geozone_options, - include_blank: t("geozones.none"), - hint: t("admin.budget_headings.form.geozone_info") %> + geozone_options, + include_blank: t("geozones.none"), + hint: t("admin.budget_headings.form.geozone_info") %> <% end %> <% if heading.budget.approval_voting? %> <%= f.number_field :max_ballot_lines, - hint: t("admin.budget_headings.form.max_ballot_lines_info") %> + hint: t("admin.budget_headings.form.max_ballot_lines_info") %> <% end %> <%= f.text_field :population, - maxlength: 8, - data: { toggle_focus: "population-info" }, - hint: t("admin.budget_headings.form.population_info") %> + maxlength: 8, + data: { toggle_focus: "population-info" }, + hint: t("admin.budget_headings.form.population_info") %> <%= f.text_field :latitude, maxlength: 22 %> <%= f.text_field :longitude, maxlength: 22 %> diff --git a/app/components/admin/budget_phases/form_component.html.erb b/app/components/admin/budget_phases/form_component.html.erb index dc0ed15ea..369373454 100644 --- a/app/components/admin/budget_phases/form_component.html.erb +++ b/app/components/admin/budget_phases/form_component.html.erb @@ -39,9 +39,9 @@
<%= translations_form.text_area :description, - maxlength: Budget::Phase::DESCRIPTION_MAX_LENGTH, - class: "html-area", - hint: t("admin.budget_phases.edit.description_help_text") %> + maxlength: Budget::Phase::DESCRIPTION_MAX_LENGTH, + class: "html-area", + hint: t("admin.budget_phases.edit.description_help_text") %>
diff --git a/app/components/admin/budget_phases/phases_component.html.erb b/app/components/admin/budget_phases/phases_component.html.erb index 3d68ac7e4..6205390a4 100644 --- a/app/components/admin/budget_phases/phases_component.html.erb +++ b/app/components/admin/budget_phases/phases_component.html.erb @@ -29,7 +29,8 @@ <%= enabled_cell(phase) %> - <%= render Admin::TableActionsComponent.new(phase, + <%= render Admin::TableActionsComponent.new( + phase, actions: [:edit], edit_path: edit_path(phase) ) %> 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/budgets/form_component.html.erb b/app/components/admin/budgets/form_component.html.erb index dd9bbddc9..38cc4e6f6 100644 --- a/app/components/admin/budgets/form_component.html.erb +++ b/app/components/admin/budgets/form_component.html.erb @@ -10,8 +10,8 @@
<%= translations_form.text_field :name, - maxlength: Budget.title_max_length, - hint: t("admin.budgets.edit.name_description") %> + maxlength: Budget.title_max_length, + hint: t("admin.budgets.edit.name_description") %>
@@ -67,9 +67,9 @@ <% %w[administrators valuators].each do |staff| %>
<%= link_to t("admin.budgets.edit.#{staff}", count: budget.send(staff).count), - "#", - class: "button expanded hollow js-budget-show-#{staff}-list js-budget-show-users-list", - data: { toggle: "#{staff}_list", texts: t("admin.budgets.edit.#{staff}") } %> + "#", + class: "button expanded hollow js-budget-show-#{staff}-list js-budget-show-users-list", + data: { toggle: "#{staff}_list", texts: t("admin.budgets.edit.#{staff}") } %>
<% 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/machine_learning/show_component.html.erb b/app/components/admin/machine_learning/show_component.html.erb index 79dc8760c..48482bd3d 100644 --- a/app/components/admin/machine_learning/show_component.html.erb +++ b/app/components/admin/machine_learning/show_component.html.erb @@ -32,8 +32,8 @@

<%= sanitize(t("admin.machine_learning.feature_disabled", - link: link_to(t("admin.machine_learning.feature_disabled_link"), - admin_settings_path(anchor: "tab-feature-flags")))) %> + link: link_to(t("admin.machine_learning.feature_disabled_link"), + admin_settings_path(anchor: "tab-feature-flags")))) %>

<% end %> diff --git a/app/components/admin/menu_component.rb b/app/components/admin/menu_component.rb index 1b616c5fb..21ffbc74d 100644 --- a/app/components/admin/menu_component.rb +++ b/app/components/admin/menu_component.rb @@ -41,7 +41,7 @@ class Admin::MenuComponent < ApplicationComponent def polls? controller.class.module_parent == Admin::Poll::Questions::Answers || %w[polls active_polls recounts results questions answers].include?(controller_name) && - action_name != "booth_assignments" + action_name != "booth_assignments" end def booths? diff --git a/app/components/admin/poll/officers/officers_component.html.erb b/app/components/admin/poll/officers/officers_component.html.erb index 54784ebaf..d31d85f9a 100644 --- a/app/components/admin/poll/officers/officers_component.html.erb +++ b/app/components/admin/poll/officers/officers_component.html.erb @@ -17,7 +17,8 @@ <% if officer.persisted? %> - <%= render Admin::TableActionsComponent.new(officer, + <%= render Admin::TableActionsComponent.new( + officer, actions: [:destroy], destroy_text: t("admin.poll_officers.officer.delete"), destroy_options: { class: "destroy-officer-link" } diff --git a/app/components/admin/poll/questions/form_component.html.erb b/app/components/admin/poll/questions/form_component.html.erb index bd72edd40..e8dd29a77 100644 --- a/app/components/admin/poll/questions/form_component.html.erb +++ b/app/components/admin/poll/questions/form_component.html.erb @@ -13,9 +13,9 @@ <% else %>
<%= f.select :poll_id, - options_for_select(select_options), - prompt: t("admin.questions.index.select_poll"), - hint: t("admin.questions.form.poll_help") %> + options_for_select(select_options), + prompt: t("admin.questions.index.select_poll"), + hint: t("admin.questions.form.poll_help") %>
<% end %>
diff --git a/app/components/admin/roles/table_actions_component.html.erb b/app/components/admin/roles/table_actions_component.html.erb index 305c18ed4..d5d2deada 100644 --- a/app/components/admin/roles/table_actions_component.html.erb +++ b/app/components/admin/roles/table_actions_component.html.erb @@ -1,5 +1,6 @@ <% if already_has_role? %> - <%= render Admin::TableActionsComponent.new(record, + <%= render Admin::TableActionsComponent.new( + record, actions: actions, destroy_options: { class: "destroy-role-link" } ) %> 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/attachable/fields_component.rb b/app/components/attachable/fields_component.rb index ae217456a..d26340d70 100644 --- a/app/components/attachable/fields_component.rb +++ b/app/components/attachable/fields_component.rb @@ -46,10 +46,10 @@ class Attachable::FieldsComponent < ApplicationComponent def file_field klass = attachable.persisted? || attachable.cached_attachment.present? ? " hide" : "" f.file_field :attachment, - label_options: { class: "button hollow #{klass}" }, - accept: accepted_content_types_extensions, - class: "js-#{singular_name}-attachment", - data: { url: direct_upload_path } + label_options: { class: "button hollow #{klass}" }, + accept: accepted_content_types_extensions, + class: "js-#{singular_name}-attachment", + data: { url: direct_upload_path } end def direct_upload_path diff --git a/app/components/budgets/executions/filters_component.html.erb b/app/components/budgets/executions/filters_component.html.erb index eed52e564..83d4c13cc 100644 --- a/app/components/budgets/executions/filters_component.html.erb +++ b/app/components/budgets/executions/filters_component.html.erb @@ -2,21 +2,22 @@
<%= label_tag :milestone_tag, t("budgets.executions.filters.milestone_tag.label") %> <%= select_tag :milestone_tag, - options_for_select( - options_for_milestone_tags, - params[:milestone_tag] - ), - prompt: t("budgets.executions.filters.milestone_tag.all", - count: budget.investments.winners.with_milestones.count) %> + options_for_select( + options_for_milestone_tags, + params[:milestone_tag] + ), + prompt: t("budgets.executions.filters.milestone_tag.all", + count: budget.investments.winners.with_milestones.count) %>
<%= label_tag :status, t("budgets.executions.filters.status.label") %> <%= select_tag :status, - options_from_collection_for_select(statuses, - :id, lambda { |s| "#{s.name} (#{filters_select_counts(s.id)})" }, - params[:status]), - prompt: t("budgets.executions.filters.status.all", - count: budget.investments.winners.with_milestones.count) %> + options_from_collection_for_select(statuses, + :id, + lambda { |s| "#{s.name} (#{filters_select_counts(s.id)})" }, + params[:status]), + prompt: t("budgets.executions.filters.status.all", + count: budget.investments.winners.with_milestones.count) %>
<%= submit_tag t("shared.filter") %> diff --git a/app/components/budgets/executions/image_component.rb b/app/components/budgets/executions/image_component.rb index 3058ee46d..d81e225e5 100644 --- a/app/components/budgets/executions/image_component.rb +++ b/app/components/budgets/executions/image_component.rb @@ -9,7 +9,9 @@ class Budgets::Executions::ImageComponent < ApplicationComponent private def milestone - investment.milestones.order_by_publication_date - .select { |milestone| milestone.image.present? }.last + investment.milestones + .order_by_publication_date + .select { |milestone| milestone.image.present? } + .last end end diff --git a/app/components/budgets/investments/form_component.html.erb b/app/components/budgets/investments/form_component.html.erb index 20b15c201..daa0aec4a 100644 --- a/app/components/budgets/investments/form_component.html.erb +++ b/app/components/budgets/investments/form_component.html.erb @@ -18,15 +18,15 @@ <%= f.translatable_fields do |translations_form| %>
<%= translations_form.text_field :title, - maxlength: Budget::Investment.title_max_length, - data: suggest_data(investment) %> + maxlength: Budget::Investment.title_max_length, + data: suggest_data(investment) %>
<%= translations_form.text_area :description, - maxlength: Budget::Investment.description_max_length, - class: "html-area" %> + maxlength: Budget::Investment.description_max_length, + class: "html-area" %>
<% end %> @@ -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) %> @@ -94,11 +94,10 @@ <% unless current_user.manager? || investment.persisted? %>
<%= f.check_box :terms_of_service, - title: t("form.accept_terms_title"), - label: t("form.accept_terms", - policy: link_to(t("form.policy"), "/privacy", target: "blank"), - conditions: link_to(t("form.conditions"), "/conditions", target: "blank") - ) %> + title: t("form.accept_terms_title"), + label: t("form.accept_terms", + policy: link_to(t("form.policy"), "/privacy", target: "blank"), + conditions: link_to(t("form.conditions"), "/conditions", target: "blank")) %>
<% end %> diff --git a/app/components/budgets/investments/my_ballot_component.html.erb b/app/components/budgets/investments/my_ballot_component.html.erb index e44105a26..307be97cc 100644 --- a/app/components/budgets/investments/my_ballot_component.html.erb +++ b/app/components/budgets/investments/my_ballot_component.html.erb @@ -10,13 +10,12 @@ <% elsif assigned_heading.present? %>

<%= sanitize(t("budgets.investments.index.sidebar.different_heading_assigned", - heading_link: heading_link(assigned_heading, budget) - )) %> + heading_link: heading_link(assigned_heading, budget))) %>
<%= sanitize(t("budgets.investments.index.sidebar.change_ballot", - check_ballot: link_to(t("budgets.investments.index.sidebar.check_ballot_link"), - budget_ballot_path(budget)))) %> + check_ballot: link_to(t("budgets.investments.index.sidebar.check_ballot_link"), + budget_ballot_path(budget)))) %>

<% else %> @@ -26,7 +25,8 @@

<%= sanitize(ballot.change_vote_info( link: link_to(t("budgets.investments.index.sidebar.change_vote_link"), - budget_ballot_path(budget)))) %> + budget_ballot_path(budget)) + )) %>

<%= link_to t("budgets.investments.header.check_ballot"), - budget_ballot_path(budget), - class: "button hollow expanded" %> + budget_ballot_path(budget), + class: "button hollow expanded" %>
diff --git a/app/components/budgets/investments/votes_component.html.erb b/app/components/budgets/investments/votes_component.html.erb index 0ce045d3d..015e520c9 100644 --- a/app/components/budgets/investments/votes_component.html.erb +++ b/app/components/budgets/investments/votes_component.html.erb @@ -13,22 +13,22 @@ <% if feature?(:remove_investments_supports) %> <%= button_to remove_support_path, - class: "button button-remove-support expanded", - method: "delete", - remote: true, - "aria-label": remove_support_aria_label do %> + class: "button button-remove-support expanded", + method: "delete", + remote: true, + "aria-label": remove_support_aria_label do %> <%= t("budgets.investments.votes.remove_support") %> <% end %> <% end %> <% else %> <%= button_to t("budgets.investments.votes.support"), support_path, - class: "button button-support expanded", - title: t("budgets.investments.investment.support_title"), - method: "post", - remote: !display_support_alert?, - data: ({ confirm: confirm_vote_message } if display_support_alert?), - "aria-label": support_aria_label %> + class: "button button-support expanded", + title: t("budgets.investments.investment.support_title"), + method: "post", + remote: !display_support_alert?, + data: ({ confirm: confirm_vote_message } if display_support_alert?), + "aria-label": support_aria_label %> <% end %> <% end %> @@ -38,11 +38,11 @@ <% if user_voted_for? && setting["twitter_handle"] %>
<%= render "shared/social_share", - title: investment.title, - image_url: image_absolute_url(investment.image, :thumb), - url: budget_investment_url(investment.budget, investment), - description: investment.title, - mobile: investment.title %> + title: investment.title, + image_url: image_absolute_url(investment.image, :thumb), + url: budget_investment_url(investment.budget, investment), + description: investment.title, + mobile: investment.title %>
<% end %> diff --git a/app/components/budgets/subheader_component.html.erb b/app/components/budgets/subheader_component.html.erb index 6e97da27a..82d85686f 100644 --- a/app/components/budgets/subheader_component.html.erb +++ b/app/components/budgets/subheader_component.html.erb @@ -16,13 +16,13 @@ <% else %>
<%= sanitize(t("budgets.investments.index.sidebar.verified_only", - verify: link_to_verify_account)) %> + verify: link_to_verify_account)) %>
<% end %> <% else %>
<%= sanitize(t("budgets.investments.index.sidebar.not_logged_in", - sign_in: link_to_signin, sign_up: link_to_signup)) %> + sign_in: link_to_signin, sign_up: link_to_signup)) %>
<% end %> <% end %> diff --git a/app/components/budgets/supports_info_component.html.erb b/app/components/budgets/supports_info_component.html.erb index 7980b7eb9..2516b1e89 100644 --- a/app/components/budgets/supports_info_component.html.erb +++ b/app/components/budgets/supports_info_component.html.erb @@ -14,7 +14,7 @@

<%= t("budgets.supports_info.time", - phase_end_date: l(budget.current_phase.ends_at.to_date, format: :long)) %>

+ phase_end_date: l(budget.current_phase.ends_at.to_date, format: :long)) %>

<%= t("budgets.supports_info.share") %>

diff --git a/app/components/comments/votes_component.html.erb b/app/components/comments/votes_component.html.erb index b765af80f..9e3deae86 100644 --- a/app/components/comments/votes_component.html.erb +++ b/app/components/comments/votes_component.html.erb @@ -4,9 +4,9 @@ <%= button_to vote_comment_path(comment, value: "yes"), - method: "post", - remote: can?(:vote, comment), - title: t("votes.agree") do %> + method: "post", + remote: can?(:vote, comment), + title: t("votes.agree") do %> <%= t("votes.agree") %> <% end %> <%= comment.total_likes %> @@ -14,9 +14,9 @@ <%= button_to vote_comment_path(comment, value: "no"), - method: "post", - remote: can?(:vote, comment), - title: t("votes.disagree") do %> + method: "post", + remote: can?(:vote, comment), + title: t("votes.disagree") do %> <%= t("votes.disagree") %> <% end %> <%= comment.total_dislikes %> diff --git a/app/components/debates/form_component.html.erb b/app/components/debates/form_component.html.erb index f7d1b2098..851269d1b 100644 --- a/app/components/debates/form_component.html.erb +++ b/app/components/debates/form_component.html.erb @@ -9,15 +9,15 @@ <%= f.translatable_fields do |translations_form| %>
<%= translations_form.text_field :title, - maxlength: Debate.title_max_length, - data: suggest_data(debate) %> + maxlength: Debate.title_max_length, + data: suggest_data(debate) %>
<%= translations_form.text_area :description, - maxlength: Debate.description_max_length, - class: "html-area" %> + maxlength: Debate.description_max_length, + class: "html-area" %>
<% end %> @@ -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) %> @@ -42,11 +42,10 @@ <% if debate.new_record? %>
<%= f.check_box :terms_of_service, - title: t("form.accept_terms_title"), - label: t("form.accept_terms", - policy: link_to(t("form.policy"), "/privacy", target: "blank"), - conditions: link_to(t("form.conditions"), "/conditions", target: "blank") - ) %> + title: t("form.accept_terms_title"), + label: t("form.accept_terms", + policy: link_to(t("form.policy"), "/privacy", target: "blank"), + conditions: link_to(t("form.conditions"), "/conditions", target: "blank")) %>
<% end %> 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..979ecc556 100644 --- a/app/components/layout/footer_component.html.erb +++ b/app/components/layout/footer_component.html.erb @@ -7,8 +7,8 @@

<%= 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"))) %> + 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"))) %>

diff --git a/app/components/layout/login_items_component.html.erb b/app/components/layout/login_items_component.html.erb index b2acca46e..048ef300d 100644 --- a/app/components/layout/login_items_component.html.erb +++ b/app/components/layout/login_items_component.html.erb @@ -1,19 +1,19 @@ <% if user %>
  • <%= layout_menu_link_to t("layouts.header.my_activity_link"), - user_path(user), - controller_name == "users", - rel: "nofollow", - title: t("shared.go_to_page") + - t("layouts.header.my_activity_link") %> + user_path(user), + controller_name == "users", + rel: "nofollow", + title: t("shared.go_to_page") + + t("layouts.header.my_activity_link") %>
  • <%= layout_menu_link_to t("layouts.header.my_account_link"), - account_path, - controller_name == "account", - rel: "nofollow", - title: t("shared.go_to_page") + - t("layouts.header.my_account_link") %> + account_path, + controller_name == "account", + rel: "nofollow", + title: t("shared.go_to_page") + + t("layouts.header.my_account_link") %>
  • <%= link_to t("devise_views.menu.login_items.logout"), 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/layout/subnavigation_component.html.erb b/app/components/layout/subnavigation_component.html.erb index 4df7ff1d8..d21b926e5 100644 --- a/app/components/layout/subnavigation_component.html.erb +++ b/app/components/layout/subnavigation_component.html.erb @@ -21,9 +21,9 @@ <% if feature?(:polls) %>
  • <%= layout_menu_link_to t("layouts.header.poll_questions"), - polls_path, - controller_name == "polls" || (controller_name == "questions" && controller.class.module_parent == Polls), - accesskey: "3" %> + polls_path, + controller_name == "polls" || (controller_name == "questions" && controller.class.module_parent == Polls), + accesskey: "3" %>
  • <% end %> <% if feature?(:legislation) %> @@ -37,9 +37,9 @@ <% if feature?(:budgets) %>
  • <%= layout_menu_link_to t("layouts.header.budgets"), - budgets_path, - controller_name == "budgets" || controller_name == "investments", - accesskey: "5" %> + budgets_path, + controller_name == "budgets" || controller_name == "investments", + accesskey: "5" %>
  • <% end %> <% if feature?(:sdg) %> diff --git a/app/components/legislation/proposals/votes_component.html.erb b/app/components/legislation/proposals/votes_component.html.erb index 84e1bd29e..630163492 100644 --- a/app/components/legislation/proposals/votes_component.html.erb +++ b/app/components/legislation/proposals/votes_component.html.erb @@ -12,10 +12,10 @@ <% if current_user&.voted_as_when_voted_for(proposal) && setting["twitter_handle"] %> <% end %> diff --git a/app/components/management/budgets/print_investments/table_component.html.erb b/app/components/management/budgets/print_investments/table_component.html.erb index 424ae41b2..16769ec4d 100644 --- a/app/components/management/budgets/print_investments/table_component.html.erb +++ b/app/components/management/budgets/print_investments/table_component.html.erb @@ -13,7 +13,7 @@ <%= budget.current_phase.name %> <%= link_to t("management.budgets.print_investments"), - print_management_budget_investments_path(budget) %> + print_management_budget_investments_path(budget) %> <% end %> diff --git a/app/components/proposals/form_component.html.erb b/app/components/proposals/form_component.html.erb index 658ca2f90..f6084f3b8 100644 --- a/app/components/proposals/form_component.html.erb +++ b/app/components/proposals/form_component.html.erb @@ -9,8 +9,8 @@ <%= f.translatable_fields do |translations_form| %>
    <%= translations_form.text_field :title, - maxlength: Proposal.title_max_length, - data: suggest_data(proposal) %> + maxlength: Proposal.title_max_length, + data: suggest_data(proposal) %>
    @@ -52,17 +52,17 @@ <% if Geozone.any? %>
    <%= f.select :geozone_id, geozone_select_options, - include_blank: t("geozones.none") %> + include_blank: t("geozones.none") %>
    <% end %> <% 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,17 +80,17 @@
    <%= 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? %>
    <%= f.text_field :responsible_name, - hint: t("proposals.form.proposal_responsible_name_note") %> + hint: t("proposals.form.proposal_responsible_name_note") %>
    <% end %> @@ -101,11 +101,10 @@ <% if proposal.new_record? %>
    <%= f.check_box :terms_of_service, - title: t("form.accept_terms_title"), - label: t("form.accept_terms", - policy: link_to(t("form.policy"), "/privacy", target: "blank"), - conditions: link_to(t("form.conditions"), "/conditions", target: "blank") - ) %> + title: t("form.accept_terms_title"), + label: t("form.accept_terms", + policy: link_to(t("form.policy"), "/privacy", target: "blank"), + conditions: link_to(t("form.conditions"), "/conditions", target: "blank")) %>
    <% end %> diff --git a/app/components/proposals/votes_component.html.erb b/app/components/proposals/votes_component.html.erb index 7e87fe6ec..c96200e00 100644 --- a/app/components/proposals/votes_component.html.erb +++ b/app/components/proposals/votes_component.html.erb @@ -8,11 +8,11 @@ <% else %> <%= button_to vote_url, - class: "button button-support small expanded", - title: t("proposals.proposal.support_title"), - method: "post", - remote: true, - "aria-label": support_aria_label do %> + class: "button button-support small expanded", + title: t("proposals.proposal.support_title"), + method: "post", + remote: true, + "aria-label": support_aria_label do %> <%= t("proposals.proposal.support") %> <% end %> <% end %> diff --git a/app/components/sdg/related_list_selector_component.html.erb b/app/components/sdg/related_list_selector_component.html.erb index 36fe5a0ba..6e7f5bbf5 100644 --- a/app/components/sdg/related_list_selector_component.html.erb +++ b/app/components/sdg/related_list_selector_component.html.erb @@ -12,15 +12,15 @@ <%= f.text_field :related_sdg_list, - class: "input", - hint: sanitize(t("sdg.related_list_selector.hint", + class: "input", + hint: sanitize(t("sdg.related_list_selector.hint", link: link_to(t("sdg.related_list_selector.help.text"), - sdg_help_path, - title: t("shared.target_blank"), - target: "_blank")), - attributes: %w[href title target]), - data: { "suggestions-list": sdg_related_suggestions, - "remove-tag-text": t("sdg.related_list_selector.remove_tag") } %> + sdg_help_path, + title: t("shared.target_blank"), + target: "_blank")), + attributes: %w[href title target]), + data: { "suggestions-list": sdg_related_suggestions, + "remove-tag-text": t("sdg.related_list_selector.remove_tag") } %>
    diff --git a/app/components/shared/advanced_search_component.html.erb b/app/components/shared/advanced_search_component.html.erb index 8a138f529..0182d5936 100644 --- a/app/components/shared/advanced_search_component.html.erb +++ b/app/components/shared/advanced_search_component.html.erb @@ -15,8 +15,8 @@
    <%= select_tag("advanced_search[date_min]", date_range_options, - include_blank: t("shared.advanced_search.date_range_blank"), - id: "js-advanced-search-date-min") %> + include_blank: t("shared.advanced_search.date_range_blank"), + id: "js-advanced-search-date-min") %>
    <%= text_field_tag "advanced_search[date_max]", - advanced_search[:date_max], - class: "js-calendar" %> + advanced_search[:date_max], + class: "js-calendar" %>
    @@ -43,12 +43,12 @@
    <%= select_tag("advanced_search[goal]", goal_options, - include_blank: t("shared.advanced_search.goal_blank")) %> + include_blank: t("shared.advanced_search.goal_blank")) %>
    <%= select_tag("advanced_search[target]", target_options, - include_blank: t("shared.advanced_search.target_blank")) %> + include_blank: t("shared.advanced_search.target_blank")) %>
    <% end %> diff --git a/app/components/shared/advanced_search_component.rb b/app/components/shared/advanced_search_component.rb index 242335ed7..43a72917e 100644 --- a/app/components/shared/advanced_search_component.rb +++ b/app/components/shared/advanced_search_component.rb @@ -8,13 +8,16 @@ class Shared::AdvancedSearchComponent < ApplicationComponent end def date_range_options - options_for_select([ - [t("shared.advanced_search.date_1"), 1], - [t("shared.advanced_search.date_2"), 2], - [t("shared.advanced_search.date_3"), 3], - [t("shared.advanced_search.date_4"), 4], - [t("shared.advanced_search.date_5"), "custom"]], - selected_date_range) + options_for_select( + [ + [t("shared.advanced_search.date_1"), 1], + [t("shared.advanced_search.date_2"), 2], + [t("shared.advanced_search.date_3"), 3], + [t("shared.advanced_search.date_4"), 4], + [t("shared.advanced_search.date_5"), "custom"] + ], + selected_date_range + ) end def selected_date_range diff --git a/app/components/shared/in_favor_against_component.html.erb b/app/components/shared/in_favor_against_component.html.erb index 5d9739052..b78e245f2 100644 --- a/app/components/shared/in_favor_against_component.html.erb +++ b/app/components/shared/in_favor_against_component.html.erb @@ -1,11 +1,11 @@
    <%= button_to polymorphic_path(votable, action: :vote, value: "yes"), - class: "like #{voted_classes[:in_favor]}", - title: t("votes.agree"), - "aria-label": agree_aria_label, - method: "post", - remote: true do %> + class: "like #{voted_classes[:in_favor]}", + title: t("votes.agree"), + "aria-label": agree_aria_label, + method: "post", + remote: true do %> <%= t("votes.agree") %> <% end %> <%= votes_percentage("likes", votable) %> @@ -13,11 +13,11 @@
    <%= button_to polymorphic_path(votable, action: :vote, value: "no"), - class: "unlike #{voted_classes[:against]}", - title: t("votes.disagree"), - "aria-label": disagree_aria_label, - method: "post", - remote: true do %> + class: "unlike #{voted_classes[:against]}", + title: t("votes.disagree"), + "aria-label": disagree_aria_label, + method: "post", + remote: true do %> <%= t("votes.disagree") %> <% end %> <%= votes_percentage("dislikes", votable) %> diff --git a/app/components/shared/map_location_component.rb b/app/components/shared/map_location_component.rb index e82f1f8a1..b4fbca49e 100644 --- a/app/components/shared/map_location_component.rb +++ b/app/components/shared/map_location_component.rb @@ -40,9 +40,9 @@ class Shared::MapLocationComponent < ApplicationComponent def remove_marker button_tag remove_marker_label, - id: remove_marker_id, - class: "map-location-remove-marker", - type: "button" + id: remove_marker_id, + class: "map-location-remove-marker", + type: "button" end def data diff --git a/app/controllers/admin/banners_controller.rb b/app/controllers/admin/banners_controller.rb index c795b4b33..72b085a5d 100644 --- a/app/controllers/admin/banners_controller.rb +++ b/app/controllers/admin/banners_controller.rb @@ -47,18 +47,6 @@ class Admin::BannersController < Admin::BaseController web_section_ids: []] end - def banner_styles - @banner_styles = Setting.all.banner_style.map do |banner_style| - [banner_style.value, banner_style.key.split(".")[1]] - end - end - - def banner_imgs - @banner_imgs = Setting.all.banner_img.map do |banner_img| - [banner_img.value, banner_img.key.split(".")[1]] - end - end - def banner_sections @banner_sections = WebSection.all end diff --git a/app/controllers/admin/budgets_controller.rb b/app/controllers/admin/budgets_controller.rb index 9617c904a..c0facf84b 100644 --- a/app/controllers/admin/budgets_controller.rb +++ b/app/controllers/admin/budgets_controller.rb @@ -29,7 +29,8 @@ class Admin::BudgetsController < Admin::BaseController @budget.headings.each { |heading| Budget::Result.new(@budget, heading).delay.calculate_winners } redirect_to admin_budget_budget_investments_path( budget_id: @budget.id, - advanced_filters: ["winners"]), + advanced_filters: ["winners"] + ), notice: I18n.t("admin.budgets.winners.calculated") end @@ -60,13 +61,14 @@ class Admin::BudgetsController < Admin::BaseController def allowed_params descriptions = Budget::Phase::PHASE_KINDS.map { |p| "description_#{p}" }.map(&:to_sym) - valid_attributes = [:phase, - :currency_symbol, - :voting_style, - :hide_money, - administrator_ids: [], - valuator_ids: [], - image_attributes: image_attributes + valid_attributes = [ + :phase, + :currency_symbol, + :voting_style, + :hide_money, + administrator_ids: [], + valuator_ids: [], + image_attributes: image_attributes ] + descriptions [*valid_attributes, *report_attributes, translation_params(Budget)] 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/legislation/processes_controller.rb b/app/controllers/admin/legislation/processes_controller.rb index 7396ca654..370236008 100644 --- a/app/controllers/admin/legislation/processes_controller.rb +++ b/app/controllers/admin/legislation/processes_controller.rb @@ -8,8 +8,9 @@ class Admin::Legislation::ProcessesController < Admin::Legislation::BaseControll load_and_authorize_resource :process, class: "Legislation::Process" def index - @processes = ::Legislation::Process.send(@current_filter).order(start_date: :desc) - .page(params[:page]) + @processes = ::Legislation::Process.send(@current_filter) + .order(start_date: :desc) + .page(params[:page]) end def create diff --git a/app/controllers/admin/local_census_records_controller.rb b/app/controllers/admin/local_census_records_controller.rb index a30fc8efc..5c23342f5 100644 --- a/app/controllers/admin/local_census_records_controller.rb +++ b/app/controllers/admin/local_census_records_controller.rb @@ -10,7 +10,7 @@ class Admin::LocalCensusRecordsController < Admin::BaseController @local_census_record = LocalCensusRecord.new(local_census_record_params) if @local_census_record.save redirect_to admin_local_census_records_path, - notice: t("admin.local_census_records.create.notice") + notice: t("admin.local_census_records.create.notice") else render :new end @@ -19,7 +19,7 @@ class Admin::LocalCensusRecordsController < Admin::BaseController def update if @local_census_record.update(local_census_record_params) redirect_to admin_local_census_records_path, - notice: t("admin.local_census_records.update.notice") + notice: t("admin.local_census_records.update.notice") else render :edit end @@ -28,7 +28,7 @@ class Admin::LocalCensusRecordsController < Admin::BaseController def destroy @local_census_record.destroy! redirect_to admin_local_census_records_path, - notice: t("admin.local_census_records.destroy.notice") + notice: t("admin.local_census_records.destroy.notice") end private diff --git a/app/controllers/admin/poll/officer_assignments_controller.rb b/app/controllers/admin/poll/officer_assignments_controller.rb index 8b3d21e0c..82e45a182 100644 --- a/app/controllers/admin/poll/officer_assignments_controller.rb +++ b/app/controllers/admin/poll/officer_assignments_controller.rb @@ -4,22 +4,22 @@ class Admin::Poll::OfficerAssignmentsController < Admin::Poll::BaseController before_action :load_booth_assignment, only: [:create] def index - @officers = ::Poll::Officer. - includes(:user). - order("users.username"). - where( - id: @poll.officer_assignments.select(:officer_id).distinct.map(&:officer_id) - ).page(params[:page]).per(50) + @officers = ::Poll::Officer + .includes(:user) + .order("users.username") + .where(id: @poll.officer_assignments.select(:officer_id).distinct.map(&:officer_id)) + .page(params[:page]) + .per(50) end def by_officer @poll = ::Poll.includes(:booths).find(params[:poll_id]) @officer = ::Poll::Officer.includes(:user).find(officer_assignment_params[:officer_id]) - @officer_assignments = ::Poll::OfficerAssignment. - joins(:booth_assignment). - includes(:recounts, booth_assignment: :booth). - by_officer_and_poll(@officer.id, @poll.id). - order(:date) + @officer_assignments = ::Poll::OfficerAssignment + .joins(:booth_assignment) + .includes(:recounts, booth_assignment: :booth) + .by_officer_and_poll(@officer.id, @poll.id) + .order(:date) end def search_officers diff --git a/app/controllers/admin/poll/questions/answers/documents_controller.rb b/app/controllers/admin/poll/questions/answers/documents_controller.rb index 4fce04d05..6eb70dcc8 100644 --- a/app/controllers/admin/poll/questions/answers/documents_controller.rb +++ b/app/controllers/admin/poll/questions/answers/documents_controller.rb @@ -12,7 +12,7 @@ class Admin::Poll::Questions::Answers::DocumentsController < Admin::Poll::BaseCo if @answer.save redirect_to admin_answer_documents_path(@answer), - notice: t("admin.documents.create.success_notice") + notice: t("admin.documents.create.success_notice") else render :index end diff --git a/app/controllers/admin/poll/questions/answers/images_controller.rb b/app/controllers/admin/poll/questions/answers/images_controller.rb index 9b60f3f4c..48b843d72 100644 --- a/app/controllers/admin/poll/questions/answers/images_controller.rb +++ b/app/controllers/admin/poll/questions/answers/images_controller.rb @@ -16,7 +16,7 @@ class Admin::Poll::Questions::Answers::ImagesController < Admin::Poll::BaseContr if @answer.save redirect_to admin_answer_images_path(@answer), - notice: t("flash.actions.create.poll_question_answer_image") + notice: t("flash.actions.create.poll_question_answer_image") else render :new end diff --git a/app/controllers/admin/poll/questions/answers/videos_controller.rb b/app/controllers/admin/poll/questions/answers/videos_controller.rb index c198540b1..ad613fc41 100644 --- a/app/controllers/admin/poll/questions/answers/videos_controller.rb +++ b/app/controllers/admin/poll/questions/answers/videos_controller.rb @@ -11,7 +11,7 @@ class Admin::Poll::Questions::Answers::VideosController < Admin::Poll::BaseContr def create if @video.save redirect_to admin_answer_videos_path(@answer), - notice: t("flash.actions.create.poll_question_answer_video") + notice: t("flash.actions.create.poll_question_answer_video") else render :new end diff --git a/app/controllers/admin/poll/questions/answers_controller.rb b/app/controllers/admin/poll/questions/answers_controller.rb index 844f3d494..874d99a23 100644 --- a/app/controllers/admin/poll/questions/answers_controller.rb +++ b/app/controllers/admin/poll/questions/answers_controller.rb @@ -12,7 +12,7 @@ class Admin::Poll::Questions::AnswersController < Admin::Poll::BaseController def create if @answer.save redirect_to admin_question_path(@question), - notice: t("flash.actions.create.poll_question_answer") + notice: t("flash.actions.create.poll_question_answer") else render :new end @@ -24,7 +24,7 @@ class Admin::Poll::Questions::AnswersController < Admin::Poll::BaseController def update if @answer.update(answer_params) redirect_to admin_question_path(@question), - notice: t("flash.actions.save_changes.notice") + notice: t("flash.actions.save_changes.notice") else render :edit end diff --git a/app/controllers/admin/poll/recounts_controller.rb b/app/controllers/admin/poll/recounts_controller.rb index 7e1756894..04dbc53e5 100644 --- a/app/controllers/admin/poll/recounts_controller.rb +++ b/app/controllers/admin/poll/recounts_controller.rb @@ -4,10 +4,10 @@ class Admin::Poll::RecountsController < Admin::Poll::BaseController def index @stats = Poll::Stats.new(@poll) - @booth_assignments = @poll.booth_assignments. - includes(:booth, :recounts, :voters). - order("poll_booths.name"). - page(params[:page]).per(50) + @booth_assignments = @poll.booth_assignments + .includes(:booth, :recounts, :voters) + .order("poll_booths.name") + .page(params[:page]).per(50) end private 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/admin/verifications_controller.rb b/app/controllers/admin/verifications_controller.rb index 3e3671ec3..f4a8b3669 100644 --- a/app/controllers/admin/verifications_controller.rb +++ b/app/controllers/admin/verifications_controller.rb @@ -4,9 +4,10 @@ class Admin::VerificationsController < Admin::BaseController end def search - @users = User.incomplete_verification.search(params[:search]) - .page(params[:page]) - .for_render + @users = User.incomplete_verification + .search(params[:search]) + .page(params[:page]) + .for_render render :index end end diff --git a/app/controllers/budgets/investments/votes_controller.rb b/app/controllers/budgets/investments/votes_controller.rb index b48715c5b..29e52a196 100644 --- a/app/controllers/budgets/investments/votes_controller.rb +++ b/app/controllers/budgets/investments/votes_controller.rb @@ -14,7 +14,7 @@ module Budgets respond_to do |format| format.html do redirect_to budget_investments_path(heading_id: @investment.heading.id), - notice: t("flash.actions.create.support") + notice: t("flash.actions.create.support") end format.js { render :show } diff --git a/app/controllers/dashboard/achievements_controller.rb b/app/controllers/dashboard/achievements_controller.rb index 320dbc2ce..3a1aa34c6 100644 --- a/app/controllers/dashboard/achievements_controller.rb +++ b/app/controllers/dashboard/achievements_controller.rb @@ -37,11 +37,11 @@ class Dashboard::AchievementsController < Dashboard::BaseController def executed_proposed_actions @executed_proposed_actions ||= Dashboard::ExecutedAction - .joins(:action) - .includes(:action) - .where(proposal: proposal) - .where(executed_at: start_date.beginning_of_day..end_date.end_of_day) - .where(dashboard_actions: { action_type: 0 }) - .order(executed_at: :asc) + .joins(:action) + .includes(:action) + .where(proposal: proposal) + .where(executed_at: start_date.beginning_of_day..end_date.end_of_day) + .where(dashboard_actions: { action_type: 0 }) + .order(executed_at: :asc) end 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/graphql_controller.rb b/app/controllers/graphql_controller.rb index 877a3a451..0c64ddfb9 100644 --- a/app/controllers/graphql_controller.rb +++ b/app/controllers/graphql_controller.rb @@ -12,7 +12,8 @@ class GraphqlController < ApplicationController begin raise GraphqlController::QueryStringError if query_string.nil? - result = ConsulSchema.execute(query_string, + result = ConsulSchema.execute( + query_string, variables: prepare_variables, context: {}, operation_name: params[:operationName] diff --git a/app/controllers/legislation/processes_controller.rb b/app/controllers/legislation/processes_controller.rb index 3ceff8392..c24206182 100644 --- a/app/controllers/legislation/processes_controller.rb +++ b/app/controllers/legislation/processes_controller.rb @@ -10,8 +10,11 @@ class Legislation::ProcessesController < Legislation::BaseController def index @current_filter ||= "open" - @processes = ::Legislation::Process.send(@current_filter).published - .not_in_draft.order(start_date: :desc).page(params[:page]) + @processes = ::Legislation::Process.send(@current_filter) + .published + .not_in_draft + .order(start_date: :desc) + .page(params[:page]) end def show diff --git a/app/controllers/management/budgets/investments/votes_controller.rb b/app/controllers/management/budgets/investments/votes_controller.rb index 1ab8f8056..c6a013ee6 100644 --- a/app/controllers/management/budgets/investments/votes_controller.rb +++ b/app/controllers/management/budgets/investments/votes_controller.rb @@ -9,7 +9,7 @@ class Management::Budgets::Investments::VotesController < Management::BaseContro respond_to do |format| format.html do redirect_to management_budget_investments_path(heading_id: @investment.heading.id), - notice: t("flash.actions.create.support") + notice: t("flash.actions.create.support") end format.js { render :show } diff --git a/app/controllers/officing/ballot_sheets_controller.rb b/app/controllers/officing/ballot_sheets_controller.rb index eb29971e6..814d26788 100644 --- a/app/controllers/officing/ballot_sheets_controller.rb +++ b/app/controllers/officing/ballot_sheets_controller.rb @@ -42,13 +42,13 @@ class Officing::BallotSheetsController < Officing::BaseController end def load_officer_assignments - @officer_assignments = ::Poll::OfficerAssignment. - includes(booth_assignment: [:booth]). - joins(:booth_assignment). - final. - where(id: current_user.poll_officer.officer_assignment_ids). - where(poll_booth_assignments: { poll_id: @poll.id }). - where(date: Date.current) + @officer_assignments = ::Poll::OfficerAssignment + .includes(booth_assignment: [:booth]) + .joins(:booth_assignment) + .final + .where(id: current_user.poll_officer.officer_assignment_ids) + .where(poll_booth_assignments: { poll_id: @poll.id }) + .where(date: Date.current) end def load_officer_assignment diff --git a/app/controllers/officing/results_controller.rb b/app/controllers/officing/results_controller.rb index 6dbfe96ab..543607b0c 100644 --- a/app/controllers/officing/results_controller.rb +++ b/app/controllers/officing/results_controller.rb @@ -21,12 +21,12 @@ class Officing::ResultsController < Officing::BaseController def index @booth_assignment = ::Poll::BoothAssignment.includes(:booth).find(index_params[:booth_assignment_id]) - if current_user.poll_officer.officer_assignments.final. - where(booth_assignment_id: @booth_assignment.id).exists? + if current_user.poll_officer.officer_assignments.final + .where(booth_assignment_id: @booth_assignment.id).exists? - @partial_results = ::Poll::PartialResult.includes(:question). - where(booth_assignment_id: index_params[:booth_assignment_id]). - where(date: index_params[:date]) + @partial_results = ::Poll::PartialResult.includes(:question) + .where(booth_assignment_id: index_params[:booth_assignment_id]) + .where(date: index_params[:date]) @recounts = ::Poll::Recount.where(booth_assignment_id: @booth_assignment.id, date: index_params[:date]) end end @@ -89,18 +89,18 @@ class Officing::ResultsController < Officing::BaseController end def load_officer_assignment - @officer_assignment = current_user.poll_officer. - officer_assignments.final.find_by(id: results_params[:officer_assignment_id]) + @officer_assignment = current_user.poll_officer + .officer_assignments.final.find_by(id: results_params[:officer_assignment_id]) end def load_officer_assignments - @officer_assignments = ::Poll::OfficerAssignment. - includes(booth_assignment: [:booth]). - joins(:booth_assignment). - final. - where(id: current_user.poll_officer.officer_assignment_ids). - where(poll_booth_assignments: { poll_id: @poll.id }). - where(date: Date.current) + @officer_assignments = ::Poll::OfficerAssignment + .includes(booth_assignment: [:booth]) + .joins(:booth_assignment) + .final + .where(id: current_user.poll_officer.officer_assignment_ids) + .where(poll_booth_assignments: { poll_id: @poll.id }) + .where(date: Date.current) end def load_partial_results 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/proposals_controller.rb b/app/controllers/proposals_controller.rb index 23a186151..656df3e5e 100644 --- a/app/controllers/proposals_controller.rb +++ b/app/controllers/proposals_controller.rb @@ -155,8 +155,10 @@ class ProposalsController < ApplicationController return unless !@advanced_search_terms && @search_terms.blank? && params[:retired].blank? && @current_order != "recommendations" if Setting["feature.featured_proposals"] - @featured_proposals = Proposal.not_archived.unsuccessful - .sort_by_confidence_score.limit(Setting["featured_proposals_number"]) + @featured_proposals = Proposal.not_archived + .unsuccessful + .sort_by_confidence_score + .limit(Setting["featured_proposals_number"]) if @featured_proposals.present? @resources = @resources.where.not(id: @featured_proposals) end diff --git a/app/controllers/valuation/budget_investments_controller.rb b/app/controllers/valuation/budget_investments_controller.rb index 3460b6d20..3adee9d37 100644 --- a/app/controllers/valuation/budget_investments_controller.rb +++ b/app/controllers/valuation/budget_investments_controller.rb @@ -77,19 +77,19 @@ class Valuation::BudgetInvestmentsController < Valuation::BaseController investment_headings = Budget::Heading.where(id: investments.pluck(:heading_id)).sort_by(&:name) all_headings_filter = [ - { - name: t("valuation.budget_investments.index.headings_filter_all"), - id: nil, - count: investments.size - } - ] + { + name: t("valuation.budget_investments.index.headings_filter_all"), + id: nil, + count: investments.size + } + ] 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/admin_budget_investments_helper.rb b/app/helpers/admin_budget_investments_helper.rb index f34fbcb65..014118fd5 100644 --- a/app/helpers/admin_budget_investments_helper.rb +++ b/app/helpers/admin_budget_investments_helper.rb @@ -1,8 +1,8 @@ module AdminBudgetInvestmentsHelper def advanced_menu_visibility if params[:advanced_filters].empty? && - params["min_total_supports"].blank? && - params["max_total_supports"].blank? + params["min_total_supports"].blank? && + params["max_total_supports"].blank? "hide" else "" @@ -22,8 +22,8 @@ module AdminBudgetInvestmentsHelper end def valuator_select_options(budget) - budget.valuators.order("description ASC").order("users.email ASC").includes(:user). - map { |v| [v.description_or_email, "valuator_#{v.id}"] } + budget.valuators.order("description ASC").order("users.email ASC").includes(:user) + .map { |v| [v.description_or_email, "valuator_#{v.id}"] } end def valuator_group_select_options diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1377b27d2..fb69f2bb9 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -48,7 +48,7 @@ module ApplicationHelper def self.asset_data_base64(path) asset = (Rails.application.assets || ::Sprockets::Railtie.build_environment(Rails.application)) - .find_asset(path) + .find_asset(path) throw "Could not find asset '#{path}'" if asset.nil? base64 = Base64.encode64(asset.to_s).gsub(/\s+/, "") "data:#{asset.content_type};base64,#{Rack::Utils.escape(base64)}" 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/globalize_helper.rb b/app/helpers/globalize_helper.rb index 13e9ec3d4..6487c5c7b 100644 --- a/app/helpers/globalize_helper.rb +++ b/app/helpers/globalize_helper.rb @@ -35,7 +35,7 @@ module GlobalizeHelper def first_i18n_content_translation_locale if I18nContentTranslation.existing_languages.count == 0 || - I18nContentTranslation.existing_languages.include?(I18n.locale) + I18nContentTranslation.existing_languages.include?(I18n.locale) I18n.locale else I18nContentTranslation.existing_languages.first 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/links_helper.rb b/app/helpers/links_helper.rb index 89321462e..0671e9c78 100644 --- a/app/helpers/links_helper.rb +++ b/app/helpers/links_helper.rb @@ -2,7 +2,7 @@ module LinksHelper def render_destroy_element_link(builder, element) link_to_remove_association element.new_record? ? t("links.form.cancel_button") : t("links.form.delete_button"), - builder, class: "delete remove-element" + builder, class: "delete remove-element" end def link_to_signin(options = {}) diff --git a/app/helpers/management_helper.rb b/app/helpers/management_helper.rb index a75fa87c1..99bc18023 100644 --- a/app/helpers/management_helper.rb +++ b/app/helpers/management_helper.rb @@ -25,17 +25,17 @@ module ManagementHelper def menu_create_investments? (controller_name == "budget_investments" && action_name == "new") || - (controller_name == "budgets" && action_name == "create_investments") + (controller_name == "budgets" && action_name == "create_investments") end def menu_support_investments? (controller_name == "budget_investments" && action_name == "index") || - (controller_name == "budgets" && action_name == "support_investments") + (controller_name == "budgets" && action_name == "support_investments") end def menu_print_investments? (controller_name == "budget_investments" && action_name == "print") || - (controller_name == "budgets" && action_name == "print_investments") + (controller_name == "budgets" && action_name == "print_investments") end def menu_user_invites? diff --git a/app/helpers/milestones_helper.rb b/app/helpers/milestones_helper.rb index 888955e4e..7a1b4339a 100644 --- a/app/helpers/milestones_helper.rb +++ b/app/helpers/milestones_helper.rb @@ -3,14 +3,14 @@ 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, "aria-valuemin": "0", tabindex: "0" do tag.span(class: "progress-meter", style: "width: #{progress_bar.percentage}%;") + - tag.p(text, class: "progress-meter-text") + tag.p(text, class: "progress-meter-text") end end end diff --git a/app/helpers/poll_recounts_helper.rb b/app/helpers/poll_recounts_helper.rb index 8e92e7a1f..9155b7556 100644 --- a/app/helpers/poll_recounts_helper.rb +++ b/app/helpers/poll_recounts_helper.rb @@ -2,8 +2,8 @@ module PollRecountsHelper def total_recounts_by_booth(booth_assignment) if booth_assignment.recounts.any? booth_assignment.recounts.sum(:total_amount) + - booth_assignment.recounts.sum(:white_amount) + - booth_assignment.recounts.sum(:null_amount) + booth_assignment.recounts.sum(:white_amount) + + booth_assignment.recounts.sum(:null_amount) end end end diff --git a/app/helpers/proposals_dashboard_helper.rb b/app/helpers/proposals_dashboard_helper.rb index a73b6d0ff..3b069cd02 100644 --- a/app/helpers/proposals_dashboard_helper.rb +++ b/app/helpers/proposals_dashboard_helper.rb @@ -49,7 +49,7 @@ module ProposalsDashboardHelper def is_proposed_action_request? controller_name == "dashboard" && action_name == "new_request" && - dashboard_action&.proposed_action? + dashboard_action&.proposed_action? end def is_request_active(id) @@ -60,10 +60,10 @@ module ProposalsDashboardHelper label = [] label << t("dashboard.resource.required_days", - days: resource.day_offset) if resource.day_offset > 0 + days: resource.day_offset) if resource.day_offset > 0 label << t("dashboard.resource.required_supports", - supports: number_with_delimiter(resource.required_supports, - delimiter: ".")) if resource.required_supports > 0 + supports: number_with_delimiter(resource.required_supports, + delimiter: ".")) if resource.required_supports > 0 safe_join label, h(" #{t("dashboard.resource.and")})") + tag(:br) end 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/helpers/users_helper.rb b/app/helpers/users_helper.rb index 49db9cb5c..66ec354ea 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -16,7 +16,7 @@ module UsersHelper deleted_commentable_text(comment) elsif commentable.hidden? tag.del(commentable.title) + " " + - tag.span("(#{deleted_commentable_text(comment)})", class: "small") + tag.span("(#{deleted_commentable_text(comment)})", class: "small") else link_to(commentable.title, comment) end diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb index cb77252d3..82f93bb3c 100644 --- a/app/helpers/welcome_helper.rb +++ b/app/helpers/welcome_helper.rb @@ -25,7 +25,7 @@ module WelcomeHelper def calculate_image_path(recommended, image_default) if recommended.respond_to?(:image) && recommended.image.present? && - recommended.image.attachment.attached? + recommended.image.attachment.attached? recommended.image.variant(:medium) elsif image_default.present? image_default diff --git a/app/models/abilities/administrator.rb b/app/models/abilities/administrator.rb index f874af58b..234d3c88b 100644 --- a/app/models/abilities/administrator.rb +++ b/app/models/abilities/administrator.rb @@ -73,7 +73,7 @@ module Abilities can [:hide, :admin_update, :toggle_selection], Budget::Investment can [:valuate, :comment_valuation], Budget::Investment cannot [:admin_update, :toggle_selection, :valuate, :comment_valuation], - Budget::Investment, budget: { phase: "finished" } + Budget::Investment, budget: { phase: "finished" } can :create, Budget::ValuatorAssignment diff --git a/app/models/abilities/common.rb b/app/models/abilities/common.rb index 6c8d6cdd2..2a1432354 100644 --- a/app/models/abilities/common.rb +++ b/app/models/abilities/common.rb @@ -96,9 +96,9 @@ module Abilities can :suggest, Budget::Investment, budget: { phase: "accepting" } can :destroy, Budget::Investment, budget: { phase: ["accepting", "reviewing"] }, author_id: user.id can [:create, :destroy], ActsAsVotable::Vote, - voter_id: user.id, - votable_type: "Budget::Investment", - votable: { budget: { phase: "selecting" }} + voter_id: user.id, + votable_type: "Budget::Investment", + votable: { budget: { phase: "selecting" }} can [:show, :create], Budget::Ballot, budget: { phase: "balloting" } can [:create, :destroy], Budget::Ballot::Line, budget: { phase: "balloting" } diff --git a/app/models/budget/group.rb b/app/models/budget/group.rb index 9ca141725..a2e0164e4 100644 --- a/app/models/budget/group.rb +++ b/app/models/budget/group.rb @@ -11,8 +11,8 @@ class Budget def name_uniqueness_by_budget if budget.groups.joins(:translations) - .where(name: name) - .where.not("budget_group_translations.budget_group_id": budget_group_id).any? + .where(name: name) + .where.not("budget_group_translations.budget_group_id": budget_group_id).any? errors.add(:name, I18n.t("errors.messages.taken")) end 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 051c569bb..61fe46bc3 100644 --- a/app/models/budget/investment.rb +++ b/app/models/budget/investment.rb @@ -51,9 +51,9 @@ 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, - inverse_of: :commentable, - class_name: "Comment" + as: :commentable, + inverse_of: :commentable, + class_name: "Comment" validates_translation :title, presence: true, length: { in: 4..Budget::Investment.title_max_length } validates_translation :description, presence: true, length: { maximum: Budget::Investment.description_max_length } @@ -109,8 +109,8 @@ class Budget end def self.by_valuator_group(valuator_group_id) - joins(:valuator_group_assignments). - where(budget_valuator_group_assignments: { valuator_group_id: valuator_group_id }) + joins(:valuator_group_assignments) + .where(budget_valuator_group_assignments: { valuator_group_id: valuator_group_id }) end before_validation :set_responsible_name @@ -198,13 +198,14 @@ class Budget def self.search_by_title_or_id(title_or_id) with_joins = with_translations(Globalize.fallbacks(I18n.locale)) - with_joins.where(id: title_or_id). - or(with_joins.where("budget_investment_translations.title ILIKE ?", "%#{title_or_id}%")) + with_joins.where(id: title_or_id) + .or(with_joins.where("budget_investment_translations.title ILIKE ?", "%#{title_or_id}%")) 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/budget/phase.rb b/app/models/budget/phase.rb index 28ae761d1..5e4b00fca 100644 --- a/app/models/budget/phase.rb +++ b/app/models/budget/phase.rb @@ -1,7 +1,7 @@ class Budget class Phase < ApplicationRecord PHASE_KINDS = %w[informing accepting reviewing selecting valuating publishing_prices balloting - reviewing_ballots finished].freeze + reviewing_ballots finished].freeze PUBLISHED_PRICES_PHASES = %w[publishing_prices balloting reviewing_ballots finished].freeze DESCRIPTION_MAX_LENGTH = 2000 diff --git a/app/models/budget/stats.rb b/app/models/budget/stats.rb index bbf01de17..3837bb0f8 100644 --- a/app/models/budget/stats.rb +++ b/app/models/budget/stats.rb @@ -129,8 +129,8 @@ class Budget::Stats def balloters_by_heading(heading_id) stats_cache("balloters_by_heading_#{heading_id}") do budget.ballots.joins(:lines) - .where(budget_ballot_lines: { heading_id: heading_id }) - .distinct.pluck(:user_id) + .where(budget_ballot_lines: { heading_id: heading_id }) + .distinct.pluck(:user_id) end end diff --git a/app/models/budget/voting_styles/base.rb b/app/models/budget/voting_styles/base.rb index 86a4b0284..97b220bdd 100644 --- a/app/models/budget/voting_styles/base.rb +++ b/app/models/budget/voting_styles/base.rb @@ -27,8 +27,8 @@ class Budget::VotingStyles::Base def voted_info(heading) I18n.t("budgets.investments.index.sidebar.voted_info.#{name}", - count: investments(heading).count, - amount_spent: budget.formatted_amount(investments_price(heading))) + count: investments(heading).count, + amount_spent: budget.formatted_amount(investments_price(heading))) end def amount_available_info(heading) diff --git a/app/models/comment.rb b/app/models/comment.rb index e1a348bfa..cad1bf8fe 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -6,8 +6,8 @@ class Comment < ApplicationRecord include Searchable COMMENTABLE_TYPES = %w[Debate Proposal Budget::Investment Poll Topic - Legislation::Question Legislation::Annotation - Legislation::Proposal].freeze + Legislation::Question Legislation::Annotation + Legislation::Proposal].freeze acts_as_paranoid column: :hidden_at include ActsAsParanoidAliases @@ -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 @@ -148,7 +148,8 @@ class Comment < ApplicationRecord def validate_body_length validator = ActiveModel::Validations::LengthValidator.new( attributes: :body, - maximum: Comment.body_max_length) + maximum: Comment.body_max_length + ) validator.validate(self) end diff --git a/app/models/concerns/attachable.rb b/app/models/concerns/attachable.rb index 87bd92363..b2bcbf1b4 100644 --- a/app/models/concerns/attachable.rb +++ b/app/models/concerns/attachable.rb @@ -6,25 +6,25 @@ module Attachable attr_accessor :cached_attachment validates :attachment, - presence: true, - file_content_type: { - allow: ->(record) { record.accepted_content_types }, - if: -> { association_class && attachment.attached? }, - message: ->(record, *) do - I18n.t("#{record.model_name.plural}.errors.messages.wrong_content_type", - content_type: record.attachment_content_type, - accepted_content_types: record.class.humanized_accepted_content_types) - end - }, - file_size: { - less_than_or_equal_to: ->(record) { record.max_file_size.megabytes }, - if: -> { association_class && attachment.attached? }, - message: ->(record, *) do - I18n.t("#{record.model_name.plural}.errors.messages.in_between", - min: "0 Bytes", - max: "#{record.max_file_size} MB") - end - } + presence: true, + file_content_type: { + allow: ->(record) { record.accepted_content_types }, + if: -> { association_class && attachment.attached? }, + message: ->(record, *) do + I18n.t("#{record.model_name.plural}.errors.messages.wrong_content_type", + content_type: record.attachment_content_type, + accepted_content_types: record.class.humanized_accepted_content_types) + end + }, + file_size: { + less_than_or_equal_to: ->(record) { record.max_file_size.megabytes }, + if: -> { association_class && attachment.attached? }, + message: ->(record, *) do + I18n.t("#{record.model_name.plural}.errors.messages.in_between", + min: "0 Bytes", + max: "#{record.max_file_size} MB") + end + } before_validation :set_attachment_from_cached_attachment, if: -> { cached_attachment.present? } end diff --git a/app/models/concerns/globalizable.rb b/app/models/concerns/globalizable.rb index 0b995350d..8961620e8 100644 --- a/app/models/concerns/globalizable.rb +++ b/app/models/concerns/globalizable.rb @@ -110,10 +110,10 @@ module Globalizable end.join(", ") translations_ids = translation_class - .select("DISTINCT ON (#{translations_foreign_key}) id") - .where(locale: fallbacks) - .joins("LEFT JOIN (VALUES #{fallbacks_with_order}) AS locales(name, ordering) ON locale = locales.name") - .order(translations_foreign_key, "locales.ordering") + .select("DISTINCT ON (#{translations_foreign_key}) id") + .where(locale: fallbacks) + .joins("LEFT JOIN (VALUES #{fallbacks_with_order}) AS locales(name, ordering) ON locale = locales.name") + .order(translations_foreign_key, "locales.ordering") with_translations(fallbacks).where("#{translations_table_name}.id": translations_ids) end diff --git a/app/models/concerns/relationable.rb b/app/models/concerns/relationable.rb index 6bbe678ca..0d3085117 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, - inverse_of: :parent_relationable, - dependent: :destroy + as: :parent_relationable, + inverse_of: :parent_relationable, + dependent: :destroy end def find_related_content(relationable) diff --git a/app/models/concerns/statisticable.rb b/app/models/concerns/statisticable.rb index 790b01b3e..9b32b22b3 100644 --- a/app/models/concerns/statisticable.rb +++ b/app/models/concerns/statisticable.rb @@ -163,8 +163,7 @@ module Statisticable [75, 79], [80, 84], [85, 89], - [90, 300] - ] + [90, 300]] end def participants_between_ages(from, to) diff --git a/app/models/dashboard/action.rb b/app/models/dashboard/action.rb index a669990ce..6287adcab 100644 --- a/app/models/dashboard/action.rb +++ b/app/models/dashboard/action.rb @@ -108,9 +108,10 @@ class Dashboard::Action < ApplicationRecord end def self.calculate_actions(proposal_votes, day_offset, proposal) - Dashboard::Action.active.where("required_supports <= ?", proposal_votes) - .where("day_offset <= ?", day_offset) - .by_published_proposal(proposal.published?) + Dashboard::Action.active + .where("required_supports <= ?", proposal_votes) + .where("day_offset <= ?", day_offset) + .by_published_proposal(proposal.published?) end def self.calculate_votes(proposal, date) 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..9b21ae923 100644 --- a/app/models/legislation/draft_version.rb +++ b/app/models/legislation/draft_version.rb @@ -11,9 +11,9 @@ 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 + foreign_key: "legislation_draft_version_id", + 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..48c41a894 100644 --- a/app/models/legislation/process.rb +++ b/app/models/legislation/process.rb @@ -27,21 +27,21 @@ class Legislation::Process < ApplicationRecord CSS_HEX_COLOR = /\A#?(?:[A-F0-9]{3}){1,2}\z/i has_many :draft_versions, -> { order(:id) }, - foreign_key: "legislation_process_id", - inverse_of: :process, - dependent: :destroy + foreign_key: "legislation_process_id", + inverse_of: :process, + dependent: :destroy has_one :final_draft_version, -> { where final_version: true, status: "published" }, - class_name: "Legislation::DraftVersion", - foreign_key: "legislation_process_id", - inverse_of: :process + class_name: "Legislation::DraftVersion", + foreign_key: "legislation_process_id", + inverse_of: :process has_many :questions, -> { order(:id) }, - foreign_key: "legislation_process_id", - inverse_of: :process, - dependent: :destroy + foreign_key: "legislation_process_id", + inverse_of: :process, + dependent: :destroy has_many :proposals, -> { order(:id) }, - foreign_key: "legislation_process_id", - inverse_of: :process, - dependent: :destroy + foreign_key: "legislation_process_id", + 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/local_census_records/import.rb b/app/models/local_census_records/import.rb index 46bd1880c..e7d09a96b 100644 --- a/app/models/local_census_records/import.rb +++ b/app/models/local_census_records/import.rb @@ -73,7 +73,7 @@ class LocalCensusRecords::Import def file_headers_definition headers = fetch_file_headers return if headers.all? { |header| ATTRIBUTES.include? header } && - ATTRIBUTES.all? { |attr| headers.include? attr } + ATTRIBUTES.all? { |attr| headers.include? attr } errors.add :file, :headers, required_headers: ATTRIBUTES.join(", ") end 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/organization.rb b/app/models/organization.rb index 62b510a4d..436521fd4 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -52,14 +52,16 @@ class Organization < ApplicationRecord def validate_name_length validator = ActiveModel::Validations::LengthValidator.new( attributes: :name, - maximum: Organization.name_max_length) + maximum: Organization.name_max_length + ) validator.validate(self) end def validate_responsible_name_length validator = ActiveModel::Validations::LengthValidator.new( attributes: :responsible_name, - maximum: Organization.responsible_name_max_length) + maximum: Organization.responsible_name_max_length + ) validator.validate(self) end end diff --git a/app/models/poll.rb b/app/models/poll.rb index 18cba6d9b..3d14971fc 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -62,9 +62,11 @@ class Poll < ApplicationRecord end def self.overlaping_with(poll) - where("? < ends_at and ? >= starts_at", poll.starts_at.beginning_of_day, - poll.ends_at.end_of_day).where.not(id: poll.id) - .where(related: poll.related) + where("? < ends_at and ? >= starts_at", + poll.starts_at.beginning_of_day, + poll.ends_at.end_of_day) + .where.not(id: poll.id) + .where(related: poll.related) end def title @@ -102,7 +104,7 @@ class Poll < ApplicationRecord return none if user.nil? || user.unverified? current.left_joins(:geozones) - .where("geozone_restricted = ? OR geozones.id = ?", false, user.geozone_id) + .where("geozone_restricted = ? OR geozones.id = ?", false, user.geozone_id) end def self.votable_by(user) @@ -205,8 +207,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/officer.rb b/app/models/poll/officer.rb index 0b8d56dc1..6c305476f 100644 --- a/app/models/poll/officer.rb +++ b/app/models/poll/officer.rb @@ -16,17 +16,19 @@ class Poll end def voting_days_assigned_polls - officer_assignments.voting_days.includes(booth_assignment: :poll). - map(&:booth_assignment). - map(&:poll).uniq.compact. - sort { |x, y| y.ends_at <=> x.ends_at } + officer_assignments.voting_days + .includes(booth_assignment: :poll) + .map(&:booth_assignment) + .map(&:poll).uniq.compact + .sort { |x, y| y.ends_at <=> x.ends_at } end def final_days_assigned_polls - officer_assignments.final.includes(booth_assignment: :poll). - map(&:booth_assignment). - map(&:poll).uniq.compact. - sort { |x, y| y.ends_at <=> x.ends_at } + officer_assignments.final + .includes(booth_assignment: :poll) + .map(&:booth_assignment) + .map(&:poll).uniq.compact + .sort { |x, y| y.ends_at <=> x.ends_at } end def todays_booths diff --git a/app/models/poll/question.rb b/app/models/poll/question.rb index e513d3298..9e043d499 100644 --- a/app/models/poll/question.rb +++ b/app/models/poll/question.rb @@ -15,9 +15,9 @@ class Poll::Question < ApplicationRecord has_many :comments, as: :commentable, inverse_of: :commentable has_many :answers, class_name: "Poll::Answer" has_many :question_answers, -> { order "given_order asc" }, - class_name: "Poll::Question::Answer", - inverse_of: :question, - dependent: :destroy + class_name: "Poll::Question::Answer", + inverse_of: :question, + 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/tag_cloud.rb b/app/models/tag_cloud.rb index 0ab981653..f98f799e3 100644 --- a/app/models/tag_cloud.rb +++ b/app/models/tag_cloud.rb @@ -7,11 +7,11 @@ class TagCloud end def tags - resource_model_scoped. - last_week.send(counts). - where("lower(name) NOT IN (?)", category_names + geozone_names + default_blacklist). - order("#{table_name}_count": :desc, name: :asc). - limit(10) + resource_model_scoped + .last_week.send(counts) + .where("lower(name) NOT IN (?)", category_names + geozone_names + default_blacklist) + .order("#{table_name}_count": :desc, name: :asc) + .limit(10) end def counts diff --git a/app/models/tenant.rb b/app/models/tenant.rb index 5af5af632..36d28b141 100644 --- a/app/models/tenant.rb +++ b/app/models/tenant.rb @@ -2,10 +2,10 @@ class Tenant < ApplicationRecord enum schema_type: %w[subdomain domain] validates :schema, - presence: true, - uniqueness: true, - exclusion: { in: ->(*) { excluded_subdomains }}, - format: { with: URI::DEFAULT_PARSER.regexp[:HOST] } + presence: true, + uniqueness: true, + exclusion: { in: ->(*) { excluded_subdomains }}, + format: { with: URI::DEFAULT_PARSER.regexp[:HOST] } validates :name, presence: true, uniqueness: true after_create :create_schema diff --git a/app/models/user.rb b/app/models/user.rb index 6a400c5bc..ecc2833e8 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", - foreign_key: :author_id, - inverse_of: :author + class_name: "Budget::Investment", + foreign_key: :author_id, + 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", - foreign_key: :sender_id, - inverse_of: :sender + class_name: "DirectMessage", + foreign_key: :sender_id, + inverse_of: :sender has_many :direct_messages_received, - class_name: "DirectMessage", - foreign_key: :receiver_id, - inverse_of: :receiver + class_name: "DirectMessage", + foreign_key: :receiver_id, + 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", - foreign_key: :author_id, - inverse_of: :author + class_name: "Legislation::Annotation", + foreign_key: :author_id, + inverse_of: :author has_many :legislation_proposals, - class_name: "Legislation::Proposal", - foreign_key: :author_id, - inverse_of: :author + class_name: "Legislation::Proposal", + foreign_key: :author_id, + inverse_of: :author has_many :legislation_questions, - class_name: "Legislation::Question", - foreign_key: :author_id, - inverse_of: :author + class_name: "Legislation::Question", + foreign_key: :author_id, + inverse_of: :author has_many :polls, foreign_key: :author_id, inverse_of: :author has_many :poll_answers, - class_name: "Poll::Answer", - foreign_key: :author_id, - inverse_of: :author + class_name: "Poll::Answer", + foreign_key: :author_id, + inverse_of: :author has_many :poll_pair_answers, - class_name: "Poll::PairAnswer", - foreign_key: :author_id, - inverse_of: :author + class_name: "Poll::PairAnswer", + foreign_key: :author_id, + inverse_of: :author has_many :poll_partial_results, - class_name: "Poll::PartialResult", - foreign_key: :author_id, - inverse_of: :author + class_name: "Poll::PartialResult", + foreign_key: :author_id, + inverse_of: :author has_many :poll_questions, - class_name: "Poll::Question", - foreign_key: :author_id, - inverse_of: :author + class_name: "Poll::Question", + foreign_key: :author_id, + inverse_of: :author has_many :poll_recounts, - class_name: "Poll::Recount", - foreign_key: :author_id, - inverse_of: :author + class_name: "Poll::Recount", + foreign_key: :author_id, + 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], @@ -396,7 +396,7 @@ class User < ApplicationRecord conditions = warden_conditions.dup login = conditions.delete(:login) where(conditions.to_hash).find_by(["lower(email) = ?", login.downcase]) || - where(conditions.to_hash).find_by(["username = ?", login]) + where(conditions.to_hash).find_by(["username = ?", login]) end def self.find_by_manager_login(manager_login) @@ -427,7 +427,8 @@ class User < ApplicationRecord def validate_username_length validator = ActiveModel::Validations::LengthValidator.new( attributes: :username, - maximum: User.username_max_length) + maximum: User.username_max_length + ) validator.validate(self) end end diff --git a/app/models/verification/management/email.rb b/app/models/verification/management/email.rb index 5348c97ba..fbda50b8f 100644 --- a/app/models/verification/management/email.rb +++ b/app/models/verification/management/email.rb @@ -55,8 +55,8 @@ class Verification::Management::Email if document_number_mismatch? errors.add(:email, I18n.t("management.email_verifications.document_mismatch", - document_type: ApplicationController.helpers.humanize_document_type(user.document_type), - document_number: user.document_number)) + document_type: ApplicationController.helpers.humanize_document_type(user.document_type), + document_number: user.document_number)) end end diff --git a/app/models/verification/management/managed_user.rb b/app/models/verification/management/managed_user.rb index babf18f58..f4f0152f6 100644 --- a/app/models/verification/management/managed_user.rb +++ b/app/models/verification/management/managed_user.rb @@ -2,8 +2,8 @@ class Verification::Management::ManagedUser include ActiveModel::Model 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) + User.where.not(document_number: nil) + .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/admin_notifications/index.html.erb b/app/views/admin/admin_notifications/index.html.erb index c8fbe4900..de8b3f392 100644 --- a/app/views/admin/admin_notifications/index.html.erb +++ b/app/views/admin/admin_notifications/index.html.erb @@ -1,6 +1,7 @@

    <%= t("admin.admin_notifications.index.section_title") %>

    -<%= link_to t("admin.admin_notifications.index.new_notification"), new_admin_admin_notification_path, - class: "button float-right" %> +<%= link_to t("admin.admin_notifications.index.new_notification"), + new_admin_admin_notification_path, + class: "button float-right" %> <% if @admin_notifications.any? %> diff --git a/app/views/admin/banners/_form.html.erb b/app/views/admin/banners/_form.html.erb index 8737b760b..cd82e3f37 100644 --- a/app/views/admin/banners/_form.html.erb +++ b/app/views/admin/banners/_form.html.erb @@ -17,12 +17,12 @@ <%= f.translatable_fields do |translations_form| %>
    <%= translations_form.text_field :title, - data: { js_banner_title: "js_banner_title" } %> + data: { js_banner_title: "js_banner_title" } %>
    <%= translations_form.text_field :description, - data: { js_banner_description: "js_banner_description" } %> + data: { js_banner_description: "js_banner_description" } %>
    <% end %> diff --git a/app/views/admin/banners/index.html.erb b/app/views/admin/banners/index.html.erb index a81d0671d..046e7123d 100644 --- a/app/views/admin/banners/index.html.erb +++ b/app/views/admin/banners/index.html.erb @@ -1,5 +1,6 @@ <%= link_to t("admin.banners.index.create"), - new_admin_banner_path, class: "button float-right" %> + new_admin_banner_path, + class: "button float-right" %>

    <%= t("admin.banners.index.title") %>

    diff --git a/app/views/admin/budget_investments/_filters_description.html.erb b/app/views/admin/budget_investments/_filters_description.html.erb index 5732388f8..0aad814fb 100644 --- a/app/views/admin/budget_investments/_filters_description.html.erb +++ b/app/views/admin/budget_investments/_filters_description.html.erb @@ -1,16 +1,16 @@ <% if params[:filter].present? && params[:advanced_filters].present? %>

    <%= sanitize(t("#{i18n_namespace}.filters.two_filters", - filter: t("#{i18n_namespace}.filters.#{params[:filter]}"), - advanced_filters: budget_investments_advanced_filters(params[:advanced_filters]))) %>

    + filter: t("#{i18n_namespace}.filters.#{params[:filter]}"), + advanced_filters: budget_investments_advanced_filters(params[:advanced_filters]))) %>

    <% elsif params[:filter].present? %>

    <%= sanitize(t("#{i18n_namespace}.filters.one_filter", - filter: t("#{i18n_namespace}.filters.#{params[:filter]}"))) %>

    + filter: t("#{i18n_namespace}.filters.#{params[:filter]}"))) %>

    <% elsif params[:advanced_filters].present? %>

    <%= sanitize(t("#{i18n_namespace}.filters.one_filter", - filter: budget_investments_advanced_filters(params[:advanced_filters]))) %>

    + filter: budget_investments_advanced_filters(params[:advanced_filters]))) %>

    <% end %> diff --git a/app/views/admin/budget_investments/_investments.html.erb b/app/views/admin/budget_investments/_investments.html.erb index e5a79becb..f378fd63a 100644 --- a/app/views/admin/budget_investments/_investments.html.erb +++ b/app/views/admin/budget_investments/_investments.html.erb @@ -9,7 +9,8 @@ <% if @investments.any? %>

    <%= page_entries_info @investments %>

    <%= render "admin/shared/columns_selector", - cookie: "investments-columns", default: %w[id title supports admin valuator geozone feasibility price valuation_finished visible_to_valuators selected incompatible] %> + cookie: "investments-columns", + default: %w[id title supports admin valuator geozone feasibility price valuation_finished visible_to_valuators selected incompatible] %>
    <%= render "filters_description", i18n_namespace: "admin.budget_investments.index" %> diff --git a/app/views/admin/budget_investments/_written_by_author.html.erb b/app/views/admin/budget_investments/_written_by_author.html.erb index 63e48d4b6..c7ecf7ea6 100644 --- a/app/views/admin/budget_investments/_written_by_author.html.erb +++ b/app/views/admin/budget_investments/_written_by_author.html.erb @@ -1,8 +1,8 @@
    <%= t "admin.budget_investments.show.info", - budget_name: @budget.name, - group_name: @investment.group.name, - id: @investment.id %> + budget_name: @budget.name, + group_name: @investment.group.name, + id: @investment.id %>

    diff --git a/app/views/admin/budget_investments/edit.html.erb b/app/views/admin/budget_investments/edit.html.erb index e1bed238b..cd4f2f540 100644 --- a/app/views/admin/budget_investments/edit.html.erb +++ b/app/views/admin/budget_investments/edit.html.erb @@ -18,13 +18,13 @@ <%= f.translatable_fields do |translations_form| %>
    <%= translations_form.text_field :title, - maxlength: Budget::Investment.title_max_length %> + maxlength: Budget::Investment.title_max_length %>
    <%= translations_form.text_area :description, - maxlength: Budget::Investment.description_max_length, - class: "html-area" %> + maxlength: Budget::Investment.description_max_length, + class: "html-area" %>
    <% end %> @@ -52,8 +52,8 @@
    <%= f.select(:administrator_id, - @admins.map { |a| [a.description_or_name_and_email, a.id] }, - { include_blank: t("admin.budget_investments.edit.undefined") }) %> + @admins.map { |a| [a.description_or_name_and_email, a.id] }, + { include_blank: t("admin.budget_investments.edit.undefined") }) %>
    @@ -65,10 +65,10 @@ <% end %> <%= f.text_field :valuation_tag_list, - value: @investment.valuation_tag_list.sort.join(","), - label: false, - placeholder: t("admin.budget_investments.edit.tags_placeholder"), - class: "js-tag-list" %> + value: @investment.valuation_tag_list.sort.join(","), + label: false, + placeholder: t("admin.budget_investments.edit.tags_placeholder"), + class: "js-tag-list" %>
    @@ -96,19 +96,19 @@

    <%= t("admin.budget_investments.edit.compatibility") %>

    <%= f.check_box :incompatible, - title: t("admin.budget_investments.edit.compatibility") %> + title: t("admin.budget_investments.edit.compatibility") %>
    <% end %>

    <%= t("admin.budget_investments.edit.selection") %>

    <%= f.check_box :selected, - title: t("admin.budget_investments.edit.selection") %> + title: t("admin.budget_investments.edit.selection") %>
    <%= f.text_field :milestone_tag_list, - value: @investment.milestone_tag_list.sort.join(", ") %> + value: @investment.milestone_tag_list.sort.join(", ") %>
    diff --git a/app/views/admin/dashboard/actions/_form.html.erb b/app/views/admin/dashboard/actions/_form.html.erb index 178fe0596..d98bd9501 100644 --- a/app/views/admin/dashboard/actions/_form.html.erb +++ b/app/views/admin/dashboard/actions/_form.html.erb @@ -5,8 +5,9 @@ <%= f.label :action_type %> <% ::Dashboard::Action.action_types.keys.each do |action_type_value| %> - <%= f.radio_button :action_type, action_type_value, - data: { toggle: "request_to_administrators short_description" } %> + <%= f.radio_button :action_type, + action_type_value, + data: { toggle: "request_to_administrators short_description" } %> <% end %>
    @@ -44,18 +45,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/dashboard/actions/index.html.erb b/app/views/admin/dashboard/actions/index.html.erb index 38b4cba02..544bd5545 100644 --- a/app/views/admin/dashboard/actions/index.html.erb +++ b/app/views/admin/dashboard/actions/index.html.erb @@ -1,5 +1,6 @@ <%= link_to t("admin.dashboard.actions.index.create"), - new_admin_dashboard_action_path, class: "button success float-right" %> + new_admin_dashboard_action_path, + class: "button success float-right" %>

    <%= t("admin.dashboard.actions.index.title") %> diff --git a/app/views/admin/dashboard/administrator_tasks/index.html.erb b/app/views/admin/dashboard/administrator_tasks/index.html.erb index ff30b6d37..ce2dbf6b9 100644 --- a/app/views/admin/dashboard/administrator_tasks/index.html.erb +++ b/app/views/admin/dashboard/administrator_tasks/index.html.erb @@ -25,7 +25,8 @@

    diff --git a/app/views/admin/newsletters/index.html.erb b/app/views/admin/newsletters/index.html.erb index 46270436b..0830c09d8 100644 --- a/app/views/admin/newsletters/index.html.erb +++ b/app/views/admin/newsletters/index.html.erb @@ -1,6 +1,7 @@

    <%= t("admin.newsletters.index.title") %>

    -<%= link_to t("admin.newsletters.index.new_newsletter"), new_admin_newsletter_path, - class: "button float-right" %> +<%= link_to t("admin.newsletters.index.new_newsletter"), + new_admin_newsletter_path, + class: "button float-right" %> <% if @newsletters.any? %>
    <% unless task.executed_at? %> - <%= render Admin::TableActionsComponent.new(task, + <%= render Admin::TableActionsComponent.new( + task, actions: [:edit], edit_text: t("admin.dashboard.administrator_tasks.index.solve") ) %> diff --git a/app/views/admin/emails_download/index.html.erb b/app/views/admin/emails_download/index.html.erb index 395ff9039..3fd0f2f01 100644 --- a/app/views/admin/emails_download/index.html.erb +++ b/app/views/admin/emails_download/index.html.erb @@ -13,7 +13,7 @@ <%= select_tag :users_segment, options_for_select(user_segments_options) %> <%= submit_tag t("admin.emails_download.index.download_emails_button"), - class: "button", - data: { disable_with: false } %> + class: "button", + data: { disable_with: false } %> <% end %> diff --git a/app/views/admin/legislation/draft_versions/_form.html.erb b/app/views/admin/legislation/draft_versions/_form.html.erb index dd462837d..b3f6286a9 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 %>
    @@ -32,8 +35,8 @@
    <%= sanitize(t("admin.legislation.draft_versions.form.title", - draft_version_title: @draft_version.title, - process_title: @process.title)) %> + draft_version_title: @draft_version.title, + process_title: @process.title)) %>
    @@ -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/legislation/questions/_form.html.erb b/app/views/admin/legislation/questions/_form.html.erb index d0a0e646d..cdab0e727 100644 --- a/app/views/admin/legislation/questions/_form.html.erb +++ b/app/views/admin/legislation/questions/_form.html.erb @@ -29,7 +29,9 @@
    <%= link_to_add_association t("admin.legislation.questions.form.add_option"), - f, :question_options, class: "button hollow" %> + f, + :question_options, + class: "button hollow" %>
    diff --git a/app/views/admin/local_census_records/imports/show.html.erb b/app/views/admin/local_census_records/imports/show.html.erb index ba66a87f8..da64f5900 100644 --- a/app/views/admin/local_census_records/imports/show.html.erb +++ b/app/views/admin/local_census_records/imports/show.html.erb @@ -9,11 +9,11 @@

    <%= t("admin.local_census_records.imports.show.subtitle") %>

    <%= render "local_census_records", - title: t("admin.local_census_records.imports.show.errored"), - id: "invalid-local-census-records", - local_census_records: @import.invalid_records %> + title: t("admin.local_census_records.imports.show.errored"), + id: "invalid-local-census-records", + local_census_records: @import.invalid_records %> <%= render "local_census_records", - title: t("admin.local_census_records.imports.show.created"), - id: "created-local-census-records", - local_census_records: @import.created_records %> + title: t("admin.local_census_records.imports.show.created"), + id: "created-local-census-records", + local_census_records: @import.created_records %> diff --git a/app/views/admin/milestones/_form.html.erb b/app/views/admin/milestones/_form.html.erb index 23314333f..7198f1c93 100644 --- a/app/views/admin/milestones/_form.html.erb +++ b/app/views/admin/milestones/_form.html.erb @@ -5,9 +5,9 @@
    <%= f.select :status_id, - @statuses.map { |s| [s.name, s.id] }, - { include_blank: @statuses.any? ? "" : t("admin.milestones.form.no_statuses_defined") }, - { disabled: @statuses.blank? } %> + @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"), admin_milestone_statuses_path %>
    diff --git a/app/views/admin/milestones/_milestones.html.erb b/app/views/admin/milestones/_milestones.html.erb index 43479ce86..46940ab88 100644 --- a/app/views/admin/milestones/_milestones.html.erb +++ b/app/views/admin/milestones/_milestones.html.erb @@ -47,9 +47,9 @@ <% if milestone.documents.present? %> <% milestone.documents.each do |document| %> <%= link_to document.title, - document.attachment, - target: "_blank", - rel: "nofollow" %>
    + document.attachment, + target: "_blank", + rel: "nofollow" %>
    <% end %> <% end %>
    diff --git a/app/views/admin/newsletters/new.html.erb b/app/views/admin/newsletters/new.html.erb index b600bdd89..2c05aed24 100644 --- a/app/views/admin/newsletters/new.html.erb +++ b/app/views/admin/newsletters/new.html.erb @@ -3,8 +3,8 @@

    <%= t("admin.newsletters.new.title") %>

    <%= sanitize(t("admin.newsletters.new.header_footer_help_text", - link: link_to(t("admin.newsletters.new.image_link"), - admin_site_customization_images_path))) %> + link: link_to(t("admin.newsletters.new.image_link"), + admin_site_customization_images_path))) %>

    <%= render "form" %> diff --git a/app/views/admin/officials/search.html.erb b/app/views/admin/officials/search.html.erb index 5e361d9e7..8c5d8d013 100644 --- a/app/views/admin/officials/search.html.erb +++ b/app/views/admin/officials/search.html.erb @@ -37,7 +37,7 @@ actions: [:edit], edit_path: edit_admin_official_path(user), edit_text: (t("admin.officials.search.make_official") unless user.official?) - ) %> + ) %> <% end %> 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/poll/booth_assignments/_booth_assignment.html.erb b/app/views/admin/poll/booth_assignments/_booth_assignment.html.erb index 3da870b1f..83a68746f 100644 --- a/app/views/admin/poll/booth_assignments/_booth_assignment.html.erb +++ b/app/views/admin/poll/booth_assignments/_booth_assignment.html.erb @@ -12,7 +12,8 @@ <% 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..287899d12 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 @@ -3,8 +3,8 @@

    <%= t("mailers.new_actions_notification_on_published.hi", - name: @proposal.author.name, - title: @proposal.title) %> + name: @proposal.author.name, + title: @proposal.title) %>

    <%= t("mailers.new_actions_notification_on_published.text_1") %> @@ -49,10 +49,10 @@

    @@ -22,11 +22,13 @@

    <%= sanitize( - t("mailers.direct_message_for_receiver.unsubscribe_text", + t( + "mailers.direct_message_for_receiver.unsubscribe_text", notifications: link_to( t("mailers.config.notifications_link"), edit_subscriptions_url(token: @token), - style: css_for_mailer_link) + style: css_for_mailer_link + ) ), attributes: %w[href style] ) %> diff --git a/app/views/mailer/email_verification.html.erb b/app/views/mailer/email_verification.html.erb index fe1525a3f..d4305d77e 100644 --- a/app/views/mailer/email_verification.html.erb +++ b/app/views/mailer/email_verification.html.erb @@ -10,11 +10,13 @@

    <%= sanitize( - t("mailers.email_verification.instructions", + t( + "mailers.email_verification.instructions", verification_link: link_to( t("mailers.email_verification.click_here_to_verify"), email_url(email_verification_token: @token), - style: css_for_mailer_link) + style: css_for_mailer_link + ) ), attributes: %w[href style] ) %> diff --git a/app/views/mailer/evaluation_comment.html.erb b/app/views/mailer/evaluation_comment.html.erb index fa95263ed..c1ae1b0eb 100644 --- a/app/views/mailer/evaluation_comment.html.erb +++ b/app/views/mailer/evaluation_comment.html.erb @@ -12,8 +12,7 @@ <%= sanitize( t("mailers.evaluation_comment.new_comment_by", commenter: @email.comment.author.name, - investment: valuation_comments_link(@email.commentable) - ) + investment: valuation_comments_link(@email.commentable)) ) %>

    diff --git a/app/views/mailer/newsletter.html.erb b/app/views/mailer/newsletter.html.erb index 7b7d5130d..8c6c3dfee 100644 --- a/app/views/mailer/newsletter.html.erb +++ b/app/views/mailer/newsletter.html.erb @@ -6,7 +6,8 @@

    <%= sanitize( - t("mailers.config.unsubscribe_text", + t( + "mailers.config.unsubscribe_text", notifications: link_to( t("mailers.config.notifications_link"), edit_subscriptions_url(token: @token), diff --git a/app/views/mailer/proposal_notification_digest.html.erb b/app/views/mailer/proposal_notification_digest.html.erb index fee371793..bc2620d37 100644 --- a/app/views/mailer/proposal_notification_digest.html.erb +++ b/app/views/mailer/proposal_notification_digest.html.erb @@ -64,12 +64,14 @@

    <%= sanitize( - t("mailers.proposal_notification_digest.unsubscribe_text", + t( + "mailers.proposal_notification_digest.unsubscribe_text", notifications: link_to( t("mailers.config.notifications_link"), edit_subscriptions_url(token: @token), - style: css_for_mailer_link) - ), + style: css_for_mailer_link + ) + ), attributes: %w[href style] ) %>

    diff --git a/app/views/mailer/reply.html.erb b/app/views/mailer/reply.html.erb index c25fcb1bc..2af83667a 100644 --- a/app/views/mailer/reply.html.erb +++ b/app/views/mailer/reply.html.erb @@ -19,7 +19,8 @@

    <%= sanitize( - t("mailers.config.unsubscribe_text", + t( + "mailers.config.unsubscribe_text", notifications: link_to( t("mailers.config.notifications_link"), edit_subscriptions_url(token: @token), diff --git a/app/views/mailer/user_invite.html.erb b/app/views/mailer/user_invite.html.erb index aa435ec9d..0b5151fb3 100644 --- a/app/views/mailer/user_invite.html.erb +++ b/app/views/mailer/user_invite.html.erb @@ -1,12 +1,10 @@

    + officing_poll_ballot_sheet_path(@poll.id, ballot_sheet.id) %> diff --git a/app/views/officing/ballot_sheets/new.html.erb b/app/views/officing/ballot_sheets/new.html.erb index 4fbc871ca..c4a159a1f 100644 --- a/app/views/officing/ballot_sheets/new.html.erb +++ b/app/views/officing/ballot_sheets/new.html.erb @@ -4,8 +4,8 @@ <%= form_tag(officing_poll_ballot_sheets_path(@poll)) do %> <%= label_tag :officer_assignment_id, t("officing.poll_budgets.new.booth") %> <%= select_tag :officer_assignment_id, - booths_for_officer_select_options(@officer_assignments), - { prompt: t("officing.poll_budgets.new.select_booth") } %> + booths_for_officer_select_options(@officer_assignments), + { prompt: t("officing.poll_budgets.new.select_booth") } %> <%= label_tag :data, t("officing.poll_budgets.new.csv_data") %> <%= text_area_tag :data, nil, rows: 10 %> diff --git a/app/views/officing/results/new.html.erb b/app/views/officing/results/new.html.erb index 9b2855133..06f49a251 100644 --- a/app/views/officing/results/new.html.erb +++ b/app/views/officing/results/new.html.erb @@ -6,8 +6,8 @@
    <%= select_tag :officer_assignment_id, - booths_for_officer_select_options(@officer_assignments), - { prompt: t("officing.results.new.select_booth") } %> + booths_for_officer_select_options(@officer_assignments), + { prompt: t("officing.results.new.select_booth") } %>
    diff --git a/app/views/officing/voters/_can_vote.html.erb b/app/views/officing/voters/_can_vote.html.erb index 0d01f97fe..c866b6562 100644 --- a/app/views/officing/voters/_can_vote.html.erb +++ b/app/views/officing/voters/_can_vote.html.erb @@ -4,9 +4,11 @@

    <% unless @poll.expired? %> - <%= render Admin::TableActionsComponent.new(booth_assignment, + <%= render Admin::TableActionsComponent.new( + booth_assignment, actions: [:destroy], destroy_text: t("admin.booth_assignments.manage.actions.unassign"), destroy_confirmation: (booth_assignment.shifts? ? t("admin.poll_booth_assignments.alert.shifts") : ""), diff --git a/app/views/admin/poll/polls/_poll.html.erb b/app/views/admin/poll/polls/_poll.html.erb index 80b64d43c..9d692b867 100644 --- a/app/views/admin/poll/polls/_poll.html.erb +++ b/app/views/admin/poll/polls/_poll.html.erb @@ -7,7 +7,8 @@ <%= poll.sdg_target_list %> - <%= render Admin::TableActionsComponent.new(poll, + <%= render Admin::TableActionsComponent.new( + poll, destroy_confirmation: t("admin.polls.destroy.alert") ) do |actions| %> <%= actions.action(:configure) %> diff --git a/app/views/admin/poll/questions/answers/_form.html.erb b/app/views/admin/poll/questions/answers/_form.html.erb index ef32b93e5..7ecc89c8c 100644 --- a/app/views/admin/poll/questions/answers/_form.html.erb +++ b/app/views/admin/poll/questions/answers/_form.html.erb @@ -5,7 +5,7 @@ <%= render "shared/errors", resource: @answer %> <%= f.hidden_field :given_order, - value: @answer.persisted? ? @answer.given_order : @answer.class.last_position(@answer.question_id || @question.id) + 1 %> + value: @answer.persisted? ? @answer.given_order : @answer.class.last_position(@answer.question_id || @question.id) + 1 %>
    <%= f.translatable_fields do |translations_form| %> diff --git a/app/views/admin/poll/shifts/_form.html.erb b/app/views/admin/poll/shifts/_form.html.erb index c60458759..2c0fc6249 100644 --- a/app/views/admin/poll/shifts/_form.html.erb +++ b/app/views/admin/poll/shifts/_form.html.erb @@ -14,29 +14,29 @@
    <%= f.select :task, - Poll::Shift.tasks.map { |k, v| [t("admin.poll_shifts.#{k}"), k] }, - { prompt: t("admin.poll_shifts.new.select_task") }, - class: "js-poll-shifts" %> + Poll::Shift.tasks.map { |k, v| [t("admin.poll_shifts.#{k}"), k] }, + { prompt: t("admin.poll_shifts.new.select_task") }, + class: "js-poll-shifts" %>
    <%= select "shift[date]", "vote_collection_date", - options_for_select(shift_vote_collection_dates(@booth, @voting_polls)), - { prompt: @voting_polls.present? ? t("admin.poll_shifts.new.select_date") : t("admin.poll_shifts.new.no_voting_days") }, - class: "js-shift-vote-collection-dates" %> + options_for_select(shift_vote_collection_dates(@booth, @voting_polls)), + { prompt: @voting_polls.present? ? t("admin.poll_shifts.new.select_date") : t("admin.poll_shifts.new.no_voting_days") }, + class: "js-shift-vote-collection-dates" %> <%= select "shift[date]", "recount_scrutiny_date", - options_for_select(shift_recount_scrutiny_dates(@booth, @recount_polls)), - { prompt: t("admin.poll_shifts.new.select_date") }, - class: "js-shift-recount-scrutiny-dates", - hidden: "hidden" %> + options_for_select(shift_recount_scrutiny_dates(@booth, @recount_polls)), + { prompt: t("admin.poll_shifts.new.select_date") }, + class: "js-shift-recount-scrutiny-dates", + hidden: "hidden" %>
    <%= f.hidden_field :booth_id, value: @booth.id %>
    <%= f.submit t("admin.poll_shifts.new.add_shift"), - class: "button expanded margin-top" %> + class: "button expanded margin-top" %>
    <% end %> diff --git a/app/views/admin/poll/shifts/_search_officers.html.erb b/app/views/admin/poll/shifts/_search_officers.html.erb index e95090f9c..4a601c852 100644 --- a/app/views/admin/poll/shifts/_search_officers.html.erb +++ b/app/views/admin/poll/shifts/_search_officers.html.erb @@ -3,9 +3,9 @@ method: :get, remote: true do |f| %>
    <%= text_field_tag :search, - @search, - placeholder: t("admin.poll_shifts.new.search_officer_placeholder"), - id: "search-officers" %> + @search, + placeholder: t("admin.poll_shifts.new.search_officer_placeholder"), + id: "search-officers" %>
    <%= submit_tag t("admin.poll_shifts.new.search_officer_button"), class: "button" %> diff --git a/app/views/admin/poll/shifts/_shifts.html.erb b/app/views/admin/poll/shifts/_shifts.html.erb index d3cda31fb..c8d884b6d 100644 --- a/app/views/admin/poll/shifts/_shifts.html.erb +++ b/app/views/admin/poll/shifts/_shifts.html.erb @@ -17,7 +17,8 @@
    <%= shift.officer_email %> <%= t("admin.poll_shifts.#{shift.task}") %> - <%= render Admin::TableActionsComponent.new(shift, + <%= render Admin::TableActionsComponent.new( + shift, actions: [:destroy], destroy_text: t("admin.poll_shifts.new.remove_shift") ) %> diff --git a/app/views/admin/settings/_content_types_settings_form.html.erb b/app/views/admin/settings/_content_types_settings_form.html.erb index 4c3cb347b..458f9d8e8 100644 --- a/app/views/admin/settings/_content_types_settings_form.html.erb +++ b/app/views/admin/settings/_content_types_settings_form.html.erb @@ -6,8 +6,8 @@ <% Setting.mime_types[group].each do |content_type, mime_type_value| %> <%= check_box_tag content_type, - setting.value.split.include?(mime_type_value), - setting.value.split.include?(mime_type_value) %> + setting.value.split.include?(mime_type_value), + setting.value.split.include?(mime_type_value) %> <%= label_tag content_type, content_type.upcase %> <% end %> diff --git a/app/views/admin/settings/_map_form.html.erb b/app/views/admin/settings/_map_form.html.erb index 8c85666f7..c71b412a0 100644 --- a/app/views/admin/settings/_map_form.html.erb +++ b/app/views/admin/settings/_map_form.html.erb @@ -23,7 +23,7 @@
    <%= submit_tag t("admin.settings.index.map.form.submit"), - class: "button hollow expanded" %> + class: "button hollow expanded" %>
    <% end %> diff --git a/app/views/admin/settings/_settings_form.html.erb b/app/views/admin/settings/_settings_form.html.erb index 33e9ab8f1..464713004 100644 --- a/app/views/admin/settings/_settings_form.html.erb +++ b/app/views/admin/settings/_settings_form.html.erb @@ -2,10 +2,10 @@ <%= f.hidden_field :tab, id: dom_id(setting, :tab), value: tab if defined?(tab) %>
    <%= f.text_area :value, - label: false, - id: dom_id(setting, :value), - "aria-label": strip_tags(t("settings.#{setting.key}")), - "aria-describedby": dom_id(setting, :description) %> + label: false, + id: dom_id(setting, :value), + "aria-label": strip_tags(t("settings.#{setting.key}")), + "aria-describedby": dom_id(setting, :description) %>
    <%= f.submit(t("admin.settings.index.update_setting"), class: "button hollow expanded") %> diff --git a/app/views/admin/shared/_budget_investment_search.html.erb b/app/views/admin/shared/_budget_investment_search.html.erb index 86f77dfc5..7e9d3d082 100644 --- a/app/views/admin/shared/_budget_investment_search.html.erb +++ b/app/views/admin/shared/_budget_investment_search.html.erb @@ -5,9 +5,9 @@
    <%= select_tag :heading_id, - options_for_select(budget_heading_select_options(@budget), - params[:heading_id]), - include_blank: true %> + options_for_select(budget_heading_select_options(@budget), + params[:heading_id]), + include_blank: true %>
    diff --git a/app/views/admin/signature_sheets/new.html.erb b/app/views/admin/signature_sheets/new.html.erb index aa81aa5fd..70ab8ab49 100644 --- a/app/views/admin/signature_sheets/new.html.erb +++ b/app/views/admin/signature_sheets/new.html.erb @@ -4,7 +4,7 @@ <%= form_for [:admin, @signature_sheet] do |f| %> <%= render "shared/errors", - resource: @signature_sheet %> + resource: @signature_sheet %>
    <%= f.text_field :title %> @@ -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/signature_sheets/show.html.erb b/app/views/admin/signature_sheets/show.html.erb index 1b235ae2c..b4446c77e 100644 --- a/app/views/admin/signature_sheets/show.html.erb +++ b/app/views/admin/signature_sheets/show.html.erb @@ -21,12 +21,12 @@
    <%= t("admin.signature_sheets.show.verified", - count: @signature_sheet.signatures.verified.count) %> + count: @signature_sheet.signatures.verified.count) %>
    <%= t("admin.signature_sheets.show.voted", - count: @voted_signatures) %> + count: @voted_signatures) %>
    @@ -35,7 +35,7 @@

    <%= t("admin.signature_sheets.show.unverified", - count: @signature_sheet.signatures.unverified.count) %> + count: @signature_sheet.signatures.unverified.count) %> <%= t("admin.signature_sheets.show.unverified_error") %>

    diff --git a/app/views/admin/site_customization/information_texts/_globalize_locales.html.erb b/app/views/admin/site_customization/information_texts/_globalize_locales.html.erb index ef93a7ae7..da4297ad1 100644 --- a/app/views/admin/site_customization/information_texts/_globalize_locales.html.erb +++ b/app/views/admin/site_customization/information_texts/_globalize_locales.html.erb @@ -1,4 +1,4 @@ <%= render "shared/common_globalize_locales", - resource: nil, - display_style: lambda { |locale| site_customization_display_translation_style(locale) }, - manage_languages: defined?(manage_languages) ? manage_languages : true %> + resource: nil, + display_style: lambda { |locale| site_customization_display_translation_style(locale) }, + manage_languages: defined?(manage_languages) ? manage_languages : true %> 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/stats/show.html.erb b/app/views/admin/stats/show.html.erb index 8a633637c..f5fa82d3c 100644 --- a/app/views/admin/stats/show.html.erb +++ b/app/views/admin/stats/show.html.erb @@ -13,9 +13,9 @@ <%= link_to t("admin.stats.show.proposal_notifications"), proposal_notifications_admin_stats_path, class: "button hollow" %> <%= link_to t("admin.stats.show.incomplete_verifications"), - admin_verifications_path, class: "button hollow" %> + admin_verifications_path, class: "button hollow" %> <%= link_to t("admin.stats.show.sdg"), - sdg_admin_stats_path, class: "button hollow" if feature?(:sdg) %> + sdg_admin_stats_path, class: "button hollow" if feature?(:sdg) %>
    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..fa02ac0a5 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 @@ -31,10 +31,10 @@ <%= 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), - method: :put, - class: "button hollow float-right" %> + admin_system_email_moderate_pending_path(system_email_id: "proposal_notification_digest", + id: preview.id), + method: :put, + class: "button hollow float-right" %>
    <% end %> diff --git a/app/views/admin/tags/index.html.erb b/app/views/admin/tags/index.html.erb index 39583f933..8c0262f08 100644 --- a/app/views/admin/tags/index.html.erb +++ b/app/views/admin/tags/index.html.erb @@ -22,11 +22,11 @@
    <%= form_for(tag, - url: admin_tag_path(tag), - as: :tag, - html: { id: "edit_tag_#{tag.id}" }) do |f| %> + url: admin_tag_path(tag), + as: :tag, + html: { id: "edit_tag_#{tag.id}" }) do |f| %> - <%= tag.name %> + <%= tag.name %> <% end %> diff --git a/app/views/budgets/executions/show.html.erb b/app/views/budgets/executions/show.html.erb index acb4f3822..dcbfe24f6 100644 --- a/app/views/budgets/executions/show.html.erb +++ b/app/views/budgets/executions/show.html.erb @@ -2,9 +2,9 @@ <% content_for :meta_description do %><%= @budget.description_for_phase("finished") %><% end %> <% provide :social_media_meta_tags do %> <%= render "shared/social_media_meta_tags", - social_url: budget_executions_url(@budget), - social_title: @budget.name, - social_description: @budget.description_for_phase("finished") %> + social_url: budget_executions_url(@budget), + social_title: @budget.name, + social_description: @budget.description_for_phase("finished") %> <% end %> <% content_for :canonical do %> diff --git a/app/views/budgets/investments/_header.html.erb b/app/views/budgets/investments/_header.html.erb index 5f1ab18b8..cd30b56b1 100644 --- a/app/views/budgets/investments/_header.html.erb +++ b/app/views/budgets/investments/_header.html.erb @@ -37,12 +37,12 @@
    <%= sanitize(t("budgets.investments.header.different_heading_assigned", - heading_link: heading_link(@assigned_heading, @budget))) %> + heading_link: heading_link(@assigned_heading, @budget))) %>
    <%= sanitize(t("budgets.investments.header.change_ballot", - check_ballot: link_to(t("budgets.investments.header.check_ballot_link"), - budget_ballot_path(@budget)))) %> + check_ballot: link_to(t("budgets.investments.header.check_ballot_link"), + budget_ballot_path(@budget)))) %>
    diff --git a/app/views/budgets/investments/_investment.html.erb b/app/views/budgets/investments/_investment.html.erb index 1a4009952..2f67a5a9a 100644 --- a/app/views/budgets/investments/_investment.html.erb +++ b/app/views/budgets/investments/_investment.html.erb @@ -42,7 +42,7 @@
    <%= t("budgets.investments.investment.supports", - count: investment.total_votes) %> + count: investment.total_votes) %>
    @@ -50,9 +50,9 @@
    <%= render "/budgets/investments/ballot", - investment: investment, - investment_ids: investment_ids, - ballot: ballot %> + investment: investment, + investment_ids: investment_ids, + ballot: ballot %>
    <% elsif investment.should_show_price? %>
    <%= render "documents/documents", - documents: investment.documents, - max_documents_allowed: Budget::Investment.max_documents_allowed %> + documents: investment.documents, + max_documents_allowed: Budget::Investment.max_documents_allowed %> <% end %> <%= render "shared/tags", taggable: investment %> diff --git a/app/views/budgets/investments/_investment_show.html.erb b/app/views/budgets/investments/_investment_show.html.erb index aec6ec3b5..10e1fd18c 100644 --- a/app/views/budgets/investments/_investment_show.html.erb +++ b/app/views/budgets/investments/_investment_show.html.erb @@ -1,10 +1,10 @@ <% provide :social_media_meta_tags do %> <%= render "shared/social_media_meta_tags", - social_url: budget_investments_path(investment), - social_title: investment.title, - social_description: investment.description, - twitter_image_url: (investment.image.present? ? polymorphic_path(investment.image.variant(:thumb)) : nil), - og_image_url: (investment.image.present? ? polymorphic_path(investment.image.variant(:thumb)) : nil) %> + social_url: budget_investments_path(investment), + social_title: investment.title, + social_description: investment.description, + twitter_image_url: (investment.image.present? ? polymorphic_path(investment.image.variant(:thumb)) : nil), + og_image_url: (investment.image.present? ? polymorphic_path(investment.image.variant(:thumb)) : nil) %> <% end %>
    @@ -39,7 +39,7 @@ <%= t("budgets.investments.investment.supports", - count: investment.total_votes) %> + count: investment.total_votes) %>
    @@ -49,9 +49,9 @@
    <%= render "ballot", - investment: investment, - investment_ids: investment_ids, - ballot: ballot %> + investment: investment, + investment_ids: investment_ids, + ballot: ballot %>
    <% end %> @@ -93,22 +93,23 @@ <% if investment.should_show_price_explanation? %>
    <%= link_to t("budgets.investments.show.see_price_explanation"), - "#price_explanation", class: "small" %> + "#price_explanation", + class: "small" %>
    <% end %> <% end %> <%= render "shared/social_share", - share_title: t("budgets.investments.show.share"), - title: investment.title, - image_url: image_absolute_url(investment.image, :thumb), - url: budget_investment_url(investment.budget, investment), - description: t("budgets.investments.share.message", - title: investment.title, - handle: setting["org_name"]), - mobile: t("budgets.investments.share.message", - title: investment.title, - handle: setting["twitter_handle"]) %> + share_title: t("budgets.investments.show.share"), + title: investment.title, + image_url: image_absolute_url(investment.image, :thumb), + url: budget_investment_url(investment.budget, investment), + description: t("budgets.investments.share.message", + title: investment.title, + handle: setting["org_name"]), + mobile: t("budgets.investments.share.message", + title: investment.title, + handle: setting["twitter_handle"]) %> <% if current_user %> diff --git a/app/views/budgets/investments/_sidebar.html.erb b/app/views/budgets/investments/_sidebar.html.erb index 9aba3eeb1..a822c2efd 100644 --- a/app/views/budgets/investments/_sidebar.html.erb +++ b/app/views/budgets/investments/_sidebar.html.erb @@ -3,11 +3,12 @@ <% if can?(:create, Budget::Investment.new(budget: @budget)) %> <% if current_user && current_user.level_two_or_three_verified? %> <%= link_to t("budgets.investments.index.sidebar.create"), - new_budget_investment_path(budget_id: @budget.id), class: "button budget expanded" %> + new_budget_investment_path(budget_id: @budget.id), + class: "button budget expanded" %> <% else %>
    <%= sanitize(t("budgets.investments.index.sidebar.verified_only", - verify: link_to_verify_account)) %> + verify: link_to_verify_account)) %>
    <% end %> <% end %> diff --git a/app/views/budgets/investments/index.html.erb b/app/views/budgets/investments/index.html.erb index 99e47d0c9..08a481d6d 100644 --- a/app/views/budgets/investments/index.html.erb +++ b/app/views/budgets/investments/index.html.erb @@ -7,9 +7,9 @@ <% content_for :canonical do %> <% if @heading.present? %> <%= render "shared/canonical", - href: budget_investments_url(@budget, - heading_id: @heading.id, - filter: @current_filter) %> + href: budget_investments_url(@budget, + heading_id: @heading.id, + filter: @current_filter) %> <% else %> <%= render "shared/canonical", href: budget_investments_url(@budget) %> <% end %> diff --git a/app/views/budgets/investments/show.html.erb b/app/views/budgets/investments/show.html.erb index 042e70d46..d3e4cdb8d 100644 --- a/app/views/budgets/investments/show.html.erb +++ b/app/views/budgets/investments/show.html.erb @@ -4,9 +4,9 @@ <% end %> <%= render "/budgets/investments/investment_show", - investment: @investment, - investment_ids: @investment_ids, - ballot: @ballot %> + investment: @investment, + investment_ids: @investment_ids, + ballot: @ballot %>
    diff --git a/app/views/budgets/results/show.html.erb b/app/views/budgets/results/show.html.erb index 605309c1b..aedae4faf 100644 --- a/app/views/budgets/results/show.html.erb +++ b/app/views/budgets/results/show.html.erb @@ -2,9 +2,9 @@ <% content_for :meta_description do %><%= @budget.description_for_phase("finished") %><% end %> <% provide :social_media_meta_tags do %> <%= render "shared/social_media_meta_tags", - social_url: budget_results_url(@budget), - social_title: @budget.name, - social_description: @budget.description_for_phase("finished") %> + social_url: budget_results_url(@budget), + social_title: @budget.name, + social_description: @budget.description_for_phase("finished") %> <% end %> <% content_for :canonical do %> <%= render "shared/canonical", href: budget_results_url(@budget) %> diff --git a/app/views/budgets/stats/show.html.erb b/app/views/budgets/stats/show.html.erb index 5ad9e09ba..be60f24c4 100644 --- a/app/views/budgets/stats/show.html.erb +++ b/app/views/budgets/stats/show.html.erb @@ -3,9 +3,9 @@ <% end %> <% provide :social_media_meta_tags do %> <%= render "shared/social_media_meta_tags", - social_url: budget_stats_url(@budget), - social_title: @budget.name, - social_description: @budget.description_for_phase("finished") %> + social_url: budget_stats_url(@budget), + social_title: @budget.name, + social_description: @budget.description_for_phase("finished") %> <% end %>
    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/comments/_form.html.erb b/app/views/comments/_form.html.erb index 41b5e61eb..17813cace 100644 --- a/app/views/comments/_form.html.erb +++ b/app/views/comments/_form.html.erb @@ -4,9 +4,9 @@
    <%= form_for Comment.new, remote: true, html: { id: "new_comment_#{css_id}" } do |f| %> <%= f.text_area :body, - id: "comment-body-#{css_id}", - maxlength: Comment.body_max_length, - label: leave_comment_text(commentable) %> + id: "comment-body-#{css_id}", + maxlength: Comment.body_max_length, + label: leave_comment_text(commentable) %> <%= f.hidden_field :commentable_type, value: commentable.class.name, id: "comment_commentable_type_#{css_id}" %> <%= f.hidden_field :commentable_id, value: commentable.id, id: "comment_commentable_id_#{css_id}" %> @@ -18,15 +18,15 @@ <% if can? :comment_as_moderator, commentable %>
    <%= f.check_box :as_moderator, - label: t("comments.form.comment_as_moderator"), - id: "comment-as-moderator-#{css_id}" %> + label: t("comments.form.comment_as_moderator"), + id: "comment-as-moderator-#{css_id}" %>
    <% end %> <% if can? :comment_as_administrator, commentable %>
    <%= f.check_box :as_administrator, - label: t("comments.form.comment_as_admin"), - id: "comment-as-administrator-#{css_id}" %> + label: t("comments.form.comment_as_admin"), + id: "comment-as-administrator-#{css_id}" %>
    <% end %> diff --git a/app/views/communities/_poll.html.erb b/app/views/communities/_poll.html.erb index 22825a981..52bfe6764 100644 --- a/app/views/communities/_poll.html.erb +++ b/app/views/communities/_poll.html.erb @@ -5,6 +5,7 @@

    <%= t("communities.poll.take_part", - from: l(poll.starts_at.to_date), to: l(poll.ends_at.to_date)) %> + from: l(poll.starts_at.to_date), + to: l(poll.ends_at.to_date)) %>

    diff --git a/app/views/dashboard/_goal.html.erb b/app/views/dashboard/_goal.html.erb index b100e1952..2c51072aa 100644 --- a/app/views/dashboard/_goal.html.erb +++ b/app/views/dashboard/_goal.html.erb @@ -2,8 +2,8 @@
    <%= t("dashboard.goal.target_supports", - count: number_with_precision(goal.required_supports, - delimiter: ".", precision: 0)) %> + count: number_with_precision(goal.required_supports, + delimiter: ".", precision: 0)) %>
    diff --git a/app/views/dashboard/_mailing_resource.html.erb b/app/views/dashboard/_mailing_resource.html.erb index ed85a5642..2ec0beb40 100644 --- a/app/views/dashboard/_mailing_resource.html.erb +++ b/app/views/dashboard/_mailing_resource.html.erb @@ -8,8 +8,8 @@
    <%= link_to t("dashboard.resource.view_resource"), - new_proposal_dashboard_mailing_path(proposal.to_param), - class: "button expanded" %> + new_proposal_dashboard_mailing_path(proposal.to_param), + class: "button expanded" %>
    diff --git a/app/views/dashboard/_menu.html.erb b/app/views/dashboard/_menu.html.erb index 29dea1ad5..f43835c5a 100644 --- a/app/views/dashboard/_menu.html.erb +++ b/app/views/dashboard/_menu.html.erb @@ -38,7 +38,7 @@ <%= link_to proposal_dashboard_polls_path(proposal), class: ("submenu-active" if polls_menu_active?) do %> "> + t("dashboard.menu.polls") %>"> <%= t("dashboard.menu.polls") %> <% end %> @@ -50,7 +50,7 @@ <%= link_to new_proposal_dashboard_mailing_path(proposal), class: ("submenu-active" if mailing_menu_active?) do %> "> + t("dashboard.menu.mailing") %>"> <%= t("dashboard.menu.mailing") %> <% end %> @@ -62,7 +62,7 @@ <%= link_to new_proposal_dashboard_poster_path(proposal), class: ("submenu-active" if poster_menu_active?) do %> "> + t("dashboard.menu.poster") %>"> <%= t("dashboard.menu.poster") %> <% end %> diff --git a/app/views/dashboard/_poll_resource.html.erb b/app/views/dashboard/_poll_resource.html.erb index 5a02a4466..39d21ea8e 100644 --- a/app/views/dashboard/_poll_resource.html.erb +++ b/app/views/dashboard/_poll_resource.html.erb @@ -8,8 +8,8 @@
    <%= link_to t("dashboard.resource.view_resource"), - proposal_dashboard_polls_path(proposal.to_param), - class: "button expanded" %> + proposal_dashboard_polls_path(proposal.to_param), + class: "button expanded" %>
    diff --git a/app/views/dashboard/_poster_resource.html.erb b/app/views/dashboard/_poster_resource.html.erb index 85f2c27bf..0f47d6c32 100644 --- a/app/views/dashboard/_poster_resource.html.erb +++ b/app/views/dashboard/_poster_resource.html.erb @@ -8,8 +8,8 @@
    <%= link_to t("dashboard.resource.view_resource"), - new_proposal_dashboard_poster_path(proposal.to_param), - class: "button expanded" %> + new_proposal_dashboard_poster_path(proposal.to_param), + class: "button expanded" %>
    diff --git a/app/views/dashboard/community.html.erb b/app/views/dashboard/community.html.erb index b23137339..cdf57a365 100644 --- a/app/views/dashboard/community.html.erb +++ b/app/views/dashboard/community.html.erb @@ -9,7 +9,7 @@ <% if proposal.community.latest_activity.present? %>

    <%= t("dashboard.community.latest_activity", - at: l(proposal.community.latest_activity.to_date)) %> + at: l(proposal.community.latest_activity.to_date)) %>

    <% 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 %>
    <%= link_to progress_proposal_dashboard_url(@proposal), - style: "font-family: 'Open Sans',arial,sans-serif; background: #3700fd; - 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;", + style: "font-family: 'Open Sans',arial,sans-serif; background: #3700fd;" \ + "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 %> <%= t("mailers.new_actions_notification_on_published.dashboard_button") %> <% end %> diff --git a/app/views/dashboard/polls/_form.html.erb b/app/views/dashboard/polls/_form.html.erb index 6a74ad95c..d39a8070b 100644 --- a/app/views/dashboard/polls/_form.html.erb +++ b/app/views/dashboard/polls/_form.html.erb @@ -8,16 +8,16 @@
    <%= f.text_field :starts_at, - autocomplete: "off", - value: poll.starts_at.present? ? l(poll.starts_at.to_date) : nil, - class: "js-calendar-full" %> + autocomplete: "off", + value: poll.starts_at.present? ? l(poll.starts_at.to_date) : nil, + class: "js-calendar-full" %>
    <%= f.text_field :ends_at, - autocomplete: "off", - value: poll.ends_at.present? ? l(poll.ends_at.to_date) : nil, - class: "js-calendar-full" %> + autocomplete: "off", + value: poll.ends_at.present? ? l(poll.ends_at.to_date) : nil, + class: "js-calendar-full" %>
    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/debates/_actions.html.erb b/app/views/debates/_actions.html.erb index 3605d3fcf..d3e64148b 100644 --- a/app/views/debates/_actions.html.erb +++ b/app/views/debates/_actions.html.erb @@ -4,9 +4,15 @@  |  <% if debate.featured? %> <%= link_to t("admin.actions.unmark_featured").capitalize, unmark_featured_debate_path(debate), - method: :put, data: { confirm: t("admin.actions.confirm_action", action: t("admin.actions.unmark_featured"), name: debate.title) } %> + method: :put, + data: { confirm: t("admin.actions.confirm_action", + action: t("admin.actions.unmark_featured"), + name: debate.title) } %> <% else %> <%= link_to t("admin.actions.mark_featured").capitalize, mark_featured_debate_path(debate), - method: :put, data: { confirm: t("admin.actions.confirm_action", action: t("admin.actions.mark_featured"), name: debate.title) } %> + method: :put, + data: { confirm: t("admin.actions.confirm_action", + action: t("admin.actions.mark_featured"), + name: debate.title) } %> <% end %> <% end %> diff --git a/app/views/debates/index.html.erb b/app/views/debates/index.html.erb index 08647fee1..6e51a2b5e 100644 --- a/app/views/debates/index.html.erb +++ b/app/views/debates/index.html.erb @@ -69,7 +69,7 @@

    <%= t("debates.index.section_footer.description") %>

    <%= t("debates.index.section_footer.help_text_1") %>

    <%= sanitize(t("debates.index.section_footer.help_text_2", - org: link_to(setting["org_name"], new_user_registration_path))) %>

    + org: link_to(setting["org_name"], new_user_registration_path))) %>

    <% end %> diff --git a/app/views/debates/show.html.erb b/app/views/debates/show.html.erb index 52f6dd160..52146ee68 100644 --- a/app/views/debates/show.html.erb +++ b/app/views/debates/show.html.erb @@ -60,11 +60,11 @@ <%= render "debates/votes", debate: @debate %> <%= render "shared/social_share", - share_title: t("debates.show.share"), - title: @debate.title, - url: debate_url(@debate), - description: @debate.title, - mobile: @debate.title %> + share_title: t("debates.show.share"), + title: @debate.title, + url: debate_url(@debate), + description: @debate.title, + mobile: @debate.title %> diff --git a/app/views/devise/confirmations/show.html.erb b/app/views/devise/confirmations/show.html.erb index b6c7d5729..4024802a2 100644 --- a/app/views/devise/confirmations/show.html.erb +++ b/app/views/devise/confirmations/show.html.erb @@ -15,12 +15,12 @@
    <%= f.password_field :password, - autofocus: true, - label: t("devise_views.confirmations.show.new_password_label") %> + autofocus: true, + label: t("devise_views.confirmations.show.new_password_label") %>
    <%= f.password_field :password_confirmation, - label: t("devise_views.confirmations.show.new_password_confirmation_label") %> + label: t("devise_views.confirmations.show.new_password_confirmation_label") %>
    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/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb index 0ed59c5ca..968d64321 100644 --- a/app/views/devise/sessions/new.html.erb +++ b/app/views/devise/sessions/new.html.erb @@ -5,7 +5,7 @@

    <%= sanitize(t("devise_views.shared.links.signup", - signup_link: link_to(t("devise_views.shared.links.signup_link"), new_user_registration_path))) %> + signup_link: link_to(t("devise_views.shared.links.signup_link"), new_user_registration_path))) %>

    <%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %> 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/direct_messages/new.html.erb b/app/views/direct_messages/new.html.erb index 8c0635a26..1343f6363 100644 --- a/app/views/direct_messages/new.html.erb +++ b/app/views/direct_messages/new.html.erb @@ -10,7 +10,8 @@

    <%= sanitize(t("users.login_to_continue", - signin: link_to_signin, signup: link_to_signup)) %> + signin: link_to_signin, + signup: link_to_signup)) %>

    <% elsif not @receiver.email_on_direct_message? %> @@ -34,7 +35,7 @@

    <%= sanitize(t("users.direct_messages.new.verified_only", - verify_account: link_to_verify_account)) %> + verify_account: link_to_verify_account)) %>

    <% end %> diff --git a/app/views/direct_messages/show.html.erb b/app/views/direct_messages/show.html.erb index 7a3ce847a..7ee6abb87 100644 --- a/app/views/direct_messages/show.html.erb +++ b/app/views/direct_messages/show.html.erb @@ -6,7 +6,7 @@
    <%= t("users.direct_messages.show.receiver", - receiver: @direct_message.receiver.name) %> + receiver: @direct_message.receiver.name) %>

    <%= @direct_message.title %>

    diff --git a/app/views/documents/_document.html.erb b/app/views/documents/_document.html.erb index 977e3acc4..a2a244933 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 %>
    @@ -13,9 +15,9 @@ <% if can?(:destroy, document) %>
    <%= link_to t("documents.buttons.destroy_document"), - document, - method: :delete, - data: { confirm: t("documents.actions.destroy.confirm") }, - class: "delete" %> + document, + method: :delete, + data: { confirm: t("documents.actions.destroy.confirm") }, + class: "delete" %> <% end %>
  • diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 1f7e0e617..8cdffdce9 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -5,9 +5,9 @@ <%= render "layouts/meta_tags" %> <%= content_for :canonical %> <%= favicon_link_tag image_path_for("apple-touch-icon-200.png"), - rel: "icon apple-touch-icon", - sizes: "200x200", - type: "image/png" %> + rel: "icon apple-touch-icon", + sizes: "200x200", + type: "image/png" %> <%= content_for :social_media_meta_tags %> <%= raw setting["html.per_page_code_head"] %> @@ -28,11 +28,14 @@

    <%= t("layouts.application.ie_title") %>

    <%= sanitize(t("layouts.application.ie", - chrome: link_to( - t("layouts.application.chrome"), "https://www.google.com/chrome/browser/desktop/", title: t("shared.target_blank"), target: "_blank"), - firefox: link_to( - t("layouts.application.firefox"), "https://www.mozilla.org/firefox", title: t("shared.target_blank"), target: "_blank") - )) %> + chrome: link_to(t("layouts.application.chrome"), + "https://www.google.com/chrome/browser/desktop/", + title: t("shared.target_blank"), + target: "_blank"), + firefox: link_to(t("layouts.application.firefox"), + "https://www.mozilla.org/firefox", + title: t("shared.target_blank"), + target: "_blank"))) %>

    diff --git a/app/views/layouts/dashboard.html.erb b/app/views/layouts/dashboard.html.erb index ffdfc9439..77f42bdcc 100644 --- a/app/views/layouts/dashboard.html.erb +++ b/app/views/layouts/dashboard.html.erb @@ -5,9 +5,9 @@ <%= render "layouts/meta_tags" %> <%= content_for :canonical %> <%= favicon_link_tag image_path_for("apple-touch-icon-200.png"), - rel: "icon apple-touch-icon", - sizes: "200x200", - type: "image/png" %> + rel: "icon apple-touch-icon", + sizes: "200x200", + type: "image/png" %> <%= content_for :social_media_meta_tags %> <%= raw setting["per_page_code_head"] %> diff --git a/app/views/legislation/annotations/_comments.html.erb b/app/views/legislation/annotations/_comments.html.erb index ea746bac0..aad5a4248 100644 --- a/app/views/legislation/annotations/_comments.html.erb +++ b/app/views/legislation/annotations/_comments.html.erb @@ -1,5 +1,8 @@ -<% annotation.comments.roots.sort_by_most_voted. - limit(Legislation::Annotation::COMMENTS_PAGE_SIZE).each do |comment| %> +<% annotation.comments + .roots + .sort_by_most_voted + .limit(Legislation::Annotation::COMMENTS_PAGE_SIZE) + .each do |comment| %>

    <%= truncate comment.body, length: 250 %>

    diff --git a/app/views/legislation/annotations/_comments_box.html.erb b/app/views/legislation/annotations/_comments_box.html.erb index c33429e07..8b06813d9 100644 --- a/app/views/legislation/annotations/_comments_box.html.erb +++ b/app/views/legislation/annotations/_comments_box.html.erb @@ -23,10 +23,10 @@ diff --git a/app/views/legislation/draft_versions/show.html.erb b/app/views/legislation/draft_versions/show.html.erb index f4f1ad0ed..e42bb0920 100644 --- a/app/views/legislation/draft_versions/show.html.erb +++ b/app/views/legislation/draft_versions/show.html.erb @@ -25,7 +25,7 @@ <% end %>
    <%= t("legislation.draft_versions.show.updated_at", - date: format_date(@draft_version.updated_at)) %> + date: format_date(@draft_version.updated_at)) %>
    <% unless @draft_version.final_version? %> diff --git a/app/views/legislation/processes/_header.html.erb b/app/views/legislation/processes/_header.html.erb index eb05108a5..0e38798d8 100644 --- a/app/views/legislation/processes/_header.html.erb +++ b/app/views/legislation/processes/_header.html.erb @@ -3,9 +3,10 @@
    <% if banner_color? %> - <%= link_to t("shared.back"), legislation_processes_path, - class: "icon-angle-left", - style: "color:#{process.font_color};" %> + <%= link_to t("shared.back"), + legislation_processes_path, + class: "icon-angle-left", + style: "color:#{process.font_color};" %> <% else %> <%= back_link_to legislation_processes_path %> <% end %> @@ -37,11 +38,11 @@
    <%= render "shared/social_share", - share_title: t("proposals.show.share"), - title: @proposal.title, - url: legislation_process_proposal_url(process_id: @process), - description: @proposal.summary, - mobile: @proposal.title %> + share_title: t("proposals.show.share"), + title: @proposal.title, + url: legislation_process_proposal_url(process_id: @process), + description: @proposal.summary, + mobile: @proposal.title %>
    diff --git a/app/views/legislation/questions/_participation_not_allowed.html.erb b/app/views/legislation/questions/_participation_not_allowed.html.erb index 4e72372bb..35d6f351c 100644 --- a/app/views/legislation/questions/_participation_not_allowed.html.erb +++ b/app/views/legislation/questions/_participation_not_allowed.html.erb @@ -8,13 +8,14 @@

    <%= sanitize(t("legislation.questions.participation.verified_only", - verify_account: link_to_verify_account)) %> + verify_account: link_to_verify_account)) %>

    <% elsif !user_signed_in? %>
    <%= sanitize(t("legislation.questions.participation.unauthenticated", - signin: link_to_signin, signup: link_to_signup)) %> + signin: link_to_signin, + signup: link_to_signup)) %>
    <% elsif !@process.debate_phase.open? %>
    diff --git a/app/views/mailer/budget_investment_created.html.erb b/app/views/mailer/budget_investment_created.html.erb index 8c2da30c6..7c0c1c8e6 100644 --- a/app/views/mailer/budget_investment_created.html.erb +++ b/app/views/mailer/budget_investment_created.html.erb @@ -20,9 +20,11 @@

    <%= sanitize( - t("mailers.budget_investment_created.follow", - link: link_to(t("mailers.budget_investment_created.follow_link"), budgets_url, - style: css_for_mailer_link) + t( + "mailers.budget_investment_created.follow", + link: link_to(t("mailers.budget_investment_created.follow_link"), + budgets_url, + style: css_for_mailer_link) ), attributes: %w[href style] ) %> diff --git a/app/views/mailer/budget_investment_unfeasible.html.erb b/app/views/mailer/budget_investment_unfeasible.html.erb index 0fd60982d..444861672 100644 --- a/app/views/mailer/budget_investment_unfeasible.html.erb +++ b/app/views/mailer/budget_investment_unfeasible.html.erb @@ -14,7 +14,8 @@

    <%= sanitize( - t("mailers.budget_investment_unfeasible.new", + t( + "mailers.budget_investment_unfeasible.new", url: link_to(t("mailers.budget_investment_unfeasible.new_href"), new_budget_investment_url(@investment.budget), style: css_for_mailer_link) diff --git a/app/views/mailer/comment.html.erb b/app/views/mailer/comment.html.erb index 3c277bbd8..3121e2ce3 100644 --- a/app/views/mailer/comment.html.erb +++ b/app/views/mailer/comment.html.erb @@ -19,7 +19,8 @@

    <%= sanitize( - t("mailers.config.unsubscribe_text", + t( + "mailers.config.unsubscribe_text", notifications: link_to( t("mailers.config.notifications_link"), edit_subscriptions_url(token: @token), diff --git a/app/views/mailer/direct_message_for_receiver.html.erb b/app/views/mailer/direct_message_for_receiver.html.erb index efe41e744..5a8799607 100644 --- a/app/views/mailer/direct_message_for_receiver.html.erb +++ b/app/views/mailer/direct_message_for_receiver.html.erb @@ -13,7 +13,7 @@

    <%= link_to user_url(@direct_message.sender), style: css_for_mailer_button, target: "_blank" do %> <%= t("mailers.direct_message_for_receiver.reply", - sender: @direct_message.sender.name) %> + sender: @direct_message.sender.name) %> <% end %>

    - <%= t("mailers.user_invite.title", - org: Setting["org_name"]) %> + <%= t("mailers.user_invite.title", org: Setting["org_name"]) %>

    - <%= t("mailers.user_invite.text", - org: Setting["org_name"]) %> + <%= t("mailers.user_invite.text", org: Setting["org_name"]) %>

    diff --git a/app/views/management/_account_info.html.erb b/app/views/management/_account_info.html.erb index cb262a9ef..ab37d813b 100644 --- a/app/views/management/_account_info.html.erb +++ b/app/views/management/_account_info.html.erb @@ -1,9 +1,9 @@ <% if managed_user.document_number.present? %>

    <%= link_to t("officing.poll_budgets.index.ballot_sheet", id: ballot_sheet.id), - officing_poll_ballot_sheet_path(@poll.id, ballot_sheet.id) %> <%= ballot_sheet.author %> <%= l(ballot_sheet.created_at, format: :long) %>
    - <%= form_for @user, as: :voter, url: officing_voters_path, - method: :post, remote: true, - html: { id: "new_officing_voter" } do |f| %> + <%= form_for @user, as: :voter, + url: officing_voters_path, + method: :post, + remote: true, + html: { id: "new_officing_voter" } do |f| %> <%= f.hidden_field :poll_id, value: poll.id %> <%= f.hidden_field :user_id, value: @user.id %> <%= f.submit t("officing.voters.show.submit"), diff --git a/app/views/organizations/registrations/new.html.erb b/app/views/organizations/registrations/new.html.erb index 30e2dd2f6..b36fba601 100644 --- a/app/views/organizations/registrations/new.html.erb +++ b/app/views/organizations/registrations/new.html.erb @@ -9,8 +9,8 @@ <%= f.fields_for :organization do |fo| %> <%= fo.text_field :name, autofocus: true, maxlength: Organization.name_max_length %> <%= fo.text_field :responsible_name, - maxlength: Organization.responsible_name_max_length, - hint: t("devise_views.organizations.registrations.new.responsible_name_note") %> + maxlength: Organization.responsible_name_max_length, + hint: t("devise_views.organizations.registrations.new.responsible_name_note") %> <% end %> <%= f.email_field :email %> @@ -22,16 +22,15 @@ <%= f.password_field :password, autocomplete: "off" %> <%= f.password_field :password_confirmation, autocomplete: "off", - label: t("devise_views.organizations.registrations.new.password_confirmation_label") %> + label: t("devise_views.organizations.registrations.new.password_confirmation_label") %> <%= f.check_box :terms_of_service, - title: t("devise_views.users.registrations.new.terms_title"), - label: t("devise_views.users.registrations.new.terms", - terms: link_to(t("devise_views.users.registrations.new.terms_link"), - "/conditions", - title: t("shared.target_blank"), - target: "_blank") - ) %> + title: t("devise_views.users.registrations.new.terms_title"), + label: t("devise_views.users.registrations.new.terms", + terms: link_to(t("devise_views.users.registrations.new.terms_link"), + "/conditions", + title: t("shared.target_blank"), + target: "_blank")) %>
    <%= f.submit t("devise_views.organizations.registrations.new.submit"), class: "button expanded" %> diff --git a/app/views/organizations/registrations/success.html.erb b/app/views/organizations/registrations/success.html.erb index e4425b53a..252c2ee7f 100644 --- a/app/views/organizations/registrations/success.html.erb +++ b/app/views/organizations/registrations/success.html.erb @@ -5,5 +5,6 @@

    <%= t("devise_views.organizations.registrations.success.instructions_3") %>

    <%= link_to t("devise_views.organizations.registrations.success.back_to_index"), - root_path, class: "button margin-top expanded" %> + root_path, + class: "button margin-top expanded" %>

    diff --git a/app/views/pages/help/_budgets.html.erb b/app/views/pages/help/_budgets.html.erb index 21d8c53d0..8712d9708 100644 --- a/app/views/pages/help/_budgets.html.erb +++ b/app/views/pages/help/_budgets.html.erb @@ -1,6 +1,6 @@ <%= render Pages::Help::SectionComponent.new("budgets") do %>

    <%= sanitize(t("pages.help.budgets.description", - link: link_to(t("pages.help.budgets.link"), budgets_path))) %> + link: link_to(t("pages.help.budgets.link"), budgets_path))) %>

    <% end %> diff --git a/app/views/pages/help/_debates.html.erb b/app/views/pages/help/_debates.html.erb index db380a20e..262e2bb8b 100644 --- a/app/views/pages/help/_debates.html.erb +++ b/app/views/pages/help/_debates.html.erb @@ -1,14 +1,14 @@ <%= render Pages::Help::SectionComponent.new("debates") do %>

    <%= sanitize(t("pages.help.debates.description", - org: setting["org_name"], - link: link_to(t("pages.help.debates.link"), debates_path))) %> + org: setting["org_name"], + link: link_to(t("pages.help.debates.link"), debates_path))) %>

    • <%= sanitize(t("pages.help.debates.feature", - link: link_to(t("pages.help.debates.feature_link", org: setting["org_name"]), - new_user_registration_path))) %> + link: link_to(t("pages.help.debates.feature_link", org: setting["org_name"]), + new_user_registration_path))) %>
    <% end %> diff --git a/app/views/pages/help/_polls.html.erb b/app/views/pages/help/_polls.html.erb index c7d1dd40c..f135c38c8 100644 --- a/app/views/pages/help/_polls.html.erb +++ b/app/views/pages/help/_polls.html.erb @@ -1,13 +1,13 @@ <%= render Pages::Help::SectionComponent.new("polls") do %>

    <%= sanitize(t("pages.help.polls.description", - link: link_to(t("pages.help.polls.link"), polls_path))) %> + link: link_to(t("pages.help.polls.link"), polls_path))) %>

    • <%= sanitize(t("pages.help.polls.feature_1", - link: link_to(t("pages.help.polls.feature_1_link", org_name: setting["org_name"]), - new_user_registration_path))) %> + link: link_to(t("pages.help.polls.feature_1_link", org_name: setting["org_name"]), + new_user_registration_path))) %>
    <% end %> diff --git a/app/views/pages/help/_processes.html.erb b/app/views/pages/help/_processes.html.erb index 18178f385..38352e135 100644 --- a/app/views/pages/help/_processes.html.erb +++ b/app/views/pages/help/_processes.html.erb @@ -6,8 +6,8 @@
    • <%= sanitize(t("pages.help.processes.feature", - link: link_to(t("pages.help.processes.feature_link", org_name: setting["org_name"]), - new_user_registration_path))) %> + link: link_to(t("pages.help.processes.feature_link", org_name: setting["org_name"]), + new_user_registration_path))) %>
    <% end %> diff --git a/app/views/pages/help/_proposals.html.erb b/app/views/pages/help/_proposals.html.erb index ef6875e67..9a8634eb9 100644 --- a/app/views/pages/help/_proposals.html.erb +++ b/app/views/pages/help/_proposals.html.erb @@ -1,6 +1,6 @@ <%= render Pages::Help::SectionComponent.new("proposals") do %>

    <%= sanitize(t("pages.help.proposals.description", - link: link_to(t("pages.help.proposals.link"), proposals_path))) %> + link: link_to(t("pages.help.proposals.link"), proposals_path))) %>

    <% end %> diff --git a/app/views/polls/_advanced_stats.html.erb b/app/views/polls/_advanced_stats.html.erb index 5b66db75a..7bfd0f06f 100644 --- a/app/views/polls/_advanced_stats.html.erb +++ b/app/views/polls/_advanced_stats.html.erb @@ -7,7 +7,8 @@ <% stats.channels.each do |channel| %> <%= number_with_info_tags( stats.send("total_participants_#{channel}"), - t("stats.polls.#{channel}_percentage", + t( + "stats.polls.#{channel}_percentage", percentage: number_to_stats_percentage(stats.send(:"total_participants_#{channel}_percentage")) ), html_class: channel diff --git a/app/views/polls/_callout.html.erb b/app/views/polls/_callout.html.erb index 5a837d0e3..432d8c984 100644 --- a/app/views/polls/_callout.html.erb +++ b/app/views/polls/_callout.html.erb @@ -2,13 +2,13 @@ <% if current_user.nil? %>
    <%= sanitize(t("polls.show.cant_answer_not_logged_in", - signin: link_to_signin(class: "probe-message"), - signup: link_to_signup(class: "probe-message"))) %> + signin: link_to_signin(class: "probe-message"), + signup: link_to_signup(class: "probe-message"))) %>
    <% elsif current_user.unverified? %>
    <%= sanitize(t("polls.show.cant_answer_verify", - verify_link: link_to(t("polls.show.verify_link"), verification_path))) %> + verify_link: link_to(t("polls.show.verify_link"), verification_path))) %>
    <% elsif @poll.expired? %>
    diff --git a/app/views/polls/_poll_header.html.erb b/app/views/polls/_poll_header.html.erb index 77e95679d..73cd608db 100644 --- a/app/views/polls/_poll_header.html.erb +++ b/app/views/polls/_poll_header.html.erb @@ -23,11 +23,11 @@
    diff --git a/app/views/polls/show.html.erb b/app/views/polls/show.html.erb index 22f1fae32..3d9d88494 100644 --- a/app/views/polls/show.html.erb +++ b/app/views/polls/show.html.erb @@ -2,11 +2,11 @@ <%= provide :meta_description, t("social_share.polls_show.description_#{@poll.id}", default: @poll.title) %> <%= provide :social_media_meta_tags do %> <%= render "shared/social_media_meta_tags", - social_url: poll_url, - social_title: t("social_share.polls_show.title_#{@poll.id}", default: @poll.title), - social_description: t("social_share.polls_show.facebook_#{@poll.id}", default: @poll.title), - twitter_image_url: "social_media_polls_twitter.jpg", - og_image_url: "social_media_polls.jpg" %> + social_url: poll_url, + social_title: t("social_share.polls_show.title_#{@poll.id}", default: @poll.title), + social_description: t("social_share.polls_show.facebook_#{@poll.id}", default: @poll.title), + twitter_image_url: "social_media_polls_twitter.jpg", + og_image_url: "social_media_polls.jpg" %> <% end %>
    diff --git a/app/views/proposal_notifications/new.html.erb b/app/views/proposal_notifications/new.html.erb index 7089e7f49..9075def3a 100644 --- a/app/views/proposal_notifications/new.html.erb +++ b/app/views/proposal_notifications/new.html.erb @@ -7,9 +7,9 @@

    <%= sanitize(t("proposal_notifications.new.info_about_receivers", - count: @proposal.users_to_notify.count, - proposal_page: link_to(t("proposal_notifications.new.proposal_page"), - proposal_path(@proposal, anchor: "comments")))) %> + count: @proposal.users_to_notify.count, + proposal_page: link_to(t("proposal_notifications.new.proposal_page"), + proposal_path(@proposal, anchor: "comments")))) %>

    diff --git a/app/views/proposals/_info.html.erb b/app/views/proposals/_info.html.erb index 71060a514..ec5d2b866 100644 --- a/app/views/proposals/_info.html.erb +++ b/app/views/proposals/_info.html.erb @@ -68,8 +68,8 @@ <% if feature?(:allow_attached_documents) %> <%= render "documents/documents", - documents: @proposal.documents, - max_documents_allowed: Proposal.max_documents_allowed %> + documents: @proposal.documents, + max_documents_allowed: Proposal.max_documents_allowed %> <% end %> <%= render "shared/tags", taggable: @proposal %> diff --git a/app/views/proposals/_social_share.html.erb b/app/views/proposals/_social_share.html.erb index fedfa587a..2dcc2ffde 100644 --- a/app/views/proposals/_social_share.html.erb +++ b/app/views/proposals/_social_share.html.erb @@ -1,10 +1,10 @@ <%= render "shared/social_share", - share_title: share_title, - title: proposal.title, - url: proposal_url(proposal), - description: t("proposals.share.message", - title: proposal.title, - handle: setting["org_name"]), - mobile: t("proposals.share.message", - title: proposal.title, - handle: setting["twitter_handle"]) %> + share_title: share_title, + title: proposal.title, + url: proposal_url(proposal), + description: t("proposals.share.message", + title: proposal.title, + handle: setting["org_name"]), + mobile: t("proposals.share.message", + title: proposal.title, + handle: setting["twitter_handle"]) %> diff --git a/app/views/proposals/_supports.html.erb b/app/views/proposals/_supports.html.erb index 2ff839593..e58d353a4 100644 --- a/app/views/proposals/_supports.html.erb +++ b/app/views/proposals/_supports.html.erb @@ -10,7 +10,7 @@ "> <%= t("proposals.proposal.supports_necessary", - number: number_with_delimiter(Proposal.votes_needed_for_success)) %> + number: number_with_delimiter(Proposal.votes_needed_for_success)) %> diff --git a/app/views/proposals/retire_form.html.erb b/app/views/proposals/retire_form.html.erb index 4fb65cb3e..e22d80255 100644 --- a/app/views/proposals/retire_form.html.erb +++ b/app/views/proposals/retire_form.html.erb @@ -16,8 +16,9 @@ <%= render "shared/errors", resource: @proposal %>
    - <%= f.select :retired_reason, retire_proposals_options, - include_blank: t("proposals.retire_form.retired_reason_blank") %> + <%= f.select :retired_reason, + retire_proposals_options, + include_blank: t("proposals.retire_form.retired_reason_blank") %>
    @@ -25,8 +26,9 @@ <%= f.translatable_fields do |translations_form| %>
    <%= translations_form.text_area :retired_explanation, - rows: 4, maxlength: 500, - placeholder: t("proposals.retire_form.retired_explanation_placeholder") %> + rows: 4, + maxlength: 500, + placeholder: t("proposals.retire_form.retired_explanation_placeholder") %>
    <% end %> diff --git a/app/views/proposals/share.html.erb b/app/views/proposals/share.html.erb index 1ee1938de..26e2453a6 100644 --- a/app/views/proposals/share.html.erb +++ b/app/views/proposals/share.html.erb @@ -1,9 +1,9 @@ <% provide :title do %><%= @proposal.title %><% end %> <% provide :social_media_meta_tags do %> <%= render "shared/social_media_meta_tags", - social_url: proposal_url(@proposal), - social_title: @proposal.title, - social_description: @proposal.summary %> + social_url: proposal_url(@proposal), + social_title: @proposal.title, + social_description: @proposal.summary %> <% end %> <% content_for :canonical do %> <%= render "shared/canonical", href: proposal_url(@proposal) %> @@ -25,10 +25,10 @@

    <%= render "shared/social_share", - title: @proposal.title, - url: proposal_url(@proposal), - description: @proposal.summary, - mobile: @proposal.title %> + title: @proposal.title, + url: proposal_url(@proposal), + description: @proposal.summary, + mobile: @proposal.title %> <% if can?(:dashboard, @proposal) %>
    diff --git a/app/views/proposals/show.html.erb b/app/views/proposals/show.html.erb index ea2c5e844..d3dafbc8f 100644 --- a/app/views/proposals/show.html.erb +++ b/app/views/proposals/show.html.erb @@ -3,11 +3,11 @@ <% content_for :meta_description do %><%= @proposal.summary %><% end %> <% provide :social_media_meta_tags do %> <%= render "shared/social_media_meta_tags", - social_url: proposal_url(@proposal), - social_title: @proposal.title, - social_description: @proposal.summary, - twitter_image_url: (@proposal.image.present? ? polymorphic_path(@proposal.image.variant(:thumb)) : nil), - og_image_url: (@proposal.image.present? ? polymorphic_path(@proposal.image.variant(:thumb)) : nil) %> + social_url: proposal_url(@proposal), + social_title: @proposal.title, + social_description: @proposal.summary, + twitter_image_url: (@proposal.image.present? ? polymorphic_path(@proposal.image.variant(:thumb)) : nil), + og_image_url: (@proposal.image.present? ? polymorphic_path(@proposal.image.variant(:thumb)) : nil) %> <% end %> <% content_for :canonical do %> <%= render "shared/canonical", href: proposal_url(@proposal) %> diff --git a/app/views/relationable/_form.html.erb b/app/views/relationable/_form.html.erb index 4f2def3aa..44d22d44c 100644 --- a/app/views/relationable/_form.html.erb +++ b/app/views/relationable/_form.html.erb @@ -12,8 +12,8 @@
    <%= text_field_tag :url, "", - "aria-describedby": "related_content_help_text", - placeholder: t("related_content.placeholder", url: root_url) %> + "aria-describedby": "related_content_help_text", + placeholder: t("related_content.placeholder", url: root_url) %> <%= hidden_field_tag :relationable_klass, relationable.class.name %> <%= hidden_field_tag :relationable_id, relationable.id %> diff --git a/app/views/shared/_filter_subnav.html.erb b/app/views/shared/_filter_subnav.html.erb index fc4c5a950..ab9161ef6 100644 --- a/app/views/shared/_filter_subnav.html.erb +++ b/app/views/shared/_filter_subnav.html.erb @@ -6,7 +6,7 @@
  • <%= t("#{i18n_namespace}.filters.#{filter}") %>

  • <% else %>
  • <%= link_to t("#{i18n_namespace}.filters.#{filter}"), - current_path_with_query_params(filter: filter, page: 1) %>
  • + current_path_with_query_params(filter: filter, page: 1) %> <% end %> <% end %> diff --git a/app/views/shared/_filter_subnav_vertical.html.erb b/app/views/shared/_filter_subnav_vertical.html.erb index e1af05ef5..c4d6ae084 100644 --- a/app/views/shared/_filter_subnav_vertical.html.erb +++ b/app/views/shared/_filter_subnav_vertical.html.erb @@ -8,7 +8,7 @@ <% else %>
  • <%= link_to t("#{i18n_namespace}.filters.#{filter}"), - current_path_with_query_params(filter: filter, page: 1) %>
  • + current_path_with_query_params(filter: filter, page: 1) %> <% end %> <% end %> diff --git a/app/views/shared/_globalize_locales.html.erb b/app/views/shared/_globalize_locales.html.erb index 38464ac3b..88aa4064b 100644 --- a/app/views/shared/_globalize_locales.html.erb +++ b/app/views/shared/_globalize_locales.html.erb @@ -1,6 +1,6 @@ <% if translations_interface_enabled? %> <%= render "shared/common_globalize_locales", - resource: resource, - display_style: lambda { |locale| enable_translation_style(resource, locale) }, - manage_languages: defined?(manage_languages) ? manage_languages : true %> + resource: resource, + display_style: lambda { |locale| enable_translation_style(resource, locale) }, + manage_languages: defined?(manage_languages) ? manage_languages : true %> <% end %> diff --git a/app/views/shared/_suggest.html.erb b/app/views/shared/_suggest.html.erb index 4bdeb6319..ad88e9174 100644 --- a/app/views/shared/_suggest.html.erb +++ b/app/views/shared/_suggest.html.erb @@ -4,8 +4,8 @@

    <%= t("shared.suggest.#{resource_name}.found", - count: @resources.count, - query: @search_terms) %> + count: @resources.count, + query: @search_terms) %>

    @@ -19,9 +19,9 @@

    <%= t("shared.suggest.#{resource_name}.message", - count: @resources.count, - query: @search_terms, - limit: @limit) %> + count: @resources.count, + query: @search_terms, + limit: @limit) %> <%= link_to t("shared.suggest.#{resource_name}.see_all"), polymorphic_path(resource_model, search: @search_terms) %> diff --git a/app/views/topics/_informative_text.html.erb b/app/views/topics/_informative_text.html.erb index 43604a623..599a84436 100644 --- a/app/views/topics/_informative_text.html.erb +++ b/app/views/topics/_informative_text.html.erb @@ -7,6 +7,7 @@ <% else %>

    <%= sanitize(t("community.show.create_first_community_topic.sub_first_theme", - sign_in: link_to_signin, sign_up: link_to_signup)) %> + sign_in: link_to_signin, + sign_up: link_to_signup)) %>
    <% end %> diff --git a/app/views/topics/show.html.erb b/app/views/topics/show.html.erb index 51242bd0a..767d94efa 100644 --- a/app/views/topics/show.html.erb +++ b/app/views/topics/show.html.erb @@ -2,9 +2,10 @@
    - <%= back_link_to community_path(@community), t("community.show.back", - community: community_text(@community), - proposal: community_title(@community)) %> + <%= back_link_to community_path(@community), + t("community.show.back", + community: community_text(@community), + proposal: community_title(@community)) %>

    <%= @topic.title %>

    @@ -32,7 +33,8 @@ class: "button hollow expanded" %> <%= link_to t("community.show.topic.destroy"), - community_topic_path(@community.id, @topic), method: :delete, + community_topic_path(@community.id, @topic), + method: :delete, class: "button hollow expanded alert" %> <% end %> diff --git a/app/views/users/registrations/delete_form.html.erb b/app/views/users/registrations/delete_form.html.erb index 4880f1d5c..1e8ba16e1 100644 --- a/app/views/users/registrations/delete_form.html.erb +++ b/app/views/users/registrations/delete_form.html.erb @@ -3,8 +3,8 @@

    <%= t("devise_views.users.registrations.delete_form.title") %>

    <%= form_for(resource, as: resource_name, - url: users_registrations_path, - html: { method: :delete }) do |f| %> + url: users_registrations_path, + html: { method: :delete }) do |f| %> <%= render "shared/errors", resource: resource %>
    @@ -15,8 +15,8 @@

    <%= f.text_field :erase_reason, - autofocus: true, - label: t("devise_views.users.registrations.delete_form.erase_reason_label") %> + autofocus: true, + label: t("devise_views.users.registrations.delete_form.erase_reason_label") %> <%= f.submit t("devise_views.users.registrations.delete_form.submit"), class: "button alert expanded" %> <% end %> diff --git a/app/views/users/registrations/edit.html.erb b/app/views/users/registrations/edit.html.erb index 28bff0014..8750fd963 100644 --- a/app/views/users/registrations/edit.html.erb +++ b/app/views/users/registrations/edit.html.erb @@ -7,8 +7,8 @@
    <%= f.email_field :email, - label: t("devise_views.users.registrations.edit.email_label"), - autofocus: true %> + label: t("devise_views.users.registrations.edit.email_label"), + autofocus: true %>
    @@ -19,22 +19,22 @@
    <%= f.password_field :password, - autocomplete: "off", - label: t("devise_views.users.registrations.edit.password_label"), - hint: t("devise_views.users.registrations.edit.leave_blank") %> + autocomplete: "off", + label: t("devise_views.users.registrations.edit.password_label"), + hint: t("devise_views.users.registrations.edit.leave_blank") %>
    <%= f.password_field :password_confirmation, - label: t("devise_views.users.registrations.edit.password_confirmation_label"), - autocomplete: "off" %> + label: t("devise_views.users.registrations.edit.password_confirmation_label"), + autocomplete: "off" %>
    <%= f.password_field :current_password, - label: t("devise_views.users.registrations.edit.current_password_label"), - autocomplete: "off", - hint: t("devise_views.users.registrations.edit.need_current") %> + label: t("devise_views.users.registrations.edit.current_password_label"), + autocomplete: "off", + hint: t("devise_views.users.registrations.edit.need_current") %>
    diff --git a/app/views/users/registrations/new.html.erb b/app/views/users/registrations/new.html.erb index 485f39b8d..0afca1696 100644 --- a/app/views/users/registrations/new.html.erb +++ b/app/views/users/registrations/new.html.erb @@ -8,7 +8,8 @@

    <%= sanitize(t("devise_views.users.registrations.new.organization_signup", - signup_link: link_to(t("devise_views.users.registrations.new.organization_signup_link"), new_organization_registration_path))) %> + signup_link: link_to(t("devise_views.users.registrations.new.organization_signup_link"), + new_organization_registration_path))) %>

    @@ -27,19 +28,19 @@ <%= f.password_field :password, autocomplete: "off" %> <%= f.password_field :password_confirmation, autocomplete: "off", - label: t("devise_views.users.registrations.new.password_confirmation_label") %> + label: t("devise_views.users.registrations.new.password_confirmation_label") %> <% if resource.use_redeemable_code %> <%= f.text_field :redeemable_code %> <% end %> <%= f.check_box :terms_of_service, - title: t("devise_views.users.registrations.new.terms_title"), - label: t("devise_views.users.registrations.new.terms", - terms: link_to(t("devise_views.users.registrations.new.terms_link"), "/conditions", - title: t("shared.target_blank"), - target: "_blank") - ) %> + title: t("devise_views.users.registrations.new.terms_title"), + label: t("devise_views.users.registrations.new.terms", + terms: link_to(t("devise_views.users.registrations.new.terms_link"), + "/conditions", + title: t("shared.target_blank"), + target: "_blank")) %>
    <%= f.submit t("devise_views.users.registrations.new.submit"), class: "button expanded" %> diff --git a/app/views/users/registrations/success.html.erb b/app/views/users/registrations/success.html.erb index b1e280398..c5f8cb77f 100644 --- a/app/views/users/registrations/success.html.erb +++ b/app/views/users/registrations/success.html.erb @@ -5,5 +5,6 @@

    <%= t("devise_views.users.registrations.success.instructions_2") %>

    <%= link_to t("devise_views.users.registrations.success.back_to_index"), - root_path, class: "button margin-top expanded" %> + root_path, + class: "button margin-top expanded" %>

    diff --git a/app/views/valuation/budget_investments/_dossier_form.html.erb b/app/views/valuation/budget_investments/_dossier_form.html.erb index 243d9f147..5f2f80f80 100644 --- a/app/views/valuation/budget_investments/_dossier_form.html.erb +++ b/app/views/valuation/budget_investments/_dossier_form.html.erb @@ -42,14 +42,14 @@
    <%= f.number_field :price, - label: t("valuation.budget_investments.edit.price", currency: budget.currency_symbol), - max: 1000000000000000 %> + label: t("valuation.budget_investments.edit.price", currency: budget.currency_symbol), + max: 1000000000000000 %>
    <%= f.number_field :price_first_year, - label: t("valuation.budget_investments.edit.price_first_year", currency: budget.currency_symbol), - max: 1000000000000000 %> + label: t("valuation.budget_investments.edit.price_first_year", currency: budget.currency_symbol), + max: 1000000000000000 %>
    @@ -73,9 +73,9 @@
    <%= f.check_box :valuation_finished, - id: "js-investment-report-alert", - "data-alert": t("valuation.budget_investments.edit.valuation_finished_alert"), - "data-not-feasible-alert": t("valuation.budget_investments.edit.not_feasible_alert") %> + id: "js-investment-report-alert", + "data-alert": t("valuation.budget_investments.edit.valuation_finished_alert"), + "data-not-feasible-alert": t("valuation.budget_investments.edit.not_feasible_alert") %>
    diff --git a/app/views/valuation/budget_investments/_valuation_comments.html.erb b/app/views/valuation/budget_investments/_valuation_comments.html.erb index 39f9995dc..713727bb3 100644 --- a/app/views/valuation/budget_investments/_valuation_comments.html.erb +++ b/app/views/valuation/budget_investments/_valuation_comments.html.erb @@ -1,6 +1,6 @@

    <%= t("valuation.budget_investments.valuation_comments") %>

    <% unless @comment_tree.nil? %> <%= render "/comments/comment_tree", comment_tree: @comment_tree, - display_comments_count: false, - valuation: true %> + display_comments_count: false, + valuation: true %> <% end %> diff --git a/app/views/verification/residence/new.html.erb b/app/views/verification/residence/new.html.erb index 8cc5c745a..b528598f9 100644 --- a/app/views/verification/residence/new.html.erb +++ b/app/views/verification/residence/new.html.erb @@ -64,17 +64,17 @@
    <%= f.text_field :postal_code, - hint: t("verification.residence.new.postal_code_note") %> + hint: t("verification.residence.new.postal_code_note") %>
    <%= f.check_box :terms_of_service, - title: t("verification.residence.new.accept_terms_text_title"), - label: t("verification.residence.new.accept_terms_text", - terms_url: link_to(t("verification.residence.new.terms"), page_path("census_terms"), - title: t("shared.target_blank"), - target: "_blank") - ) %> + title: t("verification.residence.new.accept_terms_text_title"), + label: t("verification.residence.new.accept_terms_text", + terms_url: link_to(t("verification.residence.new.terms"), + page_path("census_terms"), + title: t("shared.target_blank"), + target: "_blank")) %>
    diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index c31ab5398..717986f95 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -8,7 +8,7 @@ <% provide :social_media_meta_tags do %> <%= render "shared/social_media_meta_tags", - social_url: root_url %> + social_url: root_url %> <% end %> <%= render "shared/header", header: @header %> @@ -34,7 +34,7 @@ <% if feature?("user.recommendations") && (@recommended_debates.present? || @recommended_proposals.present?) %> <%= render "recommended", - recommended_debates: @recommended_debates, - recommended_proposals: @recommended_proposals %> + recommended_debates: @recommended_debates, + recommended_proposals: @recommended_proposals %> <% end %> diff --git a/bin/rspec b/bin/rspec index 76b37c19f..b50d67608 100755 --- a/bin/rspec +++ b/bin/rspec @@ -14,7 +14,7 @@ end require "pathname" ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) + Pathname.new(__FILE__).realpath) require "rubygems" require "bundler/setup" diff --git a/config/application.rb b/config/application.rb index 9391b39fa..478276697 100644 --- a/config/application.rb +++ b/config/application.rb @@ -97,18 +97,19 @@ module Consul "uk-UA", "val", "zh-CN", - "zh-TW"] + "zh-TW" + ] config.i18n.available_locales = available_locales config.i18n.fallbacks = [I18n.default_locale, { - "ca" => "es", + "ca" => "es", "es-PE" => "es", - "eu" => "es", - "fr" => "es", - "gl" => "es", - "it" => "es", - "oc" => "fr", + "eu" => "es", + "fr" => "es", + "gl" => "es", + "it" => "es", + "oc" => "fr", "pt-BR" => "es", - "val" => "es" + "val" => "es" }] config.i18n.load_path += Dir[Rails.root.join("config", "locales", "**[^custom]*", "*.{rb,yml}")] diff --git a/config/routes/devise.rb b/config/routes/devise.rb index cfd281409..1e45ef4a4 100644 --- a/config/routes/devise.rb +++ b/config/routes/devise.rb @@ -1,9 +1,9 @@ devise_for :users, controllers: { - registrations: "users/registrations", - sessions: "users/sessions", - confirmations: "users/confirmations", - omniauth_callbacks: "users/omniauth_callbacks" - } + registrations: "users/registrations", + sessions: "users/sessions", + confirmations: "users/confirmations", + omniauth_callbacks: "users/omniauth_callbacks" +} devise_scope :user do patch "/user/confirmation", to: "users/confirmations#update", as: :update_user_confirmation @@ -16,11 +16,11 @@ devise_scope :user do end devise_for :organizations, class_name: "User", - controllers: { - registrations: "organizations/registrations", - sessions: "devise/sessions" - }, - skip: [:omniauth_callbacks] + controllers: { + registrations: "organizations/registrations", + sessions: "devise/sessions" + }, + skip: [:omniauth_callbacks] devise_scope :organization do get "organizations/sign_up/success", to: "organizations/registrations#success" diff --git a/db/dev_seeds.rb b/db/dev_seeds.rb index 05250b78c..00f102f22 100644 --- a/db/dev_seeds.rb +++ b/db/dev_seeds.rb @@ -5,8 +5,8 @@ end @logger = Logger.new(STDOUT) @logger.formatter = proc do |_severity, _datetime, _progname, msg| - msg unless Rails.env.test? - end + msg unless Rails.env.test? +end def load_dev_seeds(dev_seeds_file) load Rails.root.join("db", "dev_seeds", "#{dev_seeds_file}.rb") diff --git a/db/dev_seeds/banners.rb b/db/dev_seeds/banners.rb index d34078a7b..345ae4e90 100644 --- a/db/dev_seeds/banners.rb +++ b/db/dev_seeds/banners.rb @@ -7,7 +7,7 @@ section "Creating banners" do description: description, target_url: target_url, post_started_at: rand((1.week.ago)..(1.day.ago)), - post_ended_at: rand((1.day.ago)..(1.week.from_now)), + post_ended_at: rand((1.day.ago)..(1.week.from_now)), created_at: rand((1.week.ago)..Time.current)) I18n.available_locales.map do |locale| Globalize.with_locale(locale) do diff --git a/db/dev_seeds/geozones.rb b/db/dev_seeds/geozones.rb index 98d75d137..d608435d0 100644 --- a/db/dev_seeds/geozones.rb +++ b/db/dev_seeds/geozones.rb @@ -1,24 +1,24 @@ section "Creating Geozones" do Geozone.create!(name: I18n.t("seeds.geozones.north_district"), external_code: "001", census_code: "01", - html_map_coordinates: "30,139,45,153,77,148,107,165,138,201,146,218,186,198,216,"\ - "196,233,203,240,215,283,194,329,185,377,184,388,165,369,126,333,113,334,84,320,"\ + html_map_coordinates: "30,139,45,153,77,148,107,165,138,201,146,218,186,198,216," \ + "196,233,203,240,215,283,194,329,185,377,184,388,165,369,126,333,113,334,84,320," \ "66,286,73,258,65,265,57,249,47,207,58,159,84,108,85,72,101,51,114") Geozone.create!(name: I18n.t("seeds.geozones.west_district"), external_code: "002", census_code: "02", - html_map_coordinates: "42,153,31,176,24,202,20,221,44,235,59,249,55,320,30,354,"\ - "31,372,52,396,64,432,89,453,116,432,149,419,162,412,165,377,172,357,189,352,228,"\ - "327,246,313,262,297,234,291,210,284,193,284,176,294,158,303,154,310,146,289,140,"\ + html_map_coordinates: "42,153,31,176,24,202,20,221,44,235,59,249,55,320,30,354," \ + "31,372,52,396,64,432,89,453,116,432,149,419,162,412,165,377,172,357,189,352,228," \ + "327,246,313,262,297,234,291,210,284,193,284,176,294,158,303,154,310,146,289,140," \ "268,138,246,135,236,139,222,151,214,136,197,120,179,99,159,85,149,65,149,56,149") Geozone.create!(name: I18n.t("seeds.geozones.east_district"), external_code: "003", census_code: "03", - html_map_coordinates: "175,353,162,378,161,407,153,416,167,432,184,447,225,426,"\ - "250,409,283,390,298,369,344,363,351,334,356,296,361,267,376,245,378,185,327,188,"\ - "281,195,239,216,245,221,245,232,261,244,281,238,300,242,304,251,285,262,278,277,"\ + html_map_coordinates: "175,353,162,378,161,407,153,416,167,432,184,447,225,426," \ + "250,409,283,390,298,369,344,363,351,334,356,296,361,267,376,245,378,185,327,188," \ + "281,195,239,216,245,221,245,232,261,244,281,238,300,242,304,251,285,262,278,277," \ "267,294,249,312,219,333,198,346,184,353") Geozone.create!(name: I18n.t("seeds.geozones.central_district"), external_code: "004", census_code: "04", - html_map_coordinates: "152,308,137,258,133,235,147,216,152,214,186,194,210,196,"\ - "228,202,240,216,241,232,263,243,293,241,301,245,302,254,286,265,274,278,267,296,"\ + html_map_coordinates: "152,308,137,258,133,235,147,216,152,214,186,194,210,196," \ + "228,202,240,216,241,232,263,243,293,241,301,245,302,254,286,265,274,278,267,296," \ "243,293,226,289,209,285,195,283,177,297") end diff --git a/db/dev_seeds/milestones.rb b/db/dev_seeds/milestones.rb index 9c0619e4a..1733468bc 100644 --- a/db/dev_seeds/milestones.rb +++ b/db/dev_seeds/milestones.rb @@ -29,7 +29,7 @@ section "Creating investment milestones" do rand(0..3).times do progress_bar = record.progress_bars.build( - kind: :secondary, + kind: :secondary, percentage: rand(ProgressBar::RANGE) ) diff --git a/db/dev_seeds/newsletters.rb b/db/dev_seeds/newsletters.rb index e196f8a0a..46fb4d4aa 100644 --- a/db/dev_seeds/newsletters.rb +++ b/db/dev_seeds/newsletters.rb @@ -1,13 +1,13 @@ section "Creating Newsletters" do newsletter_body = [ - "We choose to go to the moon in this decade and do the other things, not because they are easy"\ - ", but because they are hard, because that goal will serve to organize and measure the best of"\ - " our energies and skills, because that challenge is one that we are willing to accept, one we"\ + "We choose to go to the moon in this decade and do the other things, not because they are easy" \ + ", but because they are hard, because that goal will serve to organize and measure the best of" \ + " our energies and skills, because that challenge is one that we are willing to accept, one we" \ " are unwilling to postpone, and one which we intend to win.", - "Spaceflights cannot be stopped. This is not the work of any one man or even a group of men."\ - " It is a historical process which mankind is carrying out in accordance with the natural laws"\ + "Spaceflights cannot be stopped. This is not the work of any one man or even a group of men." \ + " It is a historical process which mankind is carrying out in accordance with the natural laws" \ " of human development.", - "Many say exploration is part of our destiny, but it’s actually our duty to future generations"\ + "Many say exploration is part of our destiny, but it’s actually our duty to future generations" \ " and their quest to ensure the survival of the human species." ] diff --git a/db/dev_seeds/polls.rb b/db/dev_seeds/polls.rb index fcdf9f94b..572d8cd9f 100644 --- a/db/dev_seeds/polls.rb +++ b/db/dev_seeds/polls.rb @@ -13,30 +13,30 @@ section "Creating polls" do create_poll!(name: I18n.t("seeds.polls.current_poll"), slug: I18n.t("seeds.polls.current_poll").parameterize, starts_at: 7.days.ago, - ends_at: 7.days.from_now, + ends_at: 7.days.from_now, geozone_restricted: false) create_poll!(name: I18n.t("seeds.polls.current_poll_geozone_restricted"), slug: I18n.t("seeds.polls.current_poll_geozone_restricted").parameterize, starts_at: 5.days.ago, - ends_at: 5.days.from_now, + ends_at: 5.days.from_now, geozone_restricted: true, geozones: Geozone.sample(3)) create_poll!(name: I18n.t("seeds.polls.recounting_poll"), slug: I18n.t("seeds.polls.recounting_poll").parameterize, starts_at: 15.days.ago, - ends_at: 2.days.ago) + ends_at: 2.days.ago) create_poll!(name: I18n.t("seeds.polls.expired_poll_without_stats"), slug: I18n.t("seeds.polls.expired_poll_without_stats").parameterize, starts_at: 2.months.ago, - ends_at: 1.month.ago) + ends_at: 1.month.ago) create_poll!(name: I18n.t("seeds.polls.expired_poll_with_stats"), slug: I18n.t("seeds.polls.expired_poll_with_stats").parameterize, starts_at: 2.months.ago, - ends_at: 1.month.ago, + ends_at: 1.month.ago, results_enabled: true, stats_enabled: true) diff --git a/db/dev_seeds/sdg.rb b/db/dev_seeds/sdg.rb index 8381f01fb..7f90b594d 100644 --- a/db/dev_seeds/sdg.rb +++ b/db/dev_seeds/sdg.rb @@ -34,6 +34,6 @@ end section "Creating SDG homepage cards" do SDG::Phase.all.each do |phase| Widget::Card.create!(cardable: phase, title: "#{phase.title} card", - link_text: "Link Text", link_url: "/any_path") + link_text: "Link Text", link_url: "/any_path") end end diff --git a/db/dev_seeds/settings.rb b/db/dev_seeds/settings.rb index 66f179337..1dba17c6d 100644 --- a/db/dev_seeds/settings.rb +++ b/db/dev_seeds/settings.rb @@ -6,7 +6,7 @@ section "Creating Settings" do "feature.featured_proposals": "true", "feature.map": "true", "instagram_handle": "CONSUL DEMOCRACY", - "meta_description": "Citizen participation tool for an open, "\ + "meta_description": "Citizen participation tool for an open, " \ "transparent and democratic government", "meta_keywords": "citizen participation, open government", "meta_title": "CONSUL DEMOCRACY", diff --git a/db/dev_seeds/users.rb b/db/dev_seeds/users.rb index 9f36ac09d..679c42cdd 100644 --- a/db/dev_seeds/users.rb +++ b/db/dev_seeds/users.rb @@ -2,15 +2,15 @@ section "Creating Users" do def create_user(email, username) password = "12345678" User.create!( - username: username, - email: email, - password: password, - password_confirmation: password, - confirmed_at: Time.current, - terms_of_service: "1", - gender: %w[male female].sample, - date_of_birth: rand((80.years.ago)..(16.years.ago)), - public_activity: (rand(1..100) > 30) + username: username, + email: email, + password: password, + password_confirmation: password, + confirmed_at: Time.current, + terms_of_service: "1", + gender: %w[male female].sample, + date_of_birth: rand((80.years.ago)..(16.years.ago)), + public_activity: (rand(1..100) > 30) ) end @@ -23,56 +23,69 @@ section "Creating Users" do admin = create_user("admin@consul.dev", "admin") admin.create_administrator admin.update!(residence_verified_at: Time.current, - confirmed_phone: Faker::PhoneNumber.phone_number, document_type: "1", - verified_at: Time.current, document_number: unique_document_number) + confirmed_phone: Faker::PhoneNumber.phone_number, document_type: "1", + verified_at: Time.current, document_number: unique_document_number) moderator = create_user("mod@consul.dev", "moderator") moderator.create_moderator moderator.update!(residence_verified_at: Time.current, - confirmed_phone: Faker::PhoneNumber.phone_number, document_type: "1", - verified_at: Time.current, document_number: unique_document_number) + confirmed_phone: Faker::PhoneNumber.phone_number, document_type: "1", + verified_at: Time.current, document_number: unique_document_number) manager = create_user("manager@consul.dev", "manager") manager.create_manager manager.update!(residence_verified_at: Time.current, - confirmed_phone: Faker::PhoneNumber.phone_number, document_type: "1", - verified_at: Time.current, document_number: unique_document_number) + confirmed_phone: Faker::PhoneNumber.phone_number, + document_type: "1", + verified_at: Time.current, + document_number: unique_document_number) valuator = create_user("valuator@consul.dev", "valuator") valuator.create_valuator valuator.update!(residence_verified_at: Time.current, - confirmed_phone: Faker::PhoneNumber.phone_number, document_type: "1", - verified_at: Time.current, document_number: unique_document_number) + confirmed_phone: Faker::PhoneNumber.phone_number, + document_type: "1", + verified_at: Time.current, + document_number: unique_document_number) poll_officer = create_user("poll_officer@consul.dev", "Paul O. Fisher") poll_officer.create_poll_officer poll_officer.update!(residence_verified_at: Time.current, - confirmed_phone: Faker::PhoneNumber.phone_number, document_type: "1", - verified_at: Time.current, document_number: unique_document_number) + confirmed_phone: Faker::PhoneNumber.phone_number, + document_type: "1", + verified_at: Time.current, + document_number: unique_document_number) poll_officer2 = create_user("poll_officer2@consul.dev", "Pauline M. Espinosa") poll_officer2.create_poll_officer poll_officer2.update!(residence_verified_at: Time.current, - confirmed_phone: Faker::PhoneNumber.phone_number, document_type: "1", - verified_at: Time.current, document_number: unique_document_number) + confirmed_phone: Faker::PhoneNumber.phone_number, + document_type: "1", + verified_at: Time.current, + document_number: unique_document_number) sdg_manager = create_user("sdg_manager@consul.dev", "SDG manager") sdg_manager.create_sdg_manager sdg_manager.update!(residence_verified_at: Time.current, - confirmed_phone: Faker::PhoneNumber.phone_number, document_type: "1", - verified_at: Time.current, document_number: unique_document_number) + confirmed_phone: Faker::PhoneNumber.phone_number, + document_type: "1", + verified_at: Time.current, + document_number: unique_document_number) create_user("unverified@consul.dev", "unverified") level_2 = create_user("leveltwo@consul.dev", "level 2") level_2.update!(residence_verified_at: Time.current, - confirmed_phone: Faker::PhoneNumber.phone_number, - document_number: unique_document_number, document_type: "1") + confirmed_phone: Faker::PhoneNumber.phone_number, + document_number: unique_document_number, + document_type: "1") verified = create_user("verified@consul.dev", "verified") verified.update!(residence_verified_at: Time.current, - confirmed_phone: Faker::PhoneNumber.phone_number, document_type: "1", - verified_at: Time.current, document_number: unique_document_number) + confirmed_phone: Faker::PhoneNumber.phone_number, + document_type: "1", + verified_at: Time.current, + document_number: unique_document_number) [ I18n.t("seeds.organizations.neighborhood_association"), diff --git a/db/migrate/20171115164152_add_time_zone_to_default_datetimes.rb b/db/migrate/20171115164152_add_time_zone_to_default_datetimes.rb index ca407158a..8edb1c972 100644 --- a/db/migrate/20171115164152_add_time_zone_to_default_datetimes.rb +++ b/db/migrate/20171115164152_add_time_zone_to_default_datetimes.rb @@ -1,11 +1,11 @@ class AddTimeZoneToDefaultDatetimes < ActiveRecord::Migration[4.2] def change change_column_default :users, :password_changed_at, - from: Time.zone.local(2015, 1, 1, 1, 1, 1), - to: DateTime.new(2015, 1, 1, 1, 1, 1, "+00:00") + from: Time.zone.local(2015, 1, 1, 1, 1, 1), + to: DateTime.new(2015, 1, 1, 1, 1, 1, "+00:00") change_column_default :locks, :locked_until, - from: Time.zone.local(2000, 1, 1, 1, 1, 1), - to: DateTime.new(2000, 1, 1, 1, 1, 1, "+00:00") + from: Time.zone.local(2000, 1, 1, 1, 1, 1), + to: DateTime.new(2000, 1, 1, 1, 1, 1, "+00:00") end end diff --git a/db/migrate/20200602233844_create_shared_extensions_schema.rb b/db/migrate/20200602233844_create_shared_extensions_schema.rb index 9c34019b6..41c5db2ec 100644 --- a/db/migrate/20200602233844_create_shared_extensions_schema.rb +++ b/db/migrate/20200602233844_create_shared_extensions_schema.rb @@ -66,7 +66,7 @@ class CreateSharedExtensionsSchema < ActiveRecord::Migration[6.0] execute statement else log_warning( - "GRANT CREATE ON DATABASE #{query_value("SELECT CURRENT_DATABASE()")} "\ + "GRANT CREATE ON DATABASE #{query_value("SELECT CURRENT_DATABASE()")} " \ "TO #{query_value("SELECT CURRENT_USER")}" ) log_warning(statement) diff --git a/lib/census_api.rb b/lib/census_api.rb index be23c9ed5..39ef65c94 100644 --- a/lib/census_api.rb +++ b/lib/census_api.rb @@ -71,11 +71,11 @@ class CensusApi def request(document_type, document_number) { request: { codigo_institucion: Rails.application.secrets.census_api_institution_code, - codigo_portal: Rails.application.secrets.census_api_portal_name, - codigo_usuario: Rails.application.secrets.census_api_user_code, - documento: document_number, - tipo_documento: document_type, - codigo_idioma: 102, + codigo_portal: Rails.application.secrets.census_api_portal_name, + codigo_usuario: Rails.application.secrets.census_api_user_code, + documento: document_number, + tipo_documento: document_type, + codigo_idioma: 102, nivel: 3 }} end diff --git a/lib/markdown_converter.rb b/lib/markdown_converter.rb index d5d9845f0..66ad2a701 100644 --- a/lib/markdown_converter.rb +++ b/lib/markdown_converter.rb @@ -28,21 +28,21 @@ class MarkdownConverter def default_render_options { - filter_html: false, - hard_wrap: true, + filter_html: false, + hard_wrap: true, link_attributes: { target: "_blank" } } end def extensions { - autolink: true, + autolink: true, fenced_code_blocks: true, - lax_spacing: true, - no_intra_emphasis: true, - strikethrough: true, - superscript: true, - tables: true + lax_spacing: true, + no_intra_emphasis: true, + strikethrough: true, + superscript: true, + tables: true } end end diff --git a/lib/omniauth_wordpress.rb b/lib/omniauth_wordpress.rb index 1131626db..dc0ec1f6c 100644 --- a/lib/omniauth_wordpress.rb +++ b/lib/omniauth_wordpress.rb @@ -13,10 +13,10 @@ module OmniAuth info do { - name: raw_info["display_name"], - email: raw_info["user_email"], - nickname: raw_info["user_nicename"], - urls: { "Website" => raw_info["user_url"] } + name: raw_info["display_name"], + email: raw_info["user_email"], + nickname: raw_info["user_nicename"], + urls: { "Website" => raw_info["user_url"] } } end diff --git a/lib/sms_api.rb b/lib/sms_api.rb index 84389123f..d6373e934 100644 --- a/lib/sms_api.rb +++ b/lib/sms_api.rb @@ -24,7 +24,7 @@ class SMSApi end def request(phone, code) - { autorizacion: authorization, + { autorizacion: authorization, destinatarios: { destinatario: phone }, texto_mensaje: "Clave para verificarte: #{code}. Gobierno Abierto", solicita_notificacion: "All" } diff --git a/spec/components/budgets/budget_component_spec.rb b/spec/components/budgets/budget_component_spec.rb index bbbe4de33..0119c9330 100644 --- a/spec/components/budgets/budget_component_spec.rb +++ b/spec/components/budgets/budget_component_spec.rb @@ -61,7 +61,7 @@ describe Budgets::BudgetComponent do render_inline Budgets::BudgetComponent.new(budget) expect(page).to have_css ".budget-header.with-background-image" - expect(page).to have_css ".budget-header[style*='background-image:']"\ + expect(page).to have_css ".budget-header[style*='background-image:']" \ "[style*='url(\\''][style*='clippy(with_brackets).jpg\\'']" end @@ -71,7 +71,7 @@ describe Budgets::BudgetComponent do render_inline Budgets::BudgetComponent.new(budget) expect(page).to have_css ".budget-header.with-background-image" - expect(page).to have_css ".budget-header[style*='background-image:']"\ + expect(page).to have_css ".budget-header[style*='background-image:']" \ "[style*='url(\\''][style*='clippy_with_\\\\\'quotes\\\\\'.jpg']" end end diff --git a/spec/components/relationable/related_list_component_spec.rb b/spec/components/relationable/related_list_component_spec.rb index 05e34e62c..c543c7a5f 100644 --- a/spec/components/relationable/related_list_component_spec.rb +++ b/spec/components/relationable/related_list_component_spec.rb @@ -12,8 +12,8 @@ describe Relationable::RelatedListComponent do create(:related_content, parent_relationable: proposal, child_relationable: user_proposal) create(:related_content, parent_relationable: proposal, - child_relationable: machine_proposal, - machine_learning: true) + child_relationable: machine_proposal, + machine_learning: true) end it "displays machine learning and user content when machine learning is enabled" do diff --git a/spec/components/sdg/tag_list_component_spec.rb b/spec/components/sdg/tag_list_component_spec.rb index d61f3029d..cc43c0c0e 100644 --- a/spec/components/sdg/tag_list_component_spec.rb +++ b/spec/components/sdg/tag_list_component_spec.rb @@ -3,9 +3,8 @@ require "rails_helper" describe SDG::TagListComponent do let(:debate) do create(:debate, - sdg_goals: [SDG::Goal[3]], - sdg_targets: [SDG::Target[3.2], create(:sdg_local_target, code: "3.2.1")] - ) + sdg_goals: [SDG::Goal[3]], + sdg_targets: [SDG::Target[3.2], create(:sdg_local_target, code: "3.2.1")]) end let(:component) { SDG::TagListComponent.new(debate) } diff --git a/spec/components/sdg/targets/plain_tag_list_component_spec.rb b/spec/components/sdg/targets/plain_tag_list_component_spec.rb index 9606153b9..722bfdb3f 100644 --- a/spec/components/sdg/targets/plain_tag_list_component_spec.rb +++ b/spec/components/sdg/targets/plain_tag_list_component_spec.rb @@ -3,8 +3,7 @@ require "rails_helper" describe SDG::Targets::PlainTagListComponent do let(:debate) do create(:debate, - sdg_targets: [SDG::Target[1.1], SDG::Target[3.2], create(:sdg_local_target, code: "3.2.1")] - ) + sdg_targets: [SDG::Target[1.1], SDG::Target[3.2], create(:sdg_local_target, code: "3.2.1")]) end let(:component) { SDG::Targets::PlainTagListComponent.new(debate) } @@ -58,7 +57,7 @@ describe SDG::Targets::PlainTagListComponent do expect(page).to have_css "li", text: "target 1.1" expect(page).to have_selector "a", count: 1 expect(page).to have_link "2+", - title: "2 more targets", - href: "/debates/#{debate.to_param}" + title: "2 more targets", + href: "/debates/#{debate.to_param}" end end diff --git a/spec/components/sdg/targets/tag_list_component_spec.rb b/spec/components/sdg/targets/tag_list_component_spec.rb index db8a7bcff..5ae7f7b89 100644 --- a/spec/components/sdg/targets/tag_list_component_spec.rb +++ b/spec/components/sdg/targets/tag_list_component_spec.rb @@ -3,8 +3,7 @@ require "rails_helper" describe SDG::Targets::TagListComponent do let(:debate) do create(:debate, - sdg_targets: [SDG::Target[1.1], SDG::Target[3.2], create(:sdg_local_target, code: "3.2.1")] - ) + sdg_targets: [SDG::Target[1.1], SDG::Target[3.2], create(:sdg_local_target, code: "3.2.1")]) end let(:component) { SDG::Targets::TagListComponent.new(debate) } @@ -40,14 +39,14 @@ describe SDG::Targets::TagListComponent do expect(page).to have_css "li", count: 3 expect(page).to have_link "target 1.1", - title: "See all Debates related to target 1.1", - href: "/debates?advanced_search#{CGI.escape("[target]")}=1.1" + title: "See all Debates related to target 1.1", + href: "/debates?advanced_search#{CGI.escape("[target]")}=1.1" expect(page).to have_link "target 3.2", - title: "See all Debates related to target 3.2", - href: "/debates?advanced_search#{CGI.escape("[target]")}=3.2" + title: "See all Debates related to target 3.2", + href: "/debates?advanced_search#{CGI.escape("[target]")}=3.2" expect(page).to have_link "target 3.2.1", - title: "See all Debates related to target 3.2.1", - href: "/debates?advanced_search#{CGI.escape("[target]")}=3.2.1" + title: "See all Debates related to target 3.2.1", + href: "/debates?advanced_search#{CGI.escape("[target]")}=3.2.1" end it "orders targets by code" do @@ -64,7 +63,7 @@ describe SDG::Targets::TagListComponent do expect(page).to have_selector "a", count: 2 expect(page).to have_link "target 1.1" expect(page).to have_link "2+", - title: "2 more targets", - href: "/debates/#{debate.to_param}" + title: "2 more targets", + href: "/debates/#{debate.to_param}" end end diff --git a/spec/components/shared/banner_component_spec.rb b/spec/components/shared/banner_component_spec.rb index 5723dd54c..ef36de26a 100644 --- a/spec/components/shared/banner_component_spec.rb +++ b/spec/components/shared/banner_component_spec.rb @@ -5,12 +5,11 @@ describe Shared::BannerComponent do banner = create(:banner, title: "Vote now!", description: "Banner description", - target_url: "http://www.url.com", + target_url: "http://www.url.com", post_started_at: (Date.current - 4.days), - post_ended_at: (Date.current + 10.days), + post_ended_at: (Date.current + 10.days), background_color: "#FF0000", - font_color: "#FFFFFF" - ) + font_color: "#FFFFFF") render_inline Shared::BannerComponent.new(banner) @@ -38,15 +37,13 @@ describe Shared::BannerComponent do web_sections: [WebSection.find_by!(name: "debates")], title: "First banner", description: "First description", - target_url: "/first_target" - ) + target_url: "/first_target") create(:banner, web_sections: [WebSection.find_by!(name: "debates")], title: "Second banner", description: "Second description", - target_url: "/second_target" - ) + target_url: "/second_target") end it "only renders one banner" do diff --git a/spec/components/shared/link_list_component_spec.rb b/spec/components/shared/link_list_component_spec.rb index 93e57cb01..962f07c30 100644 --- a/spec/components/shared/link_list_component_spec.rb +++ b/spec/components/shared/link_list_component_spec.rb @@ -18,9 +18,12 @@ describe Shared::LinkListComponent do ["Home", "/"], ["Info", "/info"], class: "menu" ) - expect(page).to be_rendered with: '\n" + expect(page).to be_rendered with: <<~HTML + + HTML end it "accepts anchor tags" do @@ -28,9 +31,12 @@ describe Shared::LinkListComponent do 'Home'.html_safe, ["Info", "/info"], class: "menu" ) - expect(page).to be_rendered with: '\n" + expect(page).to be_rendered with: <<~HTML + + HTML end it "accepts options for links" do diff --git a/spec/components/valuation/budgets/row_component_spec.rb b/spec/components/valuation/budgets/row_component_spec.rb index 63d0e7370..212096a82 100644 --- a/spec/components/valuation/budgets/row_component_spec.rb +++ b/spec/components/valuation/budgets/row_component_spec.rb @@ -30,9 +30,9 @@ describe Valuation::Budgets::RowComponent do it "does not count investments with valuation finished" do budget = create(:budget, :valuating) create(:budget_investment, :visible_to_valuators, - budget: budget, - valuators: [valuator], - valuation_finished: true) + budget: budget, + valuators: [valuator], + valuation_finished: true) render_inline Valuation::Budgets::RowComponent.new(budget: budget) @@ -81,9 +81,9 @@ describe Valuation::Budgets::RowComponent do it "is shown when the assigned investments have finished valuation" do budget = create(:budget, :valuating) create(:budget_investment, :visible_to_valuators, - budget: budget, - valuators: [valuator], - valuation_finished: true) + budget: budget, + valuators: [valuator], + valuation_finished: true) render_inline Valuation::Budgets::RowComponent.new(budget: budget) diff --git a/spec/controllers/admin/poll/questions/answers/videos_controller_spec.rb b/spec/controllers/admin/poll/questions/answers/videos_controller_spec.rb index 65c5dc1f8..6a2e7bcf4 100644 --- a/spec/controllers/admin/poll/questions/answers/videos_controller_spec.rb +++ b/spec/controllers/admin/poll/questions/answers/videos_controller_spec.rb @@ -8,10 +8,10 @@ describe Admin::Poll::Questions::Answers::VideosController, :admin do it "is not possible for an already started poll" do post :create, params: { poll_question_answer_video: { - title: "Video from started poll", - url: "https://www.youtube.com/watch?v=-JMf43st-1A" - }, - answer_id: current_answer + title: "Video from started poll", + url: "https://www.youtube.com/watch?v=-JMf43st-1A" + }, + answer_id: current_answer } expect(flash[:alert]).to eq "You do not have permission to carry out the action 'create' on Video." @@ -21,8 +21,8 @@ describe Admin::Poll::Questions::Answers::VideosController, :admin do it "is possible for a not started poll" do post :create, params: { poll_question_answer_video: { - title: "Video from not started poll", - url: "https://www.youtube.com/watch?v=-JMf43st-1A" + title: "Video from not started poll", + url: "https://www.youtube.com/watch?v=-JMf43st-1A" }, answer_id: future_answer } diff --git a/spec/controllers/comments_controller_spec.rb b/spec/controllers/comments_controller_spec.rb index 33aaf7047..dc7421110 100644 --- a/spec/controllers/comments_controller_spec.rb +++ b/spec/controllers/comments_controller_spec.rb @@ -4,7 +4,7 @@ describe CommentsController do describe "POST create" do let(:legal_process) do create(:legislation_process, debate_start_date: Date.current - 3.days, - debate_end_date: Date.current + 2.days) + debate_end_date: Date.current + 2.days) end let(:question) { create(:legislation_question, process: legal_process, title: "Question 1") } let(:user) { create(:user, :level_two) } @@ -53,13 +53,13 @@ describe CommentsController do expect do post :create, xhr: true, - params: { - comment: { - commentable_id: annotation.id, - commentable_type: "Legislation::Annotation", - body: "a comment" - } - } + params: { + comment: { + commentable_id: annotation.id, + commentable_type: "Legislation::Annotation", + body: "a comment" + } + } end.not_to change { annotation.reload.comments_count } end diff --git a/spec/controllers/legislation/annotations_controller_spec.rb b/spec/controllers/legislation/annotations_controller_spec.rb index 3700c794c..575e9626d 100644 --- a/spec/controllers/legislation/annotations_controller_spec.rb +++ b/spec/controllers/legislation/annotations_controller_spec.rb @@ -25,7 +25,7 @@ describe Legislation::AnnotationsController do describe "POST create" do let(:legal_process) do create(:legislation_process, allegations_start_date: Date.current - 3.days, - allegations_end_date: Date.current + 2.days) + allegations_end_date: Date.current + 2.days) end let(:draft_version) do create(:legislation_draft_version, :published, process: legal_process, title: "Version 1") @@ -40,19 +40,19 @@ describe Legislation::AnnotationsController do sign_in user post :create, params: { - process_id: legal_process.id, - draft_version_id: draft_version.id, - legislation_annotation: { - "quote" => "ipsum", - "ranges" => [{ - "start" => "/p[1]", - "startOffset" => 6, - "end" => "/p[1]", - "endOffset" => 11 - }], - "text" => "una anotacion" - } - } + process_id: legal_process.id, + draft_version_id: draft_version.id, + legislation_annotation: { + "quote" => "ipsum", + "ranges" => [{ + "start" => "/p[1]", + "startOffset" => 6, + "end" => "/p[1]", + "endOffset" => 11 + }], + "text" => "una anotacion" + } + } expect(Ahoy::Event.where(name: :legislation_annotation_created).count).to eq 1 expect(Ahoy::Event.last.properties["legislation_annotation_id"]).to eq Legislation::Annotation.last.id end @@ -61,19 +61,19 @@ describe Legislation::AnnotationsController do sign_in user post :create, params: { - process_id: legal_process.id, - draft_version_id: final_version.id, - legislation_annotation: { - "quote" => "ipsum", - "ranges" => [{ - "start" => "/p[1]", - "startOffset" => 6, - "end" => "/p[1]", - "endOffset" => 11 - }], - "text" => "una anotacion" - } - } + process_id: legal_process.id, + draft_version_id: final_version.id, + legislation_annotation: { + "quote" => "ipsum", + "ranges" => [{ + "start" => "/p[1]", + "startOffset" => 6, + "end" => "/p[1]", + "endOffset" => 11 + }], + "text" => "una anotacion" + } + } expect(response).to have_http_status(:not_found) end @@ -87,14 +87,14 @@ describe Legislation::AnnotationsController do process_id: legal_process.id, draft_version_id: draft_version.id, legislation_annotation: { - "quote" => "ipsum", + "quote" => "ipsum", "ranges" => [{ - "start" => "/p[1]", - "startOffset" => 6, - "end" => "/p[1]", - "endOffset" => 11 - }], - "text" => "una anotacion" + "start" => "/p[1]", + "startOffset" => 6, + "end" => "/p[1]", + "endOffset" => 11 + }], + "text" => "una anotacion" } } end.to change { draft_version.annotations.count }.by(1) @@ -112,11 +112,11 @@ describe Legislation::AnnotationsController do legislation_annotation: { "quote" => "ipsum", "ranges" => [{ - "start" => "/p[1]", - "startOffset" => 6, - "end" => "/p[1]", - "endOffset" => 11 - }], + "start" => "/p[1]", + "startOffset" => 6, + "end" => "/p[1]", + "endOffset" => 11 + }], "text" => "una anotacion" } } @@ -132,14 +132,14 @@ describe Legislation::AnnotationsController do process_id: legal_process.id, draft_version_id: draft_version.id, legislation_annotation: { - "quote" => "ipsum", + "quote" => "ipsum", "ranges" => [{ - "start" => "/p[1]", - "startOffset" => 6, - "end" => "/p[1]", - "endOffset" => 11 - }].to_json, - "text" => "una anotacion" + "start" => "/p[1]", + "startOffset" => 6, + "end" => "/p[1]", + "endOffset" => 11 + }].to_json, + "text" => "una anotacion" } } end.to change { draft_version.annotations.count }.by(1) @@ -149,15 +149,15 @@ describe Legislation::AnnotationsController do annotation = create(:legislation_annotation, draft_version: draft_version, text: "my annotation", ranges: [{ - "start" => "/p[1]", - "startOffset" => 6, - "end" => "/p[1]", - "endOffset" => 11 - }], - range_start: "/p[1]", + "start" => "/p[1]", + "startOffset" => 6, + "end" => "/p[1]", + "endOffset" => 11 + }], + range_start: "/p[1]", range_start_offset: 6, - range_end: "/p[1]", - range_end_offset: 11) + range_end: "/p[1]", + range_end_offset: 11) sign_in user expect do @@ -166,14 +166,14 @@ describe Legislation::AnnotationsController do process_id: legal_process.id, draft_version_id: draft_version.id, legislation_annotation: { - "quote" => "ipsum", + "quote" => "ipsum", "ranges" => [{ - "start" => "/p[1]", - "startOffset" => 6, - "end" => "/p[1]", - "endOffset" => 11 - }], - "text" => "una anotacion" + "start" => "/p[1]", + "startOffset" => 6, + "end" => "/p[1]", + "endOffset" => 11 + }], + "text" => "una anotacion" } } end.not_to change { draft_version.annotations.count } diff --git a/spec/controllers/legislation/answers_controller_spec.rb b/spec/controllers/legislation/answers_controller_spec.rb index e05731801..04bc21dce 100644 --- a/spec/controllers/legislation/answers_controller_spec.rb +++ b/spec/controllers/legislation/answers_controller_spec.rb @@ -4,7 +4,7 @@ describe Legislation::AnswersController do describe "POST create" do let(:legal_process) do create(:legislation_process, debate_start_date: Date.current - 3.days, - debate_end_date: Date.current + 2.days) + debate_end_date: Date.current + 2.days) end let(:question) { create(:legislation_question, process: legal_process, title: "Question 1") } let(:question_option) { create(:legislation_question_option, question: question, value: "Yes") } @@ -14,12 +14,12 @@ describe Legislation::AnswersController do sign_in user post :create, params: { - process_id: legal_process.id, - question_id: question.id, - legislation_answer: { - legislation_question_option_id: question_option.id - } - } + process_id: legal_process.id, + question_id: question.id, + legislation_answer: { + legislation_question_option_id: question_option.id + } + } expect(Ahoy::Event.where(name: :legislation_answer_created).count).to eq 1 expect(Ahoy::Event.last.properties["legislation_answer_id"]).to eq Legislation::Answer.last.id end diff --git a/spec/controllers/management/sessions_controller_spec.rb b/spec/controllers/management/sessions_controller_spec.rb index ed6a32674..76e1cb4ee 100644 --- a/spec/controllers/management/sessions_controller_spec.rb +++ b/spec/controllers/management/sessions_controller_spec.rb @@ -16,10 +16,10 @@ describe Management::SessionsController do allow_any_instance_of(ManagerAuthenticator).to receive(:auth).and_return(manager) get :create, params: { - login: "JJB033", - clave_usuario: "31415926", - fecha_conexion: "20151031135905" - } + login: "JJB033", + clave_usuario: "31415926", + fecha_conexion: "20151031135905" + } expect(response).to be_redirect expect(session[:manager][:login]).to eq "JJB033" end diff --git a/spec/factories/legislations.rb b/spec/factories/legislations.rb index 3c1dbe41b..4ae250317 100644 --- a/spec/factories/legislations.rb +++ b/spec/factories/legislations.rb @@ -134,7 +134,7 @@ FactoryBot.define do |----|---------|-----|--------| | 1 | Roberta | 39 | M | | 2 | Oliver | 25 | F | - BODY_MARKDOWN + BODY_MARKDOWN end end diff --git a/spec/factories/polls.rb b/spec/factories/polls.rb index ed493c21c..0819457b9 100644 --- a/spec/factories/polls.rb +++ b/spec/factories/polls.rb @@ -179,8 +179,8 @@ FactoryBot.define do officer_assignment do association :poll_officer_assignment, - booth_assignment: booth_assignment, - officer: officer || association(:poll_officer) + booth_assignment: booth_assignment, + officer: officer || association(:poll_officer) end end diff --git a/spec/factories/sdg.rb b/spec/factories/sdg.rb index 1f933eb04..7a0b9efbd 100644 --- a/spec/factories/sdg.rb +++ b/spec/factories/sdg.rb @@ -22,7 +22,7 @@ FactoryBot.define do factory :sdg_review, class: "SDG::Review" do SDG::Related::RELATABLE_TYPES.map { |relatable_type| relatable_type.downcase.gsub("::", "_") } - .each do |relatable| + .each do |relatable| trait :"#{relatable}_review" do association :relatable, factory: relatable end diff --git a/spec/i18n_spec.rb b/spec/i18n_spec.rb index 0d8c5a0c2..41bc9fc28 100644 --- a/spec/i18n_spec.rb +++ b/spec/i18n_spec.rb @@ -8,12 +8,12 @@ describe "I18n" do it "does not have missing keys" do expect(missing_keys).to be_empty, - "Missing #{missing_keys.leaves.count} i18n keys, run `i18n-tasks missing' to show them" + "Missing #{missing_keys.leaves.count} i18n keys, run `i18n-tasks missing' to show them" end it "does not have unused keys" do expect(unused_keys).to be_empty, - "#{unused_keys.leaves.count} unused i18n keys, run `i18n-tasks unused' to show them" + "#{unused_keys.leaves.count} unused i18n keys, run `i18n-tasks unused' to show them" end context "Plurals" do diff --git a/spec/lib/remote_census_api_spec.rb b/spec/lib/remote_census_api_spec.rb index 616dfdce5..151eac9cb 100644 --- a/spec/lib/remote_census_api_spec.rb +++ b/spec/lib/remote_census_api_spec.rb @@ -36,7 +36,7 @@ describe RemoteCensusApi do params = { "document_type" => "1", "date_of_birth" => "1980-12-31", - "postal_code" => "28013" + "postal_code" => "28013" } savon.expects(:verify_residence) @@ -79,8 +79,8 @@ describe RemoteCensusApi do params = { "document_type" => "1", "date_of_birth" => "1980-12-31", - "postal_code" => "28013", - "api_key" => "your_api_key" + "postal_code" => "28013", + "api_key" => "your_api_key" } savon.expects(:verify_residence) diff --git a/spec/lib/remote_translations/caller_spec.rb b/spec/lib/remote_translations/caller_spec.rb index b24307cb9..76bc49695 100644 --- a/spec/lib/remote_translations/caller_spec.rb +++ b/spec/lib/remote_translations/caller_spec.rb @@ -220,8 +220,8 @@ describe RemoteTranslations::Caller, :remote_translations do locale = remote_translation.locale fake_response = ["translated title", "translated description", "translated summary", nil] - expect_any_instance_of(client).to receive(:call).with(field_values_sanitized, locale). - and_return(fake_response) + expect_any_instance_of(client).to receive(:call).with(field_values_sanitized, locale) + .and_return(fake_response) caller.call end diff --git a/spec/lib/remote_translations/microsoft/client_spec.rb b/spec/lib/remote_translations/microsoft/client_spec.rb index 903a2ad21..0b9b4c731 100644 --- a/spec/lib/remote_translations/microsoft/client_spec.rb +++ b/spec/lib/remote_translations/microsoft/client_spec.rb @@ -62,13 +62,13 @@ describe RemoteTranslations::Microsoft::Client do response_end_text = [end_translated_text_es] expect_any_instance_of(BingTranslator).to receive(:translate_array).with([start_text_en], to: :es) - .exactly(1) - .times - .and_return(response_start_text) + .exactly(1) + .times + .and_return(response_start_text) expect_any_instance_of(BingTranslator).to receive(:translate_array).with([end_text_en], to: :es) - .exactly(1) - .times - .and_return(response_end_text) + .exactly(1) + .times + .and_return(response_end_text) start_another_text_en = Faker::Lorem.characters(number: 12) + "." end_another_text_en = Faker::Lorem.characters(number: 12) @@ -81,13 +81,13 @@ describe RemoteTranslations::Microsoft::Client do response_another_end_text = [another_end_translated_text_es] expect_any_instance_of(BingTranslator).to receive(:translate_array).with([start_another_text_en], to: :es) - .exactly(1) - .times - .and_return(response_another_start_text) + .exactly(1) + .times + .and_return(response_another_start_text) expect_any_instance_of(BingTranslator).to receive(:translate_array).with([end_another_text_en], to: :es) - .exactly(1) - .times - .and_return(response_another_end_text) + .exactly(1) + .times + .and_return(response_another_end_text) result = client.call([text_en, another_text_en], :es) diff --git a/spec/lib/tasks/seed_spec.rb b/spec/lib/tasks/seed_spec.rb index c7cad5ff0..d739dc9ed 100644 --- a/spec/lib/tasks/seed_spec.rb +++ b/spec/lib/tasks/seed_spec.rb @@ -5,13 +5,15 @@ describe "rake db:seed" do default_locales = I18n.available_locales begin I18n.available_locales = [:ar, :bg, :bs, :ca, :cs, :da, :de, :el, :en, :es, :"es-PE", :eu, :fa, :fr, - :gl, :he, :hr, :id, :it, :ka, :nl, :oc, :pl, :"pt-BR", - :ro, :ru, :sl, :sq, :so, :sr, :sv, :tr, :val, :"zh-CN", :"zh-TW"] + :gl, :he, :hr, :id, :it, :ka, :nl, :oc, :pl, :"pt-BR", + :ro, :ru, :sl, :sq, :so, :sr, :sv, :tr, :val, :"zh-CN", :"zh-TW"] SiteCustomization::Page.destroy_all load Rails.root.join("db", "pages.rb") - paths = { accessibility: "pages.accessibility.title", conditions: "pages.conditions.title", - faq: "pages.help.faq.page.title", privacy: "pages.privacy.title", + paths = { accessibility: "pages.accessibility.title", + conditions: "pages.conditions.title", + faq: "pages.help.faq.page.title", + privacy: "pages.privacy.title", welcome_not_verified: "welcome.welcome.title", welcome_level_two_verified: "welcome.welcome.title", welcome_level_three_verified: "welcome.welcome.title" } diff --git a/spec/mailers/dashboard/mailer_spec.rb b/spec/mailers/dashboard/mailer_spec.rb index 5cc59d23c..c3515c00a 100644 --- a/spec/mailers/dashboard/mailer_spec.rb +++ b/spec/mailers/dashboard/mailer_spec.rb @@ -73,36 +73,36 @@ describe Dashboard::Mailer do expect(email).to deliver_to(proposal.author) expect(email).to have_subject("Your draft citizen proposal is created") expect(email).to have_body_text("Hi #{proposal.author.name}!") - expect(email).to have_body_text("Your #{proposal.title} proposal has been "\ + expect(email).to have_body_text("Your #{proposal.title} proposal has been " \ "successfully created.") - expect(email).to have_body_text("Take advantage that your proposal is not public yet and "\ + expect(email).to have_body_text("Take advantage that your proposal is not public yet and " \ "get ready to contact a lot of people.") expect(email).to have_body_text("When you are ready publish your citizen proposal from this") expect(email).to have_link "link", href: proposal_dashboard_url(proposal) - expect(email).to have_body_text("We know that creating a proposal with a hook and getting "\ - "the necessary support can seem complicated. But don't "\ + expect(email).to have_body_text("We know that creating a proposal with a hook and getting " \ + "the necessary support can seem complicated. But don't " \ "worry because we are going to help you!") - expect(email).to have_body_text("You have a tool that will be your new best ally: "\ + expect(email).to have_body_text("You have a tool that will be your new best ally: " \ "The Citizen Proposals panel.") - expect(email).to have_body_text("Enter every day in the panel of your proposal to use the "\ + expect(email).to have_body_text("Enter every day in the panel of your proposal to use the " \ "tips and resources that we will share with you.") - expect(email).to have_body_text("These tips, actions and resources will give you ideas and "\ - "also practical solutions to get more support and a wider "\ + expect(email).to have_body_text("These tips, actions and resources will give you ideas and " \ + "also practical solutions to get more support and a wider " \ "community. Dont forget them!") - expect(email).to have_body_text("As you gain more support, you will unlock new and better "\ - "resources. At the moment, you have an e-mail template to "\ - "send massively to all your contacts, a poster to print, "\ - "among other features and rewards that you will discover. "\ - "Dont stop adding support and we will not stop rewarding "\ + expect(email).to have_body_text("As you gain more support, you will unlock new and better " \ + "resources. At the moment, you have an e-mail template to " \ + "send massively to all your contacts, a poster to print, " \ + "among other features and rewards that you will discover. " \ + "Dont stop adding support and we will not stop rewarding " \ "and helping you!") - expect(email).to have_body_text("You have #{Setting["months_to_archive_proposals"]} months "\ - "since you publish the proposal to get "\ - "#{Setting["votes_for_proposal_success"]} support and your "\ - "proposal can become a reality. But the first days are the "\ + expect(email).to have_body_text("You have #{Setting["months_to_archive_proposals"]} months " \ + "since you publish the proposal to get " \ + "#{Setting["votes_for_proposal_success"]} support and your " \ + "proposal can become a reality. But the first days are the " \ "most important. It is a challenge. Get ready!") expect(email).to have_body_text("And for you to start with all the motivation,") - expect(email).to have_body_text("here you have several resources and a whole list of "\ - "tips that will come to you every day to prepare the "\ + expect(email).to have_body_text("here you have several resources and a whole list of " \ + "tips that will come to you every day to prepare the " \ "broadcast!") expect(email).to have_body_text("Go ahead, discover them!") end @@ -135,33 +135,33 @@ describe Dashboard::Mailer do expect(email).to deliver_from("CONSUL ") expect(email).to deliver_to(proposal.author) - expect(email).to have_subject("Your citizen proposal is already "\ + expect(email).to have_subject("Your citizen proposal is already " \ "published. Don't stop spreading!") - expect(email).to have_body_text("Congratulations #{proposal.author.name}! Your proposal "\ + expect(email).to have_body_text("Congratulations #{proposal.author.name}! Your proposal " \ "#{proposal.title} has been created successfully.") expect(email).to have_body_text("And now, go for your first 100 supports!") expect(email).to have_body_text("Why 100?") - expect(email).to have_body_text("Our experience tells us that the first day is fundamental. "\ - "Because in addition to having the energy to launch "\ - "something new, being a newly published proposal, you will "\ - "have the important visibility of being among the new "\ + expect(email).to have_body_text("Our experience tells us that the first day is fundamental. " \ + "Because in addition to having the energy to launch " \ + "something new, being a newly published proposal, you will " \ + "have the important visibility of being among the new " \ "proposals highlighted.") - expect(email).to have_body_text("Get 100 supports on the first day, and you will have "\ + expect(email).to have_body_text("Get 100 supports on the first day, and you will have " \ "a first community to back you up.") - expect(email).to have_body_text("That is why we challenge you to get it, but not without "\ + expect(email).to have_body_text("That is why we challenge you to get it, but not without " \ "a lot of help!") - expect(email).to have_body_text("Remember that in your Proposal Panel you have new "\ - "resources available and recommendations for "\ + expect(email).to have_body_text("Remember that in your Proposal Panel you have new " \ + "resources available and recommendations for " \ "dissemination actions.") - expect(email).to have_body_text("Come in every day to see your progress and use the tips "\ - "and resources we will share with you. They are ideas and "\ + expect(email).to have_body_text("Come in every day to see your progress and use the tips " \ + "and resources we will share with you. They are ideas and " \ "also practical solutions to get the support you need.") - expect(email).to have_body_text("As you get more support, you will unlock new and better "\ - "resources. Do not stop adding support and we will not stop "\ + expect(email).to have_body_text("As you get more support, you will unlock new and better " \ + "resources. Do not stop adding support and we will not stop " \ "rewarding and helping you!") expect(email).to have_body_text("And for you to start at full speed...") expect(email).to have_body_text("Here is a great resource at your disposal!") - expect(email).to have_body_text("You will also find this new recommended dissemination "\ + expect(email).to have_body_text("You will also find this new recommended dissemination " \ "action...") expect(email).to have_body_text("You sure have more resources to use!") expect(email).to have_body_text("Go ahead, discover them!") diff --git a/spec/models/budget/ballot/line_spec.rb b/spec/models/budget/ballot/line_spec.rb index 329b48e38..d89fcb01d 100644 --- a/spec/models/budget/ballot/line_spec.rb +++ b/spec/models/budget/ballot/line_spec.rb @@ -52,7 +52,7 @@ describe Budget::Ballot::Line do it "is not valid if there are no votes left" do create(:budget_ballot_line, ballot: ballot, - investment: create(:budget_investment, :selected, heading: heading)) + investment: create(:budget_investment, :selected, heading: heading)) expect(ballot_line).not_to be_valid end diff --git a/spec/models/budget/heading_spec.rb b/spec/models/budget/heading_spec.rb index 185b88084..25d8646c2 100644 --- a/spec/models/budget/heading_spec.rb +++ b/spec/models/budget/heading_spec.rb @@ -223,7 +223,7 @@ describe Budget::Heading do it "Allows longitude inside [-180,180] interval" do heading = create(:budget_heading, group: group, - name: "Longitude is inside [-180,180] interval") + name: "Longitude is inside [-180,180] interval") heading.longitude = "180" expect(heading).to be_valid diff --git a/spec/models/budget/phase_spec.rb b/spec/models/budget/phase_spec.rb index 9342f3d22..0e13d11ab 100644 --- a/spec/models/budget/phase_spec.rb +++ b/spec/models/budget/phase_spec.rb @@ -175,8 +175,8 @@ describe Budget::Phase do describe "when being enabled" do before do accepting_phase.update!(enabled: false, - starts_at: Date.current, - ends_at: Date.current + 2.days) + starts_at: Date.current, + ends_at: Date.current + 2.days) end it "adjusts previous enabled phase end date to its own start date" do @@ -211,16 +211,16 @@ describe Budget::Phase do it "doesn't adjust previous enabled phase end date to its own start date" do expect do accepting_phase.update(enabled: false, - starts_at: Date.current, - ends_at: Date.current + 2.days) + starts_at: Date.current, + ends_at: Date.current + 2.days) end.not_to change { prev_enabled_phase.ends_at } end it "adjusts next enabled phase start date to its own start date" do expect do accepting_phase.update(enabled: false, - starts_at: Date.current, - ends_at: Date.current + 2.days) + starts_at: Date.current, + ends_at: Date.current + 2.days) end.to change { next_enabled_phase.starts_at.to_date }.to(Date.current) end end diff --git a/spec/models/budget/stats_spec.rb b/spec/models/budget/stats_spec.rb index c80aff929..476969876 100644 --- a/spec/models/budget/stats_spec.rb +++ b/spec/models/budget/stats_spec.rb @@ -77,8 +77,7 @@ describe Budget::Stats do it "doesn't count nil user ids" do create(:budget_ballot_line, investment: investment, - ballot: create(:budget_ballot, budget: budget.reload, user: nil, physical: true) - ) + ballot: create(:budget_ballot, budget: budget.reload, user: nil, physical: true)) expect(stats.total_participants_vote_phase).to be 0 end diff --git a/spec/models/comment_spec.rb b/spec/models/comment_spec.rb index f98c86172..e5302665b 100644 --- a/spec/models/comment_spec.rb +++ b/spec/models/comment_spec.rb @@ -101,23 +101,23 @@ describe Comment do it "expires cache when the author is hidden" do expect { comment.user.hide } - .to change { [comment.reload.cache_version, comment.author.cache_version] } + .to change { [comment.reload.cache_version, comment.author.cache_version] } end it "expires cache when the author is erased" do expect { comment.user.erase } - .to change { [comment.reload.cache_version, comment.author.cache_version] } + .to change { [comment.reload.cache_version, comment.author.cache_version] } end it "expires cache when the author changes" do expect { comment.user.update(username: "Isabel") } - .to change { [comment.reload.cache_version, comment.author.cache_version] } + .to change { [comment.reload.cache_version, comment.author.cache_version] } end it "expires cache when the author's organization get verified" do create(:organization, user: comment.user) expect { comment.user.organization.verify } - .to change { [comment.reload.cache_version, comment.author.cache_version] } + .to change { [comment.reload.cache_version, comment.author.cache_version] } end end diff --git a/spec/models/dashboard/action_spec.rb b/spec/models/dashboard/action_spec.rb index 5364ff64c..5a10ffdd4 100644 --- a/spec/models/dashboard/action_spec.rb +++ b/spec/models/dashboard/action_spec.rb @@ -290,9 +290,9 @@ describe Dashboard::Action do it "when proposal has been created today and day_offset is valid only for today" do expect(Dashboard::Action.detect_new_actions_since(Date.yesterday, - proposal)).to include(resource.id) + proposal)).to include(resource.id) expect(Dashboard::Action.detect_new_actions_since(Date.yesterday, - proposal)).to include(action.id) + proposal)).to include(action.id) end it "when proposal has received a new vote today" do @@ -302,9 +302,9 @@ describe Dashboard::Action do create(:vote, voter: proposal.author, votable: proposal) expect(Dashboard::Action.detect_new_actions_since(Date.yesterday, - proposal)).to include(action.id) + proposal)).to include(action.id) expect(Dashboard::Action.detect_new_actions_since(Date.yesterday, - proposal)).not_to include(resource.id) + proposal)).not_to include(resource.id) end end @@ -321,9 +321,9 @@ describe Dashboard::Action do it "when day_offset field is valid for today and invalid for yesterday" do expect(Dashboard::Action.detect_new_actions_since(Date.yesterday, - proposal)).to include(resource.id) + proposal)).to include(resource.id) expect(Dashboard::Action.detect_new_actions_since(Date.yesterday, - proposal)).to include(action.id) + proposal)).to include(action.id) end it "when proposal has received a new vote today" do @@ -333,9 +333,9 @@ describe Dashboard::Action do create(:vote, voter: proposal.author, votable: proposal) expect(Dashboard::Action.detect_new_actions_since(Date.yesterday, - proposal)).to include(action.id) + proposal)).to include(action.id) expect(Dashboard::Action.detect_new_actions_since(Date.yesterday, - proposal)).not_to include(resource.id) + proposal)).not_to include(resource.id) end end end diff --git a/spec/models/debate_spec.rb b/spec/models/debate_spec.rb index 4b5564955..68270198d 100644 --- a/spec/models/debate_spec.rb +++ b/spec/models/debate_spec.rb @@ -376,23 +376,23 @@ describe Debate do it "expires cache when the author is hidden" do expect { debate.author.hide } - .to change { [debate.reload.cache_version, debate.author.cache_version] } + .to change { [debate.reload.cache_version, debate.author.cache_version] } end it "expires cache when the author is erased" do expect { debate.author.erase } - .to change { [debate.reload.cache_version, debate.author.cache_version] } + .to change { [debate.reload.cache_version, debate.author.cache_version] } end it "expires cache when its author changes" do expect { debate.author.update(username: "Eva") } - .to change { [debate.reload.cache_version, debate.author.cache_version] } + .to change { [debate.reload.cache_version, debate.author.cache_version] } end it "expires cache when the author's organization get verified" do create(:organization, user: debate.author) expect { debate.author.organization.verify } - .to change { [debate.reload.cache_version, debate.author.cache_version] } + .to change { [debate.reload.cache_version, debate.author.cache_version] } end end diff --git a/spec/models/geozone_spec.rb b/spec/models/geozone_spec.rb index 65c269610..c2b441f10 100644 --- a/spec/models/geozone_spec.rb +++ b/spec/models/geozone_spec.rb @@ -73,7 +73,8 @@ describe Geozone do expect(geozone.outline_points).to eq( [[-3.9259027239257, 40.8792937308316], [-3.9249047078766, 40.8788966596619], - [-3.9247799675785, 40.8789131852224]]) + [-3.9247799675785, 40.8789131852224]] + ) end end end diff --git a/spec/models/legislation/annotation_spec.rb b/spec/models/legislation/annotation_spec.rb index 965eac3e8..f0ac81a2e 100644 --- a/spec/models/legislation/annotation_spec.rb +++ b/spec/models/legislation/annotation_spec.rb @@ -10,100 +10,103 @@ RSpec.describe Legislation::Annotation, type: :model do end it "calculates the context for multinode annotations" do - quote = "ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam"\ - " erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex"\ - " ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum"\ - " dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril"\ - " delenit augue duis dolore te feugait nulla facilisi."\ - "\n\n"\ - "Expetenda tincidunt in sed, ex partem placerat sea, porro commodo ex eam. His putant aeterno interesset at. Usu ea mundi"\ - " tincidunt, omnium virtute aliquando ius ex. Ea aperiri sententiae duo. Usu nullam dolorum quaestio ei, sit vidit facilisis"\ - " ea. Per ne impedit iracundia neglegentur. Consetetur neglegentur eum ut, vis animal legimus inimicus id."\ - "\n\n"\ + quote = "ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam" \ + " erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex" \ + " ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum" \ + " dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril" \ + " delenit augue duis dolore te feugait nulla facilisi." \ + "\n\n" \ + "Expetenda tincidunt in sed, ex partem placerat sea, porro commodo ex eam. His putant aeterno interesset at. Usu ea mundi" \ + " tincidunt, omnium virtute aliquando ius ex. Ea aperiri sententiae duo. Usu nullam dolorum quaestio ei, sit vidit facilisis" \ + " ea. Per ne impedit iracundia neglegentur. Consetetur neglegentur eum ut, vis animal legimus inimicus id." \ + "\n\n" \ "His audiam" - annotation = create(:legislation_annotation, + annotation = create( + :legislation_annotation, draft_version: draft_version, quote: quote, ranges: [{ "start" => "/p[1]", "startOffset" => 6, "end" => "/p[3]", "endOffset" => 11 }] ) - context = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt"\ - " ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper"\ - " suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit"\ - " esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui"\ - " blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.\n\nExpetenda tincidunt in sed, ex"\ - " partem placerat sea, porro commodo ex eam. His putant aeterno interesset at. Usu ea mundi tincidunt, omnium virtute"\ - " aliquando ius ex. Ea aperiri sententiae duo. Usu nullam dolorum quaestio ei, sit vidit facilisis ea. Per ne impedit"\ - " iracundia neglegentur. Consetetur neglegentur eum ut, vis animal legimus inimicus id.\n\nHis audiamdeserunt in, eum"\ - " ubique voluptatibus te. In reque dicta usu. Ne rebum dissentiet eam, vim omnis deseruisse id. Ullum deleniti vituperata at"\ - " quo, insolens complectitur te eos, ea pri dico munere propriae. Vel ferri facilis ut, qui paulo ridens praesent ad. Possim"\ + context = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt" \ + " ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper" \ + " suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit" \ + " esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui" \ + " blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.\n\nExpetenda tincidunt in sed, ex" \ + " partem placerat sea, porro commodo ex eam. His putant aeterno interesset at. Usu ea mundi tincidunt, omnium virtute" \ + " aliquando ius ex. Ea aperiri sententiae duo. Usu nullam dolorum quaestio ei, sit vidit facilisis ea. Per ne impedit" \ + " iracundia neglegentur. Consetetur neglegentur eum ut, vis animal legimus inimicus id.\n\nHis audiamdeserunt in, eum" \ + " ubique voluptatibus te. In reque dicta usu. Ne rebum dissentiet eam, vim omnis deseruisse id. Ullum deleniti vituperata at" \ + " quo, insolens complectitur te eos, ea pri dico munere propriae. Vel ferri facilis ut, qui paulo ridens praesent ad. Possim" \ " alterum qui cu. Accusamus consulatu ius te, cu decore soleat appareat usu." expect(annotation.context).to eq(context) end it "calculates the context for multinode annotations 2" do - quote = "Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla"\ - " facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore"\ - " te feugait nulla facilisi.\r\n\r\nExpetenda tincidunt in sed, ex partem placerat sea, porro commodo ex eam. His putant"\ + quote = "Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla" \ + " facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore" \ + " te feugait nulla facilisi.\r\n\r\nExpetenda tincidunt in sed, ex partem placerat sea, porro commodo ex eam. His putant" \ " aeterno interesset at. Usu ea mundi tincidunt, omnium virtute aliquando ius ex. Ea aperiri sententiae duo" - annotation = create(:legislation_annotation, + annotation = create( + :legislation_annotation, draft_version: draft_version, quote: quote, ranges: [{ "start" => "/p[1]", "startOffset" => 273, "end" => "/p[2]", "endOffset" => 190 }] ) - context = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna"\ - " aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut"\ - " aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit"\ - " esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui"\ - " blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.\r\n\r\nExpetenda tincidunt in sed, ex"\ - " partem placerat sea, porro commodo ex eam. His putant aeterno interesset at. Usu ea mundi tincidunt, omnium virtute"\ - " aliquando ius ex. Ea aperiri sententiae duo. Usu nullam dolorum quaestio ei, sit vidit facilisis ea. Per ne impedit"\ + context = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna" \ + " aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut" \ + " aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit" \ + " esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui" \ + " blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.\r\n\r\nExpetenda tincidunt in sed, ex" \ + " partem placerat sea, porro commodo ex eam. His putant aeterno interesset at. Usu ea mundi tincidunt, omnium virtute" \ + " aliquando ius ex. Ea aperiri sententiae duo. Usu nullam dolorum quaestio ei, sit vidit facilisis ea. Per ne impedit" \ " iracundia neglegentur. Consetetur neglegentur eum ut, vis animal legimus inimicus id." expect(annotation.context).to eq(context) end it "calculates the context for multinode annotations 3" do - body = "The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed"\ - " to ensure cooperation with the community in the case of network server software.\r\n\r\nThe licenses for most software and"\ - " other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public"\ - " Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free"\ - " software for all its users.\r\n\r\nWhen we speak of free software, we are referring to freedom, not price. Our General"\ - " Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for"\ - " them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces"\ - " of it in new free programs, and that you know you can do these things.\r\n\r\nDevelopers that use our General Public Licenses"\ - " protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you"\ - " legal permission to copy, distribute and/or modify the software.\r\n\r\nA secondary benefit of defending all users' freedom"\ - " is that improvements made in alternate versions of the program, if they receive widespread use, become available for other"\ - " developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation."\ - " However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License"\ - " permits making a modified version and letting the public access it on a server without ever releasing its source code to the"\ - " public.\r\n\r\nThe GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified"\ - " source code becomes available to the community. It requires the operator of a network server to provide the source code of"\ - " the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly"\ - " accessible server, gives the public access to the source code of the modified version.\r\n\r\nAn older license, called the"\ - " Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license,"\ - " not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this"\ + body = "The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed" \ + " to ensure cooperation with the community in the case of network server software.\r\n\r\nThe licenses for most software and" \ + " other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public" \ + " Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free" \ + " software for all its users.\r\n\r\nWhen we speak of free software, we are referring to freedom, not price. Our General" \ + " Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for" \ + " them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces" \ + " of it in new free programs, and that you know you can do these things.\r\n\r\nDevelopers that use our General Public Licenses" \ + " protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you" \ + " legal permission to copy, distribute and/or modify the software.\r\n\r\nA secondary benefit of defending all users' freedom" \ + " is that improvements made in alternate versions of the program, if they receive widespread use, become available for other" \ + " developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation." \ + " However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License" \ + " permits making a modified version and letting the public access it on a server without ever releasing its source code to the" \ + " public.\r\n\r\nThe GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified" \ + " source code becomes available to the community. It requires the operator of a network server to provide the source code of" \ + " the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly" \ + " accessible server, gives the public access to the source code of the modified version.\r\n\r\nAn older license, called the" \ + " Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license," \ + " not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this" \ " license." draft_version = create(:legislation_draft_version, body: body) - quote = "By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a"\ - " program--to make sure it remains free software for all its users.\r\n\r\nWhen we speak of free software, we are referring to"\ - " freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of"\ + quote = "By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a" \ + " program--to make sure it remains free software for all its users.\r\n\r\nWhen we speak of free software, we are referring to" \ + " freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of" \ " free software (and charge for them if you wish)" - annotation = create(:legislation_annotation, + annotation = create( + :legislation_annotation, draft_version: draft_version, quote: quote, ranges: [{ "start" => "/p[2]", "startOffset" => 127, "end" => "/p[3]", "endOffset" => 223 }] ) - context = "The licenses for most software and other practical works are designed to take away your freedom to share and change the"\ - " works. By contrast, our General Public Licenses are intended to guarantee your freedom to share"\ - " and change all versions of a program--to make sure it remains free software for all its users.\r\n\r\nWhen we speak of"\ - " free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have"\ - " the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code"\ - " or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know"\ + context = "The licenses for most software and other practical works are designed to take away your freedom to share and change the" \ + " works. By contrast, our General Public Licenses are intended to guarantee your freedom to share" \ + " and change all versions of a program--to make sure it remains free software for all its users.\r\n\r\nWhen we speak of" \ + " free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have" \ + " the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code" \ + " or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know" \ " you can do these things." expect(annotation.context).to eq(context) diff --git a/spec/models/legislation/process/phase_spec.rb b/spec/models/legislation/process/phase_spec.rb index 2fc17862a..c51f0a998 100644 --- a/spec/models/legislation/process/phase_spec.rb +++ b/spec/models/legislation/process/phase_spec.rb @@ -37,7 +37,7 @@ RSpec.describe Legislation::Process::Phase, type: :model do # started process.update!(debate_start_date: Date.current - 2.days, - debate_end_date: Date.current + 1.day) + debate_end_date: Date.current + 1.day) expect(process.debate_phase.started?).to be true # starts today diff --git a/spec/models/legislation/process_spec.rb b/spec/models/legislation/process_spec.rb index 5f0e2999c..dde6408b2 100644 --- a/spec/models/legislation/process_spec.rb +++ b/spec/models/legislation/process_spec.rb @@ -181,7 +181,7 @@ describe Legislation::Process do debate_end_date: Date.current - 1.day) expect(process).to be_invalid expect(process.errors.messages[:debate_end_date]) - .to include("must be on or after the debate start date") + .to include("must be on or after the debate start date") end it "is valid if draft_end_date is the same as draft_start_date" do @@ -195,7 +195,7 @@ describe Legislation::Process do draft_end_date: Date.current - 1.day) expect(process).to be_invalid expect(process.errors.messages[:draft_end_date]) - .to include("must be on or after the draft start date") + .to include("must be on or after the draft start date") end it "is invalid if allegations_end_date is before allegations_start_date" do @@ -203,12 +203,12 @@ describe Legislation::Process do allegations_end_date: Date.current - 1.day) expect(process).to be_invalid expect(process.errors.messages[:allegations_end_date]) - .to include("must be on or after the comments start date") + .to include("must be on or after the comments start date") end it "is valid if allegations_end_date is the same as allegations_start_date" do process = build(:legislation_process, allegations_start_date: Date.current - 1.day, - allegations_end_date: Date.current - 1.day) + allegations_end_date: Date.current - 1.day) expect(process).to be_valid end end diff --git a/spec/models/local_census_record_spec.rb b/spec/models/local_census_record_spec.rb index 4cf88a19e..30d4dfd76 100644 --- a/spec/models/local_census_record_spec.rb +++ b/spec/models/local_census_record_spec.rb @@ -41,7 +41,7 @@ describe LocalCensusRecord do it "is not valid when a record already exists with same document_number and document_type" do create(:local_census_record, document_number: "#DOC_NUMBER", document_type: "1") local_census_record = build(:local_census_record, document_number: "#DOC_NUMBER", - document_type: "1") + document_type: "1") expect(local_census_record).not_to be_valid end diff --git a/spec/models/local_census_records/import_spec.rb b/spec/models/local_census_records/import_spec.rb index 7a97f0df5..67a04cdf6 100644 --- a/spec/models/local_census_records/import_spec.rb +++ b/spec/models/local_census_records/import_spec.rb @@ -72,7 +72,7 @@ describe LocalCensusRecords::Import do invalid_records_document_types = [nil, "1", "2", "3", "DNI"] invalid_records_document_numbers = ["44556678T", nil, "22556678T", "X11556678", "Z11556678"] invalid_records_date_of_births = [Date.parse("07/08/1984"), Date.parse("07/08/1985"), nil, - Date.parse("07/08/1987"), Date.parse("07/08/1987")] + Date.parse("07/08/1987"), Date.parse("07/08/1987")] invalid_records_postal_codes = ["7008", "7009", "7010", nil, "7011"] expect(import.invalid_records.map(&:document_type)) .to eq(invalid_records_document_types) @@ -81,7 +81,7 @@ describe LocalCensusRecords::Import do expect(import.invalid_records.map(&:date_of_birth)) .to eq(invalid_records_date_of_births) expect(import.invalid_records.map(&:postal_code)) - .to eq(invalid_records_postal_codes) + .to eq(invalid_records_postal_codes) end end end diff --git a/spec/models/machine_learning_spec.rb b/spec/models/machine_learning_spec.rb index f3f8af8f7..1a0dd1735 100644 --- a/spec/models/machine_learning_spec.rb +++ b/spec/models/machine_learning_spec.rb @@ -522,17 +522,23 @@ describe MachineLearning do machine_learning = MachineLearning.new(job) tags_data = [ - { id: 0, - name: "Existing tag" }, - { id: 1, - name: "Machine learning tag" } + { + id: 0, + name: "Existing tag" + }, + { + id: 1, + name: "Machine learning tag" + } ] taggings_data = [ - { tag_id: 0, + { + tag_id: 0, taggable_id: proposal.id }, - { tag_id: 1, + { + tag_id: 1, taggable_id: proposal.id } ] @@ -564,17 +570,23 @@ describe MachineLearning do machine_learning = MachineLearning.new(job) tags_data = [ - { id: 0, - name: "Existing tag" }, - { id: 1, - name: "Machine learning tag" } + { + id: 0, + name: "Existing tag" + }, + { + id: 1, + name: "Machine learning tag" + } ] taggings_data = [ - { tag_id: 0, + { + tag_id: 0, taggable_id: investment.id }, - { tag_id: 1, + { + tag_id: 1, taggable_id: investment.id } ] diff --git a/spec/models/officing/residence_spec.rb b/spec/models/officing/residence_spec.rb index 621e24ab8..96df02b1d 100644 --- a/spec/models/officing/residence_spec.rb +++ b/spec/models/officing/residence_spec.rb @@ -85,8 +85,8 @@ describe Officing::Residence do describe "dates" do it "is not valid but not because date of birth" do custom_residence = Officing::Residence.new("date_of_birth(3i)" => "1", - "date_of_birth(2i)" => "1", - "date_of_birth(1i)" => "1980") + "date_of_birth(2i)" => "1", + "date_of_birth(1i)" => "1980") expect(custom_residence).not_to be_valid expect(custom_residence.errors[:date_of_birth]).to be_empty @@ -94,8 +94,8 @@ describe Officing::Residence do it "is not valid without a date of birth" do custom_residence = Officing::Residence.new("date_of_birth(3i)" => "", - "date_of_birth(2i)" => "", - "date_of_birth(1i)" => "") + "date_of_birth(2i)" => "", + "date_of_birth(1i)" => "") expect(custom_residence).not_to be_valid expect(custom_residence.errors[:date_of_birth]).to include("can't be blank") end @@ -117,10 +117,10 @@ describe Officing::Residence do expect(FailedCensusCall.count).to eq(1) expect(FailedCensusCall.first).to have_attributes( - user_id: residence.user.id, + user_id: residence.user.id, poll_officer_id: residence.officer.id, document_number: "12345678Z", - document_type: "1", + document_type: "1", date_of_birth: nil, postal_code: "00001", year_of_birth: Time.current.year @@ -209,13 +209,13 @@ describe Officing::Residence do expect(FailedCensusCall.count).to eq(1) expect(FailedCensusCall.first).to have_attributes( - user_id: residence.user.id, + user_id: residence.user.id, poll_officer_id: residence.officer.id, document_number: "12345678Z", - document_type: "1", + document_type: "1", date_of_birth: nil, postal_code: nil, - year_of_birth: Time.current.year + year_of_birth: Time.current.year ) end end diff --git a/spec/models/poll/ballot_sheet_spec.rb b/spec/models/poll/ballot_sheet_spec.rb index 12a834457..73cd46e45 100644 --- a/spec/models/poll/ballot_sheet_spec.rb +++ b/spec/models/poll/ballot_sheet_spec.rb @@ -6,8 +6,8 @@ describe Poll::BallotSheet do investment1 = create(:budget_investment, budget: budget) investment2 = create(:budget_investment, budget: budget) build(:poll_ballot_sheet, poll: create(:poll, budget: budget), - officer_assignment: create(:poll_officer_assignment), - data: "#{investment1.id};#{investment2.id}") + officer_assignment: create(:poll_officer_assignment), + data: "#{investment1.id};#{investment2.id}") end context "Validations" do diff --git a/spec/models/poll/poll_spec.rb b/spec/models/poll/poll_spec.rb index 00f97602e..609227073 100644 --- a/spec/models/poll/poll_spec.rb +++ b/spec/models/poll/poll_spec.rb @@ -104,45 +104,52 @@ describe Poll do it "is valid when overlapping but different proposals" do other_proposal = create(:proposal) - _other_poll = create(:poll, related: other_proposal, starts_at: poll.starts_at, - ends_at: poll.ends_at) + _other_poll = create(:poll, related: other_proposal, + starts_at: poll.starts_at, + ends_at: poll.ends_at) expect(poll).to be_valid end it "is valid when same proposal but not overlapping" do - _other_poll = create(:poll, related: proposal, starts_at: poll.ends_at + 1.day, - ends_at: poll.ends_at + 8.days) + _other_poll = create(:poll, related: proposal, + starts_at: poll.ends_at + 1.day, + ends_at: poll.ends_at + 8.days) expect(poll).to be_valid end it "is not valid when overlaps from the beginning" do - _other_poll = create(:poll, related: proposal, starts_at: poll.starts_at - 8.days, - ends_at: poll.starts_at) + _other_poll = create(:poll, related: proposal, + starts_at: poll.starts_at - 8.days, + ends_at: poll.starts_at) expect(poll).not_to be_valid end it "is not valid when overlaps from the end" do - _other_poll = create(:poll, related: proposal, starts_at: poll.ends_at, - ends_at: poll.ends_at + 8.days) + _other_poll = create(:poll, related: proposal, + starts_at: poll.ends_at, + ends_at: poll.ends_at + 8.days) expect(poll).not_to be_valid end it "is not valid when overlaps with same interval" do - _other_poll = create(:poll, related: proposal, starts_at: poll.starts_at, - ends_at: poll.ends_at) + _other_poll = create(:poll, related: proposal, + starts_at: poll.starts_at, + ends_at: poll.ends_at) expect(poll).not_to be_valid end it "is not valid when overlaps with interval contained" do - _other_poll = create(:poll, related: proposal, starts_at: poll.starts_at + 1.day, - ends_at: poll.ends_at - 1.day) + _other_poll = create(:poll, related: proposal, + starts_at: poll.starts_at + 1.day, + ends_at: poll.ends_at - 1.day) expect(poll).not_to be_valid end it "is not valid when overlaps with interval containing" do - _other_poll = create(:poll, related: proposal, starts_at: poll.starts_at - 8.days, - ends_at: poll.ends_at + 8.days) + _other_poll = create(:poll, related: proposal, + starts_at: poll.starts_at - 8.days, + ends_at: poll.ends_at + 8.days) expect(poll).not_to be_valid end end diff --git a/spec/models/poll/stats_spec.rb b/spec/models/poll/stats_spec.rb index 27b7571a0..4004608d0 100644 --- a/spec/models/poll/stats_spec.rb +++ b/spec/models/poll/stats_spec.rb @@ -19,7 +19,9 @@ describe Poll::Stats do it "supports every channel" do 3.times { create(:poll_voter, :from_web, poll: poll) } create(:poll_recount, :from_booth, poll: poll, - total_amount: 8, white_amount: 4, null_amount: 1) + total_amount: 8, + white_amount: 4, + null_amount: 1) expect(stats.total_participants_web).to eq(3) expect(stats.total_participants_booth).to eq(13) @@ -153,7 +155,9 @@ describe Poll::Stats do it "is relative to the total amount of votes" do 3.times { create(:poll_voter, :from_web, poll: poll) } create(:poll_recount, :from_booth, poll: poll, - total_amount: 8, white_amount: 5, null_amount: 4) + total_amount: 8, + white_amount: 5, + null_amount: 4) expect(stats.total_valid_percentage).to eq(50) expect(stats.total_white_percentage).to eq(30) diff --git a/spec/models/proposal_notification_spec.rb b/spec/models/proposal_notification_spec.rb index 682ec9ed4..ae91fd3dd 100644 --- a/spec/models/proposal_notification_spec.rb +++ b/spec/models/proposal_notification_spec.rb @@ -153,8 +153,8 @@ describe ProposalNotification do notification = create(:notification, notifiable: notifiable) notifiable.proposal.update!(retired_at: Time.current, - retired_explanation: "Unfeasible reason explanation", - retired_reason: "unfeasible") + retired_explanation: "Unfeasible reason explanation", + retired_reason: "unfeasible") expect(notification.check_availability(proposal)).to be(false) end end diff --git a/spec/models/proposal_spec.rb b/spec/models/proposal_spec.rb index 469e986b2..abb152549 100644 --- a/spec/models/proposal_spec.rb +++ b/spec/models/proposal_spec.rb @@ -427,23 +427,23 @@ describe Proposal do it "expires cache when the author is hidden" do expect { proposal.author.hide } - .to change { [proposal.reload.cache_version, proposal.author.cache_version] } + .to change { [proposal.reload.cache_version, proposal.author.cache_version] } end it "expires cache when the author is erased" do expect { proposal.author.erase } - .to change { [proposal.reload.cache_version, proposal.author.cache_version] } + .to change { [proposal.reload.cache_version, proposal.author.cache_version] } end it "expires cache when its author changes" do expect { proposal.author.update(username: "Eva") } - .to change { [proposal.reload.cache_version, proposal.author.cache_version] } + .to change { [proposal.reload.cache_version, proposal.author.cache_version] } end it "expires cache when the author's organization get verified" do create(:organization, user: proposal.author) expect { proposal.author.organization.verify } - .to change { [proposal.reload.cache_version, proposal.author.cache_version] } + .to change { [proposal.reload.cache_version, proposal.author.cache_version] } end end @@ -916,8 +916,8 @@ describe Proposal do author = create(:user, :level_two) voter_and_follower = create(:user, :level_two) proposal = create(:proposal, author: author, - voters: [author, voter_and_follower], - followers: [author, voter_and_follower]) + voters: [author, voter_and_follower], + followers: [author, voter_and_follower]) expect(proposal.users_to_notify).to eq([voter_and_follower]) end diff --git a/spec/models/site_customization/image_spec.rb b/spec/models/site_customization/image_spec.rb index 55534b535..89baf4dee 100644 --- a/spec/models/site_customization/image_spec.rb +++ b/spec/models/site_customization/image_spec.rb @@ -3,7 +3,7 @@ require "rails_helper" describe SiteCustomization::Image do it "stores images with Active Storage" do image = create(:site_customization_image, name: "map", - image: fixture_file_upload("custom_map.jpg")) + image: fixture_file_upload("custom_map.jpg")) expect(image.image).to be_attached expect(image.image.filename).to eq "custom_map.jpg" diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 947df5e94..fc295d20f 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -491,16 +491,16 @@ describe User do describe "#erase" do it "erases user information and marks him as erased" do user = create(:user, - username: "manolo", - email: "a@a.com", - unconfirmed_email: "a@a.com", - phone_number: "5678", - confirmed_phone: "5678", - unconfirmed_phone: "5678", - encrypted_password: "foobar", - confirmation_token: "token1", - reset_password_token: "token2", - email_verification_token: "token3") + username: "manolo", + email: "a@a.com", + unconfirmed_email: "a@a.com", + phone_number: "5678", + confirmed_phone: "5678", + unconfirmed_phone: "5678", + encrypted_password: "foobar", + confirmation_token: "token1", + reset_password_token: "token2", + email_verification_token: "token3") user.erase("a test") user.reload diff --git a/spec/models/verification/management/document_spec.rb b/spec/models/verification/management/document_spec.rb index f01a915d4..6dee5b10b 100644 --- a/spec/models/verification/management/document_spec.rb +++ b/spec/models/verification/management/document_spec.rb @@ -58,16 +58,16 @@ describe Verification::Management::Document do describe "dates" do it "is valid with a valid date of birth" do verification_document = Verification::Management::Document.new("date_of_birth(3i)" => "1", - "date_of_birth(2i)" => "1", - "date_of_birth(1i)" => "1980") + "date_of_birth(2i)" => "1", + "date_of_birth(1i)" => "1980") expect(verification_document.errors[:date_of_birth]).to be_empty end it "is not valid without a date of birth" do verification_document = Verification::Management::Document.new("date_of_birth(3i)" => "", - "date_of_birth(2i)" => "", - "date_of_birth(1i)" => "") + "date_of_birth(2i)" => "", + "date_of_birth(1i)" => "") expect(verification_document).not_to be_valid expect(verification_document.errors[:date_of_birth]).to include("can't be blank") end diff --git a/spec/models/verification/residence_spec.rb b/spec/models/verification/residence_spec.rb index e9733c7d7..8dc4b18e6 100644 --- a/spec/models/verification/residence_spec.rb +++ b/spec/models/verification/residence_spec.rb @@ -25,8 +25,8 @@ describe Verification::Residence do it "validates user has allowed age" do residence = Verification::Residence.new("date_of_birth(3i)" => "1", - "date_of_birth(2i)" => "1", - "date_of_birth(1i)" => 5.years.ago.year.to_s) + "date_of_birth(2i)" => "1", + "date_of_birth(1i)" => 5.years.ago.year.to_s) expect(residence).not_to be_valid expect(residence.errors[:date_of_birth]).to include("You don't have the required age to participate") end @@ -266,11 +266,11 @@ describe Verification::Residence do expect(FailedCensusCall.count).to eq(1) expect(FailedCensusCall.first).to have_attributes( - user_id: residence.user.id, + user_id: residence.user.id, document_number: "12345678Z", - document_type: "1", - date_of_birth: Date.new(1980, 12, 31), - postal_code: "28001" + document_type: "1", + date_of_birth: Date.new(1980, 12, 31), + postal_code: "28001" ) end end diff --git a/spec/shared/models/notifiable.rb b/spec/shared/models/notifiable.rb index e41e7db80..a227fa6e4 100644 --- a/spec/shared/models/notifiable.rb +++ b/spec/shared/models/notifiable.rb @@ -73,7 +73,7 @@ shared_examples "notifiable" do if notifiable.respond_to?(:retired_at) notifiable.update!(retired_at: Time.current, retired_reason: "unfeasible", - retired_explanation: "Unfeasibility explanation ...") + retired_explanation: "Unfeasibility explanation ...") expect(notification.check_availability(notifiable)).to be(false) end end diff --git a/spec/shared/system/admin_progressable.rb b/spec/shared/system/admin_progressable.rb index bd7e9da98..9535e5611 100644 --- a/spec/shared/system/admin_progressable.rb +++ b/spec/shared/system/admin_progressable.rb @@ -10,9 +10,9 @@ shared_examples "admin_progressable" do |factory_name, path_name| context "Index" do scenario "Link to index path" do - create(:progress_bar, :secondary, progressable: progressable, - title: "Reading documents", - percentage: 20) + create(:progress_bar, :secondary, progressable: progressable, + title: "Reading documents", + percentage: 20) visit progressable_path click_link "Manage progress bars" diff --git a/spec/shared/system/remotely_translatable.rb b/spec/shared/system/remotely_translatable.rb index 1204b8f64..87eb15533 100644 --- a/spec/shared/system/remotely_translatable.rb +++ b/spec/shared/system/remotely_translatable.rb @@ -10,8 +10,9 @@ shared_examples "remotely_translatable" do |factory_name, path_name, path_argume before do Setting["feature.remote_translations"] = true available_locales_response = %w[de en es fr pt zh-Hans] - expect(RemoteTranslations::Microsoft::AvailableLocales).to receive(:available_locales).at_most(4).times. - and_return(available_locales_response) + expect(RemoteTranslations::Microsoft::AvailableLocales) + .to receive(:available_locales).at_most(4).times + .and_return(available_locales_response) allow(Rails.application.secrets).to receive(:microsoft_api_key).and_return("123") end diff --git a/spec/support/common_actions.rb b/spec/support/common_actions.rb index 51da757f9..ea415fa61 100644 --- a/spec/support/common_actions.rb +++ b/spec/support/common_actions.rb @@ -35,8 +35,8 @@ module CommonActions end def validate_officer - allow_any_instance_of(Officing::BaseController). - to receive(:verify_officer_assignment).and_return(true) + allow_any_instance_of(Officing::BaseController) + .to receive(:verify_officer_assignment).and_return(true) end def fill_in_proposal @@ -69,8 +69,8 @@ module CommonActions def set_officing_booth(booth = nil) booth = create(:poll_booth) if booth.blank? - allow_any_instance_of(Officing::BaseController). - to receive(:current_booth).and_return(booth) + allow_any_instance_of(Officing::BaseController) + .to receive(:current_booth).and_return(booth) end def click_sdg_goal(code) diff --git a/spec/system/account_spec.rb b/spec/system/account_spec.rb index 2d368a1d6..1e96fc6a8 100644 --- a/spec/system/account_spec.rb +++ b/spec/system/account_spec.rb @@ -61,9 +61,9 @@ describe "Account" do click_button "Update" - notice = "Your account has been updated successfully;"\ - " however, we need to verify your new email address."\ - " Please check your email and click on the link to"\ + notice = "Your account has been updated successfully;" \ + " however, we need to verify your new email address." \ + " Please check your email and click on the link to" \ " complete the confirmation of your new email address." expect(page).to have_content notice diff --git a/spec/system/admin/activity_spec.rb b/spec/system/admin/activity_spec.rb index ee6023993..af1e3ffdd 100644 --- a/spec/system/admin/activity_spec.rb +++ b/spec/system/admin/activity_spec.rb @@ -365,8 +365,8 @@ describe "Admin activity" do scenario "Shows moderation activity on system emails" do proposal = create(:proposal, title: "Proposal A") proposal_notification = create(:proposal_notification, proposal: proposal, - title: "Proposal A Title", - body: "Proposal A Notification Body") + title: "Proposal A Title", + body: "Proposal A Notification Body") proposal_notification.moderate_system_email(admin.user) visit admin_activity_path diff --git a/spec/system/admin/administrators_spec.rb b/spec/system/admin/administrators_spec.rb index 10f355938..2c7ba525f 100644 --- a/spec/system/admin/administrators_spec.rb +++ b/spec/system/admin/administrators_spec.rb @@ -35,7 +35,7 @@ describe "Admin administrators" do scenario "Delete Administrator" do visit admin_administrators_path - confirmation = "Are you sure? This action will delete "\ + confirmation = "Are you sure? This action will delete " \ "\"#{user_administrator.name}\" and can't be undone." within "#administrator_#{user_administrator.id}" do diff --git a/spec/system/admin/banners_spec.rb b/spec/system/admin/banners_spec.rb index e3baf6f86..16abaf32b 100644 --- a/spec/system/admin/banners_spec.rb +++ b/spec/system/admin/banners_spec.rb @@ -4,44 +4,44 @@ describe "Admin banners magement", :admin do context "Index" do before do create(:banner, title: "Banner number one", - description: "This is the text of banner number one and is not active yet", - target_url: "http://www.url.com", - post_started_at: (Date.current + 4.days), - post_ended_at: (Date.current + 10.days), - background_color: "#FF0000", - font_color: "#FFFFFF") + description: "This is the text of banner number one and is not active yet", + target_url: "http://www.url.com", + post_started_at: (Date.current + 4.days), + post_ended_at: (Date.current + 10.days), + background_color: "#FF0000", + font_color: "#FFFFFF") create(:banner, title: "Banner number two", - description: "This is the text of banner number two and is not longer active", - target_url: "http://www.url.com", - post_started_at: (Date.current - 10.days), - post_ended_at: (Date.current - 3.days), - background_color: "#00FF00", - font_color: "#FFFFFF") + description: "This is the text of banner number two and is not longer active", + target_url: "http://www.url.com", + post_started_at: (Date.current - 10.days), + post_ended_at: (Date.current - 3.days), + background_color: "#00FF00", + font_color: "#FFFFFF") create(:banner, title: "Banner number three", - description: "This is the text of banner number three", - target_url: "http://www.url.com", - post_started_at: (Date.current - 1.day), - post_ended_at: (Date.current + 10.days), - background_color: "#0000FF", - font_color: "#FFFFFF") + description: "This is the text of banner number three", + target_url: "http://www.url.com", + post_started_at: (Date.current - 1.day), + post_ended_at: (Date.current + 10.days), + background_color: "#0000FF", + font_color: "#FFFFFF") create(:banner, title: "Banner number four", - description: "This is the text of banner number four", - target_url: "http://www.url.com", - post_started_at: (Date.current - 10.days), - post_ended_at: (Date.current + 10.days), - background_color: "#FFF000", - font_color: "#FFFFFF") + description: "This is the text of banner number four", + target_url: "http://www.url.com", + post_started_at: (Date.current - 10.days), + post_ended_at: (Date.current + 10.days), + background_color: "#FFF000", + font_color: "#FFFFFF") create(:banner, title: "Banner number five", - description: "This is the text of banner number five", - target_url: "http://www.url.com", - post_started_at: (Date.current - 10.days), - post_ended_at: (Date.current + 10.days), - background_color: "#FFFF00", - font_color: "#FFFFFF") + description: "This is the text of banner number five", + target_url: "http://www.url.com", + post_started_at: (Date.current - 10.days), + post_ended_at: (Date.current + 10.days), + background_color: "#FFFF00", + font_color: "#FFFFFF") end scenario "Index show active banners" do @@ -124,9 +124,9 @@ describe "Admin banners magement", :admin do scenario "Edit banner with live refresh" do create(:banner, title: "Hello", description: "Wrong text", - target_url: "http://www.url.com", + target_url: "http://www.url.com", post_started_at: (Date.current + 4.days), - post_ended_at: (Date.current + 10.days), + post_ended_at: (Date.current + 10.days), background_color: "#FF0000", font_color: "#FFFFFF") @@ -163,9 +163,9 @@ describe "Admin banners magement", :admin do scenario "Delete a banner" do create(:banner, title: "Ugly banner", description: "Bad text", - target_url: "http://www.url.com", + target_url: "http://www.url.com", post_started_at: (Date.current + 4.days), - post_ended_at: (Date.current + 10.days), + post_ended_at: (Date.current + 10.days), background_color: "#FF0000", font_color: "#FFFFFF") diff --git a/spec/system/admin/budget_investments_spec.rb b/spec/system/admin/budget_investments_spec.rb index affd87411..ac7408eee 100644 --- a/spec/system/admin/budget_investments_spec.rb +++ b/spec/system/admin/budget_investments_spec.rb @@ -67,8 +67,9 @@ describe "Admin budget investments", :admin do admin = create(:administrator, user: create(:user, username: "Gema")) budget_investment1 = create(:budget_investment, budget: budget, valuators: [valuator1]) - budget_investment2 = create(:budget_investment, budget: budget, valuators: [valuator1, valuator2], - valuator_groups: [valuator_group]) + budget_investment2 = create(:budget_investment, budget: budget, + valuators: [valuator1, valuator2], + valuator_groups: [valuator_group]) budget_investment3 = create(:budget_investment, budget: budget) visit admin_budget_budget_investments_path(budget_id: budget.id) @@ -147,8 +148,9 @@ describe "Admin budget investments", :admin do administrator = create(:administrator, user: user) administrator2 = create(:administrator, user: user2, description: "Alias") budget.administrators = [administrator, administrator2] - create(:budget_investment, title: "Realocate visitors", budget: budget, - administrator: administrator) + create(:budget_investment, title: "Realocate visitors", + budget: budget, + administrator: administrator) create(:budget_investment, title: "Destroy the city", budget: budget) visit admin_budget_budget_investments_path(budget_id: budget.id) @@ -299,16 +301,20 @@ describe "Admin budget investments", :admin do end scenario "Filtering by under valuation" do - create(:budget_investment, + create( + :budget_investment, :with_administrator, :with_valuator, :open, title: "Investment without valuation", - budget: budget) - create(:budget_investment, + budget: budget + ) + create( + :budget_investment, :with_administrator, title: "Investment with valuation", - budget: budget) + budget: budget + ) visit admin_budget_budget_investments_path(budget_id: budget) expect(page).to have_link("Investment without valuation") @@ -400,8 +406,9 @@ describe "Admin budget investments", :admin do scenario "Filtering by assignment status" do create(:budget_investment, :with_administrator, title: "Assigned idea", budget: budget) create(:budget_investment, :with_valuator, title: "Evaluating...", budget: budget) - create(:budget_investment, title: "With group", budget: budget, - valuator_groups: [create(:valuator_group)]) + create(:budget_investment, title: "With group", + budget: budget, + valuator_groups: [create(:valuator_group)]) visit admin_budget_budget_investments_path(budget_id: budget.id, filter: "valuation_open") @@ -410,14 +417,14 @@ describe "Admin budget investments", :admin do expect(page).to have_content("With group") visit admin_budget_budget_investments_path(budget_id: budget.id, - advanced_filters: ["without_admin"]) + advanced_filters: ["without_admin"]) expect(page).to have_content("Evaluating...") expect(page).to have_content("With group") expect(page).not_to have_content("Assigned idea") visit admin_budget_budget_investments_path(budget_id: budget.id, - advanced_filters: ["without_valuator"]) + advanced_filters: ["without_valuator"]) expect(page).to have_content("Assigned idea") expect(page).not_to have_content("Evaluating...") @@ -438,7 +445,7 @@ describe "Admin budget investments", :admin do expect(page).not_to have_content("Old idea") visit admin_budget_budget_investments_path(budget_id: budget.id, - advanced_filters: ["valuation_finished"]) + advanced_filters: ["valuation_finished"]) expect(page).not_to have_content("Ongoing valuation") expect(page).to have_content("Old idea") @@ -528,7 +535,7 @@ describe "Admin budget investments", :admin do click_button "Filter" expect(page).not_to have_button "Calculate Winner Investments" - expect(page).to have_content 'The budget has to stay on phase "Reviewing voting" '\ + expect(page).to have_content 'The budget has to stay on phase "Reviewing voting" ' \ "in order to calculate winners projects" visit admin_budget_path(budget) @@ -613,8 +620,9 @@ describe "Admin budget investments", :admin do administrator = create(:administrator, user: user) budget.administrators = [administrator] - educate_children = create(:budget_investment, budget: budget, title: "Educate the children", - administrator: administrator) + educate_children = create(:budget_investment, budget: budget, + title: "Educate the children", + administrator: administrator) create(:budget_investment, budget: budget, title: "More schools", administrator: administrator) create(:budget_investment, budget: budget, title: "More hospitals") @@ -686,8 +694,9 @@ describe "Admin budget investments", :admin do educate_children = create(:budget_investment, :feasible, :finished, budget: budget, title: "Educate the children", administrator: administrator) - create(:budget_investment, :feasible, :finished, budget: budget, title: "More schools", - administrator: administrator) + create(:budget_investment, :feasible, :finished, budget: budget, + title: "More schools", + administrator: administrator) create(:budget_investment, budget: budget, title: "More hospitals", administrator: administrator) create(:budget_investment, budget: budget, title: "More hostals") @@ -923,13 +932,12 @@ describe "Admin budget investments", :admin do user = create(:user, username: "Rachel", email: "rachel@valuators.org") valuator = create(:valuator, user: user) budget_investment = create(:budget_investment, - :unfeasible, - unfeasibility_explanation: "It is impossible", - price: 1234, - price_first_year: 1000, - administrator: administrator, - valuators: [valuator] - ) + :unfeasible, + unfeasibility_explanation: "It is impossible", + price: 1234, + price_first_year: 1000, + administrator: administrator, + valuators: [valuator]) visit admin_budget_budget_investments_path(budget_investment.budget) @@ -955,12 +963,12 @@ describe "Admin budget investments", :admin do scenario "Show image and documents on investment details" do budget_investment = create(:budget_investment, - :with_image, - :unfeasible, - unfeasibility_explanation: "It is impossible", - price: 1234, - price_first_year: 1000, - administrator: administrator) + :with_image, + :unfeasible, + unfeasibility_explanation: "It is impossible", + price: 1234, + price_first_year: 1000, + administrator: administrator) document = create(:document, documentable: budget_investment) visit admin_budget_budget_investments_path(budget_investment.budget) @@ -985,10 +993,10 @@ describe "Admin budget investments", :admin do scenario "Does not show related content or hide links on preview" do budget_investment = create(:budget_investment, - :unfeasible, - price: 1234, - price_first_year: 1000, - administrator: administrator) + :unfeasible, + price: 1234, + price_first_year: 1000, + administrator: administrator) visit admin_budget_budget_investments_path(budget_investment.budget) @@ -1001,8 +1009,8 @@ describe "Admin budget investments", :admin do scenario "If budget is finished, investment cannot be edited or valuation comments created" do finished_budget = create(:budget, :finished) budget_investment = create(:budget_investment, - budget: finished_budget, - administrator: administrator) + budget: finished_budget, + administrator: administrator) visit admin_budget_budget_investments_path(budget_investment.budget) within_window(window_opened_by { click_link budget_investment.title }) do @@ -1689,20 +1697,20 @@ describe "Admin budget investments", :admin do first_budget_heading = create(:budget_heading, group: budget_group, name: "Budget Heading") second_budget_heading = create(:budget_heading, group: budget_group, name: "Other Heading") first_investment = create(:budget_investment, :feasible, :selected, title: "Le Investment", - budget: budget, group: budget_group, - heading: first_budget_heading, - cached_votes_up: 88, price: 99, - valuators: [], - valuator_groups: [valuator_group], - administrator: admin, - visible_to_valuators: true) + budget: budget, group: budget_group, + heading: first_budget_heading, + cached_votes_up: 88, price: 99, + valuators: [], + valuator_groups: [valuator_group], + administrator: admin, + visible_to_valuators: true) second_investment = create(:budget_investment, :unfeasible, title: "Alt Investment", - budget: budget, group: budget_group, - heading: second_budget_heading, - cached_votes_up: 66, price: 88, - valuators: [valuator], - valuator_groups: [], - visible_to_valuators: false) + budget: budget, group: budget_group, + heading: second_budget_heading, + cached_votes_up: 66, price: 88, + valuators: [valuator], + valuator_groups: [], + visible_to_valuators: false) visit admin_budget_budget_investments_path(budget) @@ -1712,12 +1720,12 @@ describe "Admin budget investments", :admin do expect(header).to match(/^attachment/) expect(header).to match(/filename="budget_investments.csv"/) - csv_contents = "ID,Title,Supports,Administrator,Valuator,Valuation Group,Scope of operation,"\ - "Feasibility,Val. Fin.,Selected,Show to valuators,Author username\n"\ - "#{first_investment.id},Le Investment,88,Admin,-,Valuator Group,"\ - "Budget Heading,Feasible (€99),Yes,Yes,Yes,"\ - "#{first_investment.author.username}\n#{second_investment.id},"\ - "Alt Investment,66,No admin assigned,Valuator,-,Other Heading,"\ + csv_contents = "ID,Title,Supports,Administrator,Valuator,Valuation Group,Scope of operation," \ + "Feasibility,Val. Fin.,Selected,Show to valuators,Author username\n" \ + "#{first_investment.id},Le Investment,88,Admin,-,Valuator Group," \ + "Budget Heading,Feasible (€99),Yes,Yes,Yes," \ + "#{first_investment.author.username}\n#{second_investment.id}," \ + "Alt Investment,66,No admin assigned,Valuator,-,Other Heading," \ "Unfeasible,No,No,No,#{second_investment.author.username}\n" expect(page.body).to eq(csv_contents) @@ -1745,11 +1753,10 @@ describe "Admin budget investments", :admin do context "Columns chooser" do let!(:investment) do create(:budget_investment, - :winner, - :visible_to_valuators, - budget: budget, - author: create(:user, username: "Jon Doe") - ) + :winner, + :visible_to_valuators, + budget: budget, + author: create(:user, username: "Jon Doe")) end let(:default_columns) do %w[id title supports admin valuator geozone feasibility price @@ -1790,8 +1797,8 @@ describe "Admin budget investments", :admin do columns_cookie = cookies.find { |cookie| cookie[:name] == "investments-columns" } cookie_value = columns_cookie[:value] - expect(cookie_value).to eq("id,title,supports,admin,valuator,geozone," + - "feasibility,price,valuation_finished,visible_to_valuators,selected,incompatible") + expect(cookie_value).to eq("id,title,supports,admin,valuator,geozone,feasibility,price," \ + "valuation_finished,visible_to_valuators,selected,incompatible") end scenario "Use column selector to display visible columns" do @@ -1840,8 +1847,8 @@ describe "Admin budget investments", :admin do columns_cookie = cookies.find { |cookie| cookie[:name] == "investments-columns" } cookie_value = columns_cookie[:value] - expect(cookie_value).to eq("id,supports,admin,geozone," + - "feasibility,valuation_finished,visible_to_valuators,selected,incompatible,author") + expect(cookie_value).to eq("id,supports,admin,geozone,feasibility,valuation_finished," \ + "visible_to_valuators,selected,incompatible,author") visit admin_budget_budget_investments_path(budget) @@ -1849,8 +1856,8 @@ describe "Admin budget investments", :admin do columns_cookie = cookies.find { |cookie| cookie[:name] == "investments-columns" } cookie_value = columns_cookie[:value] - expect(cookie_value).to eq("id,supports,admin,geozone,feasibility,valuation_finished," + - "visible_to_valuators,selected,incompatible,author") + expect(cookie_value).to eq("id,supports,admin,geozone,feasibility,valuation_finished," \ + "visible_to_valuators,selected,incompatible,author") end scenario "Select an investment when some columns are not displayed" do diff --git a/spec/system/admin/budget_phases_spec.rb b/spec/system/admin/budget_phases_spec.rb index 528285740..efc2638e1 100644 --- a/spec/system/admin/budget_phases_spec.rb +++ b/spec/system/admin/budget_phases_spec.rb @@ -7,8 +7,8 @@ describe "Admin budget phases" do scenario "Update phase" do visit edit_admin_budget_budget_phase_path(budget, budget.current_phase) - expect(page).to have_content "These fields are used for information purposes only and do not trigger "\ - "an automatic update of the active phase. In order to update it, edit "\ + expect(page).to have_content "These fields are used for information purposes only and do not trigger " \ + "an automatic update of the active phase. In order to update it, edit " \ "the budget and select the active phase." expect(page).to have_content "For information purposes only" diff --git a/spec/system/admin/budgets_spec.rb b/spec/system/admin/budgets_spec.rb index 68fde35ee..7d1fb85e7 100644 --- a/spec/system/admin/budgets_spec.rb +++ b/spec/system/admin/budgets_spec.rb @@ -235,8 +235,8 @@ describe "Admin budgets", :admin do visit admin_budget_path(budget) - expect(page).to have_content "The configuration of these phases is used for information purposes "\ - "only. Its function is to define the phases information displayed "\ + expect(page).to have_content "The configuration of these phases is used for information purposes " \ + "only. Its function is to define the phases information displayed " \ "on the public page of the participatory budget." expect(page).to have_table "Phases", with_cols: [ [ @@ -357,7 +357,7 @@ describe "Admin budgets", :admin do scenario "Change voting style uncheck hide money" do budget_hide_money = create(:budget, :approval, :hide_money) - hide_money_help_text = "If this option is checked, all fields showing the amount of money "\ + hide_money_help_text = "If this option is checked, all fields showing the amount of money " \ "will be hidden throughout the process." visit edit_admin_budget_path(budget_hide_money) @@ -378,7 +378,7 @@ describe "Admin budgets", :admin do scenario "Edit knapsack budget do not show hide money info" do budget = create(:budget, :knapsack) - hide_money_help_text = "If this option is checked, all fields showing the amount of money "\ + hide_money_help_text = "If this option is checked, all fields showing the amount of money " \ "will be hidden throughout the process." visit edit_admin_budget_path(budget) @@ -394,7 +394,7 @@ describe "Admin budgets", :admin do scenario "Edit approval budget show hide money info" do budget = create(:budget, :approval) - hide_money_help_text = "If this option is checked, all fields showing the amount of money "\ + hide_money_help_text = "If this option is checked, all fields showing the amount of money " \ "will be hidden throughout the process." visit edit_admin_budget_path(budget) @@ -452,10 +452,11 @@ describe "Admin budgets", :admin do scenario "For a Budget in reviewing balloting" do budget = create(:budget, :reviewing_ballots) heading = create(:budget_heading, budget: budget, price: 4) - unselected = create(:budget_investment, :unselected, heading: heading, price: 1, + unselected = create(:budget_investment, :unselected, heading: heading, + price: 1, ballot_lines_count: 3) winner = create(:budget_investment, :selected, heading: heading, price: 3, - ballot_lines_count: 2) + ballot_lines_count: 2) selected = create(:budget_investment, :selected, heading: heading, price: 2, ballot_lines_count: 1) visit admin_budget_path(budget) diff --git a/spec/system/admin/local_census_records_spec.rb b/spec/system/admin/local_census_records_spec.rb index cf30393b6..d88083705 100644 --- a/spec/system/admin/local_census_records_spec.rb +++ b/spec/system/admin/local_census_records_spec.rb @@ -139,7 +139,7 @@ describe "Admin local census records", :admin do expect(page).to have_content deleted_document_number - confirmation = "Are you sure? This action will delete "\ + confirmation = "Are you sure? This action will delete " \ "\"#{local_census_record.title}\" and can't be undone." accept_confirm(confirmation) { click_on "Delete" } diff --git a/spec/system/admin/machine_learning_spec.rb b/spec/system/admin/machine_learning_spec.rb index d058f8eb9..f7f4606e8 100644 --- a/spec/system/admin/machine_learning_spec.rb +++ b/spec/system/admin/machine_learning_spec.rb @@ -40,7 +40,7 @@ describe "Machine learning" do visit admin_machine_learning_path - expect(page).to have_content "This feature is disabled. To use Machine Learning you can enable it from "\ + expect(page).to have_content "This feature is disabled. To use Machine Learning you can enable it from " \ "the settings page" expect(page).to have_link "settings page", href: admin_settings_path(anchor: "tab-feature-flags") end @@ -56,7 +56,7 @@ describe "Machine learning" do click_button "Execute script" expect(page).to have_content "The last script has been executed successfully." - expect(page).to have_content "You will receive an email in #{admin.email} when the script "\ + expect(page).to have_content "You will receive an email in #{admin.email} when the script " \ "finishes running." expect(page).to have_field "Select python script to execute" @@ -71,11 +71,11 @@ describe "Machine learning" do end expect(page).to have_content "Related content" - expect(page).to have_content "Adds automatically generated related content to proposals and "\ + expect(page).to have_content "Adds automatically generated related content to proposals and " \ "participatory budget projects" expect(page).to have_content "Comments summary" - expect(page).to have_content "Displays an automatically generated comment summary on all items that "\ + expect(page).to have_content "Displays an automatically generated comment summary on all items that " \ "can be commented on." expect(page).to have_content "Tags" @@ -94,7 +94,7 @@ describe "Machine learning" do select "proposals_related_content_and_tags_nmf.py", from: "Select python script to execute" click_button "Execute script" - expect(page).to have_content "The script is running. The administrator who executed it will receive "\ + expect(page).to have_content "The script is running. The administrator who executed it will receive " \ "an email when it is finished." expect(page).to have_content "Executed by: #{admin.name}" @@ -139,7 +139,7 @@ describe "Machine learning" do expect(page).to have_content "Script name: proposals_related_content_and_tags_nmf.py" expect(page).to have_content "Error: Error description" - expect(page).to have_content "You will receive an email in #{admin.email} when the script "\ + expect(page).to have_content "You will receive an email in #{admin.email} when the script " \ "finishes running." expect(page).to have_field "Select python script to execute" diff --git a/spec/system/admin/poll/booth_assigments_spec.rb b/spec/system/admin/poll/booth_assigments_spec.rb index 6e9ebe695..3ca2df05d 100644 --- a/spec/system/admin/poll/booth_assigments_spec.rb +++ b/spec/system/admin/poll/booth_assigments_spec.rb @@ -240,34 +240,34 @@ describe "Admin booths assignments", :admin do create(:poll_question_answer, title: "Tomorrow", question: question_2) create(:poll_partial_result, - booth_assignment: booth_assignment, - question: question_1, - answer: "Yes", - amount: 11) + booth_assignment: booth_assignment, + question: question_1, + answer: "Yes", + amount: 11) create(:poll_partial_result, - booth_assignment: booth_assignment, - question: question_1, - answer: "No", - amount: 4) + booth_assignment: booth_assignment, + question: question_1, + answer: "No", + amount: 4) create(:poll_partial_result, - booth_assignment: booth_assignment, - question: question_2, - answer: "Today", - amount: 5) + booth_assignment: booth_assignment, + question: question_2, + answer: "Today", + amount: 5) create(:poll_partial_result, - booth_assignment: booth_assignment, - question: question_2, - answer: "Tomorrow", - amount: 6) + booth_assignment: booth_assignment, + question: question_2, + answer: "Tomorrow", + amount: 6) create(:poll_partial_result, - booth_assignment: other_booth_assignment, - question: question_1, - answer: "Yes", - amount: 9999) + booth_assignment: other_booth_assignment, + question: question_1, + answer: "Yes", + amount: 9999) create(:poll_recount, booth_assignment: booth_assignment, diff --git a/spec/system/admin/poll/polls_spec.rb b/spec/system/admin/poll/polls_spec.rb index 202c6b394..88aac7ae3 100644 --- a/spec/system/admin/poll/polls_spec.rb +++ b/spec/system/admin/poll/polls_spec.rb @@ -435,15 +435,15 @@ describe "Admin polls", :admin do [booth_assignment_1, booth_assignment_2, booth_assignment_3].each do |ba| create(:poll_partial_result, - booth_assignment: ba, - question: question_1, - answer: "Yes", - amount: 11) + booth_assignment: ba, + question: question_1, + answer: "Yes", + amount: 11) create(:poll_partial_result, - booth_assignment: ba, - question: question_2, - answer: "Tomorrow", - amount: 5) + booth_assignment: ba, + question: question_2, + answer: "Tomorrow", + amount: 5) end create(:poll_recount, booth_assignment: booth_assignment_1, diff --git a/spec/system/admin/site_customization/content_blocks_spec.rb b/spec/system/admin/site_customization/content_blocks_spec.rb index ef3e35d29..20e74b573 100644 --- a/spec/system/admin/site_customization/content_blocks_spec.rb +++ b/spec/system/admin/site_customization/content_blocks_spec.rb @@ -26,7 +26,7 @@ describe "Admin custom content blocks", :admin do click_link "Create new content block" select I18n.t("admin.site_customization.content_blocks.content_block.names.footer"), - from: "site_customization_content_block_name" + from: "site_customization_content_block_name" select "es", from: "site_customization_content_block_locale" fill_in "site_customization_content_block_body", with: "Some custom content" @@ -51,7 +51,7 @@ describe "Admin custom content blocks", :admin do click_link "Create new content block" select I18n.t("admin.site_customization.content_blocks.content_block.names.top_links"), - from: "site_customization_content_block_name" + from: "site_customization_content_block_name" select "en", from: "site_customization_content_block_locale" fill_in "site_customization_content_block_body", with: "Some custom content" diff --git a/spec/system/admin/site_customization/information_texts_spec.rb b/spec/system/admin/site_customization/information_texts_spec.rb index 5b8ca7e20..1c085bc67 100644 --- a/spec/system/admin/site_customization/information_texts_spec.rb +++ b/spec/system/admin/site_customization/information_texts_spec.rb @@ -56,7 +56,7 @@ describe "Admin custom information texts", :admin do within("#information-texts-tabs") { click_link "Proposals" } expect(find("a[href=\"/admin/site_customization/information_texts?tab=proposals\"].is-active")) - .to have_content "Proposals" + .to have_content "Proposals" end context "Globalization" do @@ -104,8 +104,8 @@ describe "Admin custom information texts", :admin do value_es: "Destacar personalizado") page_title = create(:i18n_content, key: "debates.new.start_new", - value_en: "Start a new debate", - value_es: "Empezar un debate") + value_en: "Start a new debate", + value_es: "Empezar un debate") visit admin_site_customization_information_texts_path(tab: "debates") diff --git a/spec/system/admin/system_emails_spec.rb b/spec/system/admin/system_emails_spec.rb index cce079532..a2786207b 100644 --- a/spec/system/admin/system_emails_spec.rb +++ b/spec/system/admin/system_emails_spec.rb @@ -254,23 +254,30 @@ describe "System Emails" do describe "#evaluation_comment" do scenario "render correctly evaluaton comment mailer with valuator as a sample user" do admin = create(:administrator, user: create(:user, username: "Baby Doe")) - investment = create(:budget_investment, + investment = create( + :budget_investment, title: "Cleaner city", heading: heading, author: user, - administrator: admin) + administrator: admin + ) comment = create(:comment, :valuation, commentable: investment) visit admin_system_email_view_path("evaluation_comment") expect(page).to have_content "New evaluation comment for Cleaner city" expect(page).to have_content "Hi #{admin.name}" - expect(page).to have_content "There is a new evaluation comment from #{comment.user.name} "\ + expect(page).to have_content "There is a new evaluation comment from #{comment.user.name} " \ "to the budget investment Cleaner city" expect(page).to have_content comment.body expect(page).to have_link "Cleaner city", - href: admin_budget_budget_investment_url(investment.budget, investment, anchor: "comments", host: app_host) + href: admin_budget_budget_investment_url( + investment.budget, + investment, + anchor: "comments", + host: app_host + ) end scenario "uses a current_user as a sample user for sample regular comments" do @@ -312,8 +319,8 @@ describe "System Emails" do proposal1 = create(:proposal, title: "Proposal A") proposal2 = create(:proposal, title: "Proposal B") proposal_notification1 = create(:proposal_notification, proposal: proposal1, - title: "Proposal A Title", - body: "Proposal A Notification Body") + title: "Proposal A Title", + body: "Proposal A Notification Body") proposal_notification2 = create(:proposal_notification, proposal: proposal2) create(:notification, notifiable: proposal_notification1, emailed_at: nil) create(:notification, notifiable: proposal_notification2, emailed_at: nil) @@ -343,8 +350,8 @@ describe "System Emails" do scenario "#send_pending" do proposal = create(:proposal) proposal_notification = create(:proposal_notification, proposal: proposal, - title: "Proposal A Title", - body: "Proposal A Notification Body") + title: "Proposal A Title", + body: "Proposal A Notification Body") voter = create(:user, :level_two, followables: [proposal]) create(:notification, notifiable: proposal_notification, user: voter, emailed_at: nil) diff --git a/spec/system/admin/verifications_spec.rb b/spec/system/admin/verifications_spec.rb index 4700ad4c7..0d83c08f2 100644 --- a/spec/system/admin/verifications_spec.rb +++ b/spec/system/admin/verifications_spec.rb @@ -57,9 +57,9 @@ describe "Incomplete verifications", :admin do scenario "SMS code not confirmed" do incompletely_verified_user = create(:user, residence_verified_at: Time.current, - unconfirmed_phone: "611111111", + unconfirmed_phone: "611111111", sms_confirmation_code: "1234", - confirmed_phone: nil) + confirmed_phone: nil) visit admin_verifications_path diff --git a/spec/system/admin/widgets/cards_spec.rb b/spec/system/admin/widgets/cards_spec.rb index af4f215d2..d34549503 100644 --- a/spec/system/admin/widgets/cards_spec.rb +++ b/spec/system/admin/widgets/cards_spec.rb @@ -168,7 +168,7 @@ describe "Cards", :admin do click_link "Create card" expect(page).to have_link("Go back", - href: admin_site_customization_page_widget_cards_path(custom_page)) + href: admin_site_customization_page_widget_cards_path(custom_page)) fill_in "Title", with: "Card for a custom page" fill_in "Link URL", with: "/any_path" @@ -230,7 +230,7 @@ describe "Cards", :admin do click_link "Edit" expect(page).to have_link("Go back", - href: admin_site_customization_page_widget_cards_path(custom_page)) + href: admin_site_customization_page_widget_cards_path(custom_page)) within(".translatable-fields") do fill_in "Title", with: "Updated title" diff --git a/spec/system/banners_spec.rb b/spec/system/banners_spec.rb index 93c557fb3..8ec32428f 100644 --- a/spec/system/banners_spec.rb +++ b/spec/system/banners_spec.rb @@ -6,7 +6,7 @@ describe "Banner" do web_sections: [WebSection.find_by!(name: "homepage")], description: "Banner description", post_started_at: (Date.current - 4.days), - post_ended_at: (Date.current + 10.days)) + post_ended_at: (Date.current + 10.days)) visit root_path diff --git a/spec/system/budgets/ballots_spec.rb b/spec/system/budgets/ballots_spec.rb index 62653fdb0..ccd80d364 100644 --- a/spec/system/budgets/ballots_spec.rb +++ b/spec/system/budgets/ballots_spec.rb @@ -163,12 +163,14 @@ describe "Ballots" do scenario "map and content block shoud be visible before and after" do stub_const("#{Budgets::InvestmentsController}::PER_PAGE", 1) - create(:budget_investment, :selected, :with_map_location, + create( + :budget_investment, :selected, :with_map_location, heading: new_york, price: 10000, title: "More bridges", ) - create(:budget_investment, :selected, :with_map_location, + create( + :budget_investment, :selected, :with_map_location, heading: new_york, price: 5000, title: "Less bridges" diff --git a/spec/system/budgets/budgets_spec.rb b/spec/system/budgets/budgets_spec.rb index 155f86052..9a0589ecb 100644 --- a/spec/system/budgets/budgets_spec.rb +++ b/spec/system/budgets/budgets_spec.rb @@ -187,30 +187,30 @@ describe "Budgets" do name: "Custom name for informing phase") phases.accepting.update!(starts_at: "01-01-2018", ends_at: "10-01-2018", enabled: true, - description: "Description of accepting phase", - name: "Custom name for accepting phase") + description: "Description of accepting phase", + name: "Custom name for accepting phase") phases.reviewing.update!(starts_at: "11-01-2018", ends_at: "20-01-2018", enabled: false, - description: "Description of reviewing phase") + description: "Description of reviewing phase") phases.selecting.update!(starts_at: "21-01-2018", ends_at: "01-02-2018", enabled: true, - description: "Description of selecting phase", - name: "Custom name for selecting phase") + description: "Description of selecting phase", + name: "Custom name for selecting phase") phases.valuating.update!(starts_at: "10-02-2018", ends_at: "20-02-2018", enabled: false, - description: "Description of valuating phase") + description: "Description of valuating phase") phases.publishing_prices.update!(starts_at: "21-02-2018", ends_at: "01-03-2018", enabled: false, - description: "Description of publishing prices phase") + description: "Description of publishing prices phase") phases.balloting.update!(starts_at: "02-03-2018", ends_at: "10-03-2018", enabled: true, - description: "Description of balloting phase") + description: "Description of balloting phase") phases.reviewing_ballots.update!(starts_at: "11-03-2018", ends_at: "20-03-2018", enabled: false, - description: "Description of reviewing ballots phase") + description: "Description of reviewing ballots phase") phases.finished.update!(starts_at: "21-03-2018", ends_at: "30-03-2018", enabled: true, - description: "Description of finished phase") + description: "Description of finished phase") visit budgets_path diff --git a/spec/system/budgets/investments_spec.rb b/spec/system/budgets/investments_spec.rb index 0aa50b97a..c48f9425e 100644 --- a/spec/system/budgets/investments_spec.rb +++ b/spec/system/budgets/investments_spec.rb @@ -126,7 +126,7 @@ describe "Budget Investments" do end unlocated_heading = create(:budget_heading, name: "No Map", price: 500, group: group, - longitude: nil, latitude: nil) + longitude: nil, latitude: nil) create(:budget_investment, heading: unlocated_heading) visit budget_investments_path(budget, heading_id: unlocated_heading.id) within("#sidebar") do @@ -603,7 +603,7 @@ describe "Budget Investments" do fill_in_new_investment_title with: "Build a skyscraper" fill_in_ckeditor "Description", with: "I want to live in a high tower over the clouds" fill_in "Location additional info", with: "City center" - fill_in "If you are proposing in the name of a collective/organization, "\ + fill_in "If you are proposing in the name of a collective/organization, " \ "or on behalf of more people, write its name", with: "T.I.A." fill_in "Tags", with: "Towers" check "I agree to the Privacy Policy and the Terms and conditions of use" @@ -645,7 +645,7 @@ describe "Budget Investments" do visit new_budget_investment_path(budget) expect(page).to have_select "Heading", - options: ["", "More hospitals", "Medical supplies", "Even more hospitals"] + options: ["", "More hospitals", "Medical supplies", "Even more hospitals"] expect(page).not_to have_content "Health" end @@ -661,14 +661,14 @@ describe "Budget Investments" do expect(page).not_to have_content("#{heading.name} (#{budget.formatted_heading_price(heading)})") expect(page).to have_select "Heading", - options: ["", "Health: More hospitals", "Health: Medical supplies", "Education: Schools"] + options: ["", "Health: More hospitals", "Health: Medical supplies", "Education: Schools"] select "Health: Medical supplies", from: "Heading" fill_in_new_investment_title with: "Build a skyscraper" fill_in_ckeditor "Description", with: "I want to live in a high tower over the clouds" fill_in "Location additional info", with: "City center" - fill_in "If you are proposing in the name of a collective/organization, "\ + fill_in "If you are proposing in the name of a collective/organization, " \ "or on behalf of more people, write its name", with: "T.I.A." fill_in "Tags", with: "Towers" check "I agree to the Privacy Policy and the Terms and conditions of use" @@ -987,11 +987,11 @@ describe "Budget Investments" do unfeasibility_explanation: "Local government is not competent in this") investment_2 = create(:budget_investment, - :unfeasible, - :finished, - budget: budget, - heading: heading, - unfeasibility_explanation: "The unfeasible explanation") + :unfeasible, + :finished, + budget: budget, + heading: heading, + unfeasibility_explanation: "The unfeasible explanation") user = create(:user) login_as(user) @@ -1000,14 +1000,14 @@ describe "Budget Investments" do expect(page).not_to have_content("Unfeasibility explanation") expect(page).not_to have_content("Local government is not competent in this") - expect(page).not_to have_content("This investment project has been marked as not feasible "\ + expect(page).not_to have_content("This investment project has been marked as not feasible " \ "and will not go to balloting phase") visit budget_investment_path(budget, id: investment_2.id) expect(page).to have_content("Unfeasibility explanation") expect(page).to have_content("The unfeasible explanation") - expect(page).to have_content("This investment project has been marked as not feasible "\ + expect(page).to have_content("This investment project has been marked as not feasible " \ "and will not go to balloting phase") end @@ -1446,11 +1446,11 @@ describe "Budget Investments" do global_group = create(:budget_group, budget: budget, name: "Global Group") global_heading = create(:budget_heading, group: global_group, name: "Global Heading", - latitude: -43.145412, longitude: 12.009423) + latitude: -43.145412, longitude: 12.009423) carabanchel_heading = create(:budget_heading, group: group, name: "Carabanchel") new_york_heading = create(:budget_heading, group: group, name: "New York", - latitude: -43.223412, longitude: 12.009423) + latitude: -43.223412, longitude: 12.009423) create(:budget_investment, :selected, price: 1, heading: global_heading, title: "World T-Shirt") create(:budget_investment, :selected, price: 10, heading: global_heading, title: "Eco pens") @@ -1472,7 +1472,7 @@ describe "Budget Investments" do visit budget_ballot_path(budget) - expect(page).to have_content "But you can change your vote at any time "\ + expect(page).to have_content "But you can change your vote at any time " \ "until this phase is closed." within("#budget_group_#{global_group.id}") do diff --git a/spec/system/budgets/votes_spec.rb b/spec/system/budgets/votes_spec.rb index 15c5d4caa..9d38b47b6 100644 --- a/spec/system/budgets/votes_spec.rb +++ b/spec/system/budgets/votes_spec.rb @@ -20,17 +20,17 @@ describe "Votes" do within("#budget-investments") do within("#budget_investment_#{investment1.id}_votes") do - expect(page).to have_content "You have already supported this investment project. "\ + expect(page).to have_content "You have already supported this investment project. " \ "Share it!" end within("#budget_investment_#{investment2.id}_votes") do - expect(page).not_to have_content "You have already supported this investment project. "\ + expect(page).not_to have_content "You have already supported this investment project. " \ "Share it!" end within("#budget_investment_#{investment3.id}_votes") do - expect(page).not_to have_content "You have already supported this investment project. "\ + expect(page).not_to have_content "You have already supported this investment project. " \ "Share it!" end end @@ -45,7 +45,7 @@ describe "Votes" do click_button "Support" expect(page).to have_content "1 support" - expect(page).to have_content "You have already supported this investment project. "\ + expect(page).to have_content "You have already supported this investment project. " \ "Share it!" end end @@ -77,7 +77,7 @@ describe "Votes" do click_button "Support" expect(page).to have_content "1 support" - expect(page).to have_content "You have already supported this investment project. "\ + expect(page).to have_content "You have already supported this investment project. " \ "Share it!" end end @@ -123,7 +123,7 @@ describe "Votes" do accept_confirm { click_button "Support" } expect(page).to have_content "1 support" - expect(page).to have_content "You have already supported this investment project. "\ + expect(page).to have_content "You have already supported this investment project. " \ "Share it!" end @@ -135,7 +135,7 @@ describe "Votes" do click_button "Support" expect(page).to have_content "1 support" - expect(page).to have_content "You have already supported this investment project. "\ + expect(page).to have_content "You have already supported this investment project. " \ "Share it!" end @@ -144,17 +144,17 @@ describe "Votes" do within("#budget_investment_#{third_heading_investment.id}") do click_button "Support" - expect(page).to have_content "You can only support investment projects in 2 districts. "\ + expect(page).to have_content "You can only support investment projects in 2 districts. " \ "You have already supported investments in" participation = find(".participation-not-allowed") headings = participation.text - .match(/You have already supported investments in (.+) and (.+)\./)&.captures + .match(/You have already supported investments in (.+) and (.+)\./)&.captures expect(headings).to match_array [new_york.name, san_francisco.name] expect(page).not_to have_content "1 support" - expect(page).not_to have_content "You have already supported this investment project. "\ + expect(page).not_to have_content "You have already supported this investment project. " \ "Share it!" end end @@ -178,17 +178,17 @@ describe "Votes" do click_button "Support" - expect(page).to have_content "You can only support investment projects in 2 districts. "\ + expect(page).to have_content "You can only support investment projects in 2 districts. " \ "You have already supported investments in" participation = find(".participation-not-allowed") headings = participation.text - .match(/You have already supported investments in (.+) and (.+)\./)&.captures + .match(/You have already supported investments in (.+) and (.+)\./)&.captures expect(headings).to match_array [new_york.name, san_francisco.name] expect(page).not_to have_content "1 support" - expect(page).not_to have_content "You have already supported this investment project. "\ + expect(page).not_to have_content "You have already supported this investment project. " \ "Share it!" end diff --git a/spec/system/comments/budget_investments_spec.rb b/spec/system/comments/budget_investments_spec.rb index c8df55a93..6f7c6e55d 100644 --- a/spec/system/comments/budget_investments_spec.rb +++ b/spec/system/comments/budget_investments_spec.rb @@ -469,9 +469,9 @@ describe "Commenting Budget::Investments" do manuela = create(:user, username: "Manuela") admin = create(:administrator, user: manuela) comment = create(:comment, - commentable: investment, - user: manuela, - administrator_id: admin.id) + commentable: investment, + user: manuela, + administrator_id: admin.id) visit budget_investment_path(investment.budget, investment) diff --git a/spec/system/comments/budget_investments_valuation_spec.rb b/spec/system/comments/budget_investments_valuation_spec.rb index 47d9823cc..1dc008483 100644 --- a/spec/system/comments/budget_investments_valuation_spec.rb +++ b/spec/system/comments/budget_investments_valuation_spec.rb @@ -130,7 +130,7 @@ describe "Internal valuation comments on Budget::Investments" do end scenario "Sanitizes comment body for security" do - comment_with_js = " "\ + comment_with_js = " " \ "click me http://www.url.com" create(:comment, :valuation, author: admin_user, commentable: investment, body: comment_with_js) diff --git a/spec/system/dashboard/dashboard_spec.rb b/spec/system/dashboard/dashboard_spec.rb index 97ee9d466..6eb79dbb2 100644 --- a/spec/system/dashboard/dashboard_spec.rb +++ b/spec/system/dashboard/dashboard_spec.rb @@ -25,9 +25,9 @@ describe "Proposal's dashboard" do scenario "Dashboard progress shows current goal" do goal = create(:dashboard_action, :resource, :active, - required_supports: proposal.votes_for.size + 1_000) + required_supports: proposal.votes_for.size + 1_000) future_goal = create(:dashboard_action, :resource, :active, - required_supports: proposal.votes_for.size + 2_000) + required_supports: proposal.votes_for.size + 2_000) visit progress_proposal_dashboard_path(proposal) @@ -58,10 +58,10 @@ describe "Proposal's dashboard" do scenario "Dashboard progress show proposed actions truncated description" do action = create(:dashboard_action, :proposed_action, :active, description: "One short action") action_long = create(:dashboard_action, :proposed_action, :active, - description: "This is a really very long description for a proposed "\ - "action on progress dashboard section, so this description "\ - "should be appear truncated and shows the show description "\ - "link to show the complete description to the users.") + description: "This is a really very long description for a proposed " \ + "action on progress dashboard section, so this description " \ + "should be appear truncated and shows the show description " \ + "link to show the complete description to the users.") visit progress_proposal_dashboard_path(proposal) @@ -154,16 +154,18 @@ describe "Proposal's dashboard" do requested = create(:dashboard_action, :resource, :admin_request, :active) executed_action = create(:dashboard_executed_action, action: requested, - proposal: proposal, executed_at: Time.current) + proposal: proposal, + executed_at: Time.current) _task = create(:dashboard_administrator_task, :pending, source: executed_action) solved = create(:dashboard_action, :resource, :admin_request, :active) executed_solved_action = create(:dashboard_executed_action, action: solved, - proposal: proposal, executed_at: Time.current) + proposal: proposal, + executed_at: Time.current) _solved_task = create(:dashboard_administrator_task, :done, source: executed_solved_action) unavailable = create(:dashboard_action, :resource, :active, - required_supports: proposal.votes_for.size + 1_000) + required_supports: proposal.votes_for.size + 1_000) visit progress_proposal_dashboard_path(proposal) within "div#available-resources-section" do @@ -199,16 +201,18 @@ describe "Proposal's dashboard" do requested = create(:dashboard_action, :resource, :admin_request, :active) executed_action = create(:dashboard_executed_action, action: requested, - proposal: proposal, executed_at: Time.current) + proposal: proposal, + executed_at: Time.current) _task = create(:dashboard_administrator_task, :pending, source: executed_action) solved = create(:dashboard_action, :resource, :admin_request, :active) executed_solved_action = create(:dashboard_executed_action, action: solved, - proposal: proposal, executed_at: Time.current) + proposal: proposal, + executed_at: Time.current) _solved_task = create(:dashboard_administrator_task, :done, source: executed_solved_action) unavailable = create(:dashboard_action, :resource, :active, - required_supports: proposal.votes_for.size + 1_000) + required_supports: proposal.votes_for.size + 1_000) visit progress_proposal_dashboard_path(proposal) within "div#available-resources-section" do @@ -241,8 +245,8 @@ describe "Proposal's dashboard" do scenario "Dashboard progress dont show resources with published_proposal: true" do available = create(:dashboard_action, :resource, :active, published_proposal: true) unavailable = create(:dashboard_action, :resource, :active, - required_supports: proposal.votes_for.size + 1_000, - published_proposal: true) + required_supports: proposal.votes_for.size + 1_000, + published_proposal: true) visit progress_proposal_dashboard_path(proposal) @@ -269,7 +273,7 @@ describe "Proposal's dashboard" do click_link(feature.title) click_button "Request" - expect(page).to have_content("The request has been successfully sent. We will contact you "\ + expect(page).to have_content("The request has been successfully sent. We will contact you " \ "as soon as possible to inform you about it.") end @@ -294,7 +298,7 @@ describe "Proposal's dashboard" do end click_button "Request" - expect(page).to have_content("The request has been successfully sent. We will contact you "\ + expect(page).to have_content("The request has been successfully sent. We will contact you " \ "as soon as possible to inform you about it.") end @@ -377,7 +381,7 @@ describe "Proposal's dashboard" do visit messages_proposal_dashboard_path(proposal) expect(page).to have_link("See previous notifications", href: proposal_path(proposal, - anchor: "tab-notifications")) + anchor: "tab-notifications")) end scenario "Dashboard has a related content section" do @@ -511,7 +515,7 @@ describe "Proposal's dashboard" do scenario "Display tag 'new' on proposed_action when it is new for author since last login" do proposed_action = create(:dashboard_action, :proposed_action, :active, day_offset: 0, - published_proposal: false) + published_proposal: false) visit progress_proposal_dashboard_path(proposal) @@ -522,7 +526,7 @@ describe "Proposal's dashboard" do scenario "Not display tag 'new' on proposed_action when there is not new since last login" do proposed_action = create(:dashboard_action, :proposed_action, :active, day_offset: 0, - published_proposal: false) + published_proposal: false) proposal.author.update!(current_sign_in_at: Date.current) visit progress_proposal_dashboard_path(proposal) diff --git a/spec/system/emails_spec.rb b/spec/system/emails_spec.rb index a439921b7..38f1ea940 100644 --- a/spec/system/emails_spec.rb +++ b/spec/system/emails_spec.rb @@ -496,7 +496,8 @@ describe "Emails" do expect(email.body.encoded).to include("This is a different body") expect(email).to have_body_text("To unsubscribe from these emails, visit") expect(email).to have_body_text( - edit_subscriptions_path(token: user_with_newsletter_in_segment_2.subscriptions_token)) + edit_subscriptions_path(token: user_with_newsletter_in_segment_2.subscriptions_token) + ) expect(email).to have_body_text('and uncheck "Receive relevant information by email"') end end diff --git a/spec/system/home_spec.rb b/spec/system/home_spec.rb index 6a2a36456..f74659a07 100644 --- a/spec/system/home_spec.rb +++ b/spec/system/home_spec.rb @@ -157,7 +157,8 @@ describe "Home" do end scenario "if there are cards, the 'featured' title will render" do - create(:widget_card, + create( + :widget_card, title: "Card text", description: "Card description", link_text: "Link text", diff --git a/spec/system/legislation/draft_versions_spec.rb b/spec/system/legislation/draft_versions_spec.rb index b3d69f30e..962adc087 100644 --- a/spec/system/legislation/draft_versions_spec.rb +++ b/spec/system/legislation/draft_versions_spec.rb @@ -348,9 +348,9 @@ describe "Legislation Draft Versions" do before do create(:legislation_annotation, draft_version: original, quote: "quote for version 1", - ranges: [{ "start" => "/p[1]", "startOffset" => 11, "end" => "/p[1]", "endOffset" => 30 }]) + ranges: [{ "start" => "/p[1]", "startOffset" => 11, "end" => "/p[1]", "endOffset" => 30 }]) create(:legislation_annotation, draft_version: current, quote: "quote for version 2", - ranges: [{ "start" => "/p[1]", "startOffset" => 11, "end" => "/p[1]", "endOffset" => 30 }]) + ranges: [{ "start" => "/p[1]", "startOffset" => 11, "end" => "/p[1]", "endOffset" => 30 }]) end scenario "without js", :no_js do @@ -386,7 +386,7 @@ describe "Legislation Draft Versions" do scenario "See one annotation with replies for a draft version" do annotation = create(:legislation_annotation, draft_version: draft_version, text: "my other annotation", quote: "audiam", - ranges: [{ "start" => "/p[3]", "startOffset" => 6, "end" => "/p[3]", "endOffset" => 11 }]) + ranges: [{ "start" => "/p[3]", "startOffset" => 6, "end" => "/p[3]", "endOffset" => 11 }]) visit legislation_process_draft_version_annotation_path(draft_version.process, draft_version, annotation) diff --git a/spec/system/legislation/processes_spec.rb b/spec/system/legislation/processes_spec.rb index 406cec2cf..6540ae3e5 100644 --- a/spec/system/legislation/processes_spec.rb +++ b/spec/system/legislation/processes_spec.rb @@ -399,10 +399,9 @@ describe "Legislation" do scenario "With milestones" do create(:milestone, - milestoneable: process, - description: "Something important happened", - publication_date: Date.new(2018, 3, 22) - ) + milestoneable: process, + description: "Something important happened", + publication_date: Date.new(2018, 3, 22)) visit legislation_process_path(process) diff --git a/spec/system/legislation/summary_spec.rb b/spec/system/legislation/summary_spec.rb index 94f3d1ab6..37618b9e1 100644 --- a/spec/system/legislation/summary_spec.rb +++ b/spec/system/legislation/summary_spec.rb @@ -21,9 +21,8 @@ describe "Legislation" do scenario "empty process" do process = create(:legislation_process, :empty, - result_publication_enabled: true, - end_date: Date.current - 1.day - ) + result_publication_enabled: true, + end_date: Date.current - 1.day) visit summary_legislation_process_path(process) @@ -90,13 +89,13 @@ describe "Legislation" do before do create(:legislation_proposal, legislation_process_id: process.id, - title: "Legislation proposal 1", selected: true) + title: "Legislation proposal 1", selected: true) create(:legislation_proposal, legislation_process_id: process.id, - title: "Legislation proposal 2", selected: false) + title: "Legislation proposal 2", selected: false) create(:legislation_proposal, legislation_process_id: process.id, - title: "Legislation proposal 3", selected: true) + title: "Legislation proposal 3", selected: true) create(:legislation_proposal, legislation_process_id: process.id, - title: "Legislation proposal 4", selected: false) + title: "Legislation proposal 4", selected: false) end scenario "shows proposals list" do @@ -125,11 +124,11 @@ describe "Legislation" do before do user = create(:user, :level_two) draft_version_1 = create(:legislation_draft_version, process: process, - title: "Version 1", body: "Body of the first version", - status: "published") + title: "Version 1", body: "Body of the first version", + status: "published") draft_version_2 = create(:legislation_draft_version, process: process, - title: "Version 2", body: "Body of the second version and that's it all of it", - status: "published") + title: "Version 2", body: "Body of the second version and that's it all of it", + status: "published") annotation0 = create(:legislation_annotation, draft_version: draft_version_1, text: "my annotation123", ranges: annotation_ranges(5, 10)) diff --git a/spec/system/machine_learning_spec.rb b/spec/system/machine_learning_spec.rb index 0017b5a76..93bbd6115 100644 --- a/spec/system/machine_learning_spec.rb +++ b/spec/system/machine_learning_spec.rb @@ -24,8 +24,8 @@ describe "Machine learning" do scenario "proposal view" do create(:ml_summary_comment, commentable: proposal, body: "Life is wonderful") create(:related_content, parent_relationable: proposal, - child_relationable: related_proposal, - machine_learning: true) + child_relationable: related_proposal, + machine_learning: true) visit proposal_path(proposal) @@ -50,8 +50,8 @@ describe "Machine learning" do scenario "investment view" do create(:ml_summary_comment, commentable: investment, body: "Build in the main square") create(:related_content, parent_relationable: investment, - child_relationable: related_investment, - machine_learning: true) + child_relationable: related_investment, + machine_learning: true) visit budget_investment_path(investment.budget, investment) diff --git a/spec/system/management/document_verifications_spec.rb b/spec/system/management/document_verifications_spec.rb index 30cb8de69..0549066cb 100644 --- a/spec/system/management/document_verifications_spec.rb +++ b/spec/system/management/document_verifications_spec.rb @@ -32,8 +32,9 @@ describe "DocumentVerifications" do describe "Verifying througth Census" do context "Census API" do scenario "Verifying a user which does not exist and is not in the census shows an error" do - expect_any_instance_of(Verification::Management::Document).to receive(:in_census?). - and_return(false) + expect_any_instance_of(Verification::Management::Document) + .to receive(:in_census?) + .and_return(false) login_as_manager visit management_document_verifications_path @@ -55,8 +56,9 @@ describe "DocumentVerifications" do context "Remote Census API", :remote_census do scenario "Verifying a user which does not exist and is not in the census shows an error" do - expect_any_instance_of(Verification::Management::Document).to receive(:in_census?). - and_return(false) + expect_any_instance_of(Verification::Management::Document) + .to receive(:in_census?) + .and_return(false) login_as_manager visit management_document_verifications_path diff --git a/spec/system/moderation/budget_investments_spec.rb b/spec/system/moderation/budget_investments_spec.rb index 0ec232715..bf8ec87d1 100644 --- a/spec/system/moderation/budget_investments_spec.rb +++ b/spec/system/moderation/budget_investments_spec.rb @@ -197,21 +197,24 @@ describe "Moderate budget investments" do end scenario "sorting investments" do - flagged_investment = create(:budget_investment, + flagged_investment = create( + :budget_investment, heading: heading, title: "Flagged investment", created_at: 1.day.ago, flags_count: 5 ) - flagged_new_investment = create(:budget_investment, + flagged_new_investment = create( + :budget_investment, heading: heading, title: "Flagged new investment", created_at: 12.hours.ago, flags_count: 3 ) - latest_investment = create(:budget_investment, + latest_investment = create( + :budget_investment, heading: heading, title: "Latest investment", created_at: Time.current diff --git a/spec/system/officing/results_spec.rb b/spec/system/officing/results_spec.rb index 4ffe58cc4..7fa0d8926 100644 --- a/spec/system/officing/results_spec.rb +++ b/spec/system/officing/results_spec.rb @@ -80,14 +80,16 @@ describe "Officing Results", :with_frozen_time do end scenario "Edit result" do - partial_result = create(:poll_partial_result, - officer_assignment: poll_officer.officer_assignments.first, - booth_assignment: poll_officer.officer_assignments.first.booth_assignment, - date: Date.current, - question: question_1, - answer: question_1.question_answers.first.title, - author: poll_officer.user, - amount: 7777) + partial_result = create( + :poll_partial_result, + officer_assignment: poll_officer.officer_assignments.first, + booth_assignment: poll_officer.officer_assignments.first.booth_assignment, + date: Date.current, + question: question_1, + answer: question_1.question_answers.first.title, + author: poll_officer.user, + amount: 7777 + ) visit officing_poll_results_path(poll, date: I18n.l(partial_result.date), booth_assignment_id: partial_result.booth_assignment_id) @@ -129,20 +131,24 @@ describe "Officing Results", :with_frozen_time do booth_assignment = officer_assignment.booth_assignment booth = booth_assignment.booth - create(:poll_partial_result, + create( + :poll_partial_result, officer_assignment: officer_assignment, booth_assignment: booth_assignment, date: poll.ends_at, question: question_1, - amount: 33) + amount: 33 + ) - create(:poll_recount, + create( + :poll_recount, officer_assignment: officer_assignment, booth_assignment: booth_assignment, date: poll.ends_at, white_amount: 21, null_amount: 44, - total_amount: 66) + total_amount: 66 + ) visit officing_poll_results_path(poll, date: I18n.l(poll.ends_at.to_date), diff --git a/spec/system/proposal_notifications_spec.rb b/spec/system/proposal_notifications_spec.rb index d15889dcc..53f763de7 100644 --- a/spec/system/proposal_notifications_spec.rb +++ b/spec/system/proposal_notifications_spec.rb @@ -17,7 +17,7 @@ describe "Proposal Notifications" do click_link "Send notification to proposal followers" fill_in "proposal_notification_title", with: "Thank you for supporting my proposal" - fill_in "proposal_notification_body", with: "Please share it with "\ + fill_in "proposal_notification_body", with: "Please share it with " \ "others so we can make it happen!" click_button "Send notification" @@ -79,11 +79,11 @@ describe "Proposal Notifications" do proposal = create(:proposal) create(:proposal_notification, - proposal: proposal, title: "Hey guys", - body: "Just wanted to let you know that...") + proposal: proposal, title: "Hey guys", + body: "Just wanted to let you know that...") create(:proposal_notification, - proposal: proposal, title: "Another update", - body: "We are almost there please share with your peoples!") + proposal: proposal, title: "Another update", + body: "We are almost there please share with your peoples!") visit proposal_path(proposal) click_link "Notifications (2)" @@ -104,10 +104,10 @@ describe "Proposal Notifications" do login_as(author) visit new_proposal_notification_path(proposal_id: proposal.id) - expect(page).to have_content "This notification will be sent to 7 people and it will "\ + expect(page).to have_content "This notification will be sent to 7 people and it will " \ "be visible in the proposal's page" expect(page).to have_link("the proposal's page", href: proposal_path(proposal, - anchor: "comments")) + anchor: "comments")) end scenario "Message about receivers (Disctinct Followers and Voters)" do @@ -120,10 +120,10 @@ describe "Proposal Notifications" do login_as(author) visit new_proposal_notification_path(proposal_id: proposal.id) - expect(page).to have_content "This notification will be sent to 7 people and it will "\ + expect(page).to have_content "This notification will be sent to 7 people and it will " \ "be visible in the proposal's page" expect(page).to have_link("the proposal's page", href: proposal_path(proposal, - anchor: "comments")) + anchor: "comments")) end scenario "Message about receivers (Same Followers and Voters)" do @@ -135,10 +135,10 @@ describe "Proposal Notifications" do login_as(author) visit new_proposal_notification_path(proposal_id: proposal.id) - expect(page).to have_content "This notification will be sent to 1 people and it will "\ + expect(page).to have_content "This notification will be sent to 1 people and it will " \ "be visible in the proposal's page" expect(page).to have_link("the proposal's page", href: proposal_path(proposal, - anchor: "comments")) + anchor: "comments")) end context "Permissions" do @@ -190,7 +190,7 @@ describe "Proposal Notifications" do visit new_proposal_notification_path(proposal_id: proposal.id) fill_in "proposal_notification_title", with: "Thank you for supporting my proposal" - fill_in "proposal_notification_body", with: "Please share it with "\ + fill_in "proposal_notification_body", with: "Please share it with " \ "others so we can make it happen!" click_button "Send notification" @@ -242,7 +242,7 @@ describe "Proposal Notifications" do visit new_proposal_notification_path(proposal_id: proposal.id) fill_in "proposal_notification_title", with: "Thank you for supporting my proposal" - fill_in "proposal_notification_body", with: "Please share it with "\ + fill_in "proposal_notification_body", with: "Please share it with " \ "others so we can make it happen!" click_button "Send notification" @@ -292,7 +292,7 @@ describe "Proposal Notifications" do visit new_proposal_notification_path(proposal_id: proposal.id) fill_in "proposal_notification_title", with: "Thank you for supporting my proposal" - fill_in "proposal_notification_body", with: "Please share it with "\ + fill_in "proposal_notification_body", with: "Please share it with " \ "others so we can make it happen!" click_button "Send notification" diff --git a/spec/system/proposals_spec.rb b/spec/system/proposals_spec.rb index bf0dcb2a9..5969d856a 100644 --- a/spec/system/proposals_spec.rb +++ b/spec/system/proposals_spec.rb @@ -1000,7 +1000,7 @@ describe "Proposals" do Setting["feature.featured_proposals"] = true featured_proposal = create(:proposal, :with_confidence_score, cached_votes_up: 100) archived_proposal = create(:proposal, :archived, :with_confidence_score, - cached_votes_up: 10000) + cached_votes_up: 10000) visit proposals_path diff --git a/spec/system/sdg_management/local_targets_spec.rb b/spec/system/sdg_management/local_targets_spec.rb index 77d5e6065..ea1da65fc 100644 --- a/spec/system/sdg_management/local_targets_spec.rb +++ b/spec/system/sdg_management/local_targets_spec.rb @@ -89,7 +89,7 @@ describe "Local Targets" do sdg_local_target = create(:sdg_local_target, code: "1.1.1") visit sdg_management_local_targets_path - confirmation = "Are you sure? This action will delete "\ + confirmation = "Are you sure? This action will delete " \ "\"#{sdg_local_target.title}\" and can't be undone." accept_confirm(confirmation) { click_button "Delete" } diff --git a/spec/system/site_customization/custom_pages_spec.rb b/spec/system/site_customization/custom_pages_spec.rb index 138b4b0d5..e7586d939 100644 --- a/spec/system/site_customization/custom_pages_spec.rb +++ b/spec/system/site_customization/custom_pages_spec.rb @@ -4,7 +4,8 @@ describe "Custom Pages" do context "New custom page" do context "Published" do scenario "See page" do - custom_page = create(:site_customization_page, :published, + custom_page = create( + :site_customization_page, :published, slug: "other-slug", title_en: "Custom page", content_en: "Text for new custom page", @@ -20,7 +21,8 @@ describe "Custom Pages" do end scenario "Show all fields and text with links" do - custom_page = create(:site_customization_page, :published, + custom_page = create( + :site_customization_page, :published, slug: "slug-with-all-fields-filled", title_en: "Custom page", subtitle_en: "This is my new custom page", @@ -39,7 +41,8 @@ describe "Custom Pages" do end scenario "Don't show subtitle if its blank" do - custom_page = create(:site_customization_page, :published, + custom_page = create( + :site_customization_page, :published, slug: "slug-without-subtitle", title_en: "Custom page", subtitle_en: "", @@ -57,7 +60,8 @@ describe "Custom Pages" do end scenario "Listed in more information page" do - create(:site_customization_page, :published, + create( + :site_customization_page, :published, slug: "another-slug", title_en: "Another custom page", subtitle_en: "Subtitle for custom page", @@ -70,7 +74,8 @@ describe "Custom Pages" do end scenario "Not listed in more information page" do - custom_page = create(:site_customization_page, :published, + custom_page = create( + :site_customization_page, :published, slug: "another-slug", title_en: "Another custom page", subtitle_en: "Subtitle for custom page", more_info_flag: false diff --git a/spec/system/tags/budget_investments_spec.rb b/spec/system/tags/budget_investments_spec.rb index 5ba391688..b970f59e1 100644 --- a/spec/system/tags/budget_investments_spec.rb +++ b/spec/system/tags/budget_investments_spec.rb @@ -6,7 +6,7 @@ describe "Tags" do let(:group) { create(:budget_group, name: "Health", budget: budget) } let!(:heading) do create(:budget_heading, name: "More hospitals", - group: group, latitude: "40.416775", longitude: "-3.703790") + group: group, latitude: "40.416775", longitude: "-3.703790") end let!(:tag_medio_ambiente) { create(:tag, :category, name: "Medio Ambiente") } let!(:tag_economia) { create(:tag, :category, name: "Economía") } diff --git a/spec/system/users_auth_spec.rb b/spec/system/users_auth_spec.rb index 646cd3716..9257a70e2 100644 --- a/spec/system/users_auth_spec.rb +++ b/spec/system/users_auth_spec.rb @@ -611,7 +611,7 @@ describe "Users" do fill_in "Email", with: "manuela@consul.dev" click_button "Send instructions" - expect(page).to have_content "If your email address is in our database, in a few minutes "\ + expect(page).to have_content "If your email address is in our database, in a few minutes " \ "you will receive a link to use to reset your password." action_mailer = ActionMailer::Base.deliveries.last.body.to_s @@ -633,7 +633,7 @@ describe "Users" do fill_in "Email", with: "fake@mail.dev" click_button "Send instructions" - expect(page).to have_content "If your email address is in our database, in a few minutes "\ + expect(page).to have_content "If your email address is in our database, in a few minutes " \ "you will receive a link to use to reset your password." end @@ -648,7 +648,7 @@ describe "Users" do fill_in "Email", with: "manuela@consul.dev" click_button "Re-send instructions" - expect(page).to have_content "If your email address exists in our database, in a few minutes you will "\ + expect(page).to have_content "If your email address exists in our database, in a few minutes you will " \ "receive an email with instructions on how to confirm your email address." expect(ActionMailer::Base.deliveries.count).to eq(1) expect(ActionMailer::Base.deliveries.first.to).to eq(["manuela@consul.dev"]) @@ -664,7 +664,7 @@ describe "Users" do fill_in "Email", with: "fake@mail.dev" click_button "Re-send instructions" - expect(page).to have_content "If your email address exists in our database, in a few minutes you will "\ + expect(page).to have_content "If your email address exists in our database, in a few minutes you will " \ "receive an email with instructions on how to confirm your email address." expect(ActionMailer::Base.deliveries.count).to eq(0) end @@ -680,7 +680,7 @@ describe "Users" do fill_in "user_email", with: "manuela@consul.dev" click_button "Re-send instructions" - expect(page).to have_content "If your email address exists in our database, in a few minutes you will "\ + expect(page).to have_content "If your email address exists in our database, in a few minutes you will " \ "receive an email with instructions on how to confirm your email address." expect(ActionMailer::Base.deliveries.count).to eq(1) expect(ActionMailer::Base.deliveries.first.to).to eq(["manuela@consul.dev"]) diff --git a/spec/system/valuation/budget_investments_spec.rb b/spec/system/valuation/budget_investments_spec.rb index 38fe053aa..2fda09f67 100644 --- a/spec/system/valuation/budget_investments_spec.rb +++ b/spec/system/valuation/budget_investments_spec.rb @@ -202,10 +202,11 @@ describe "Valuation budget investments" do create(:valuator, user: create(:user, username: "Rick", email: "rick@valuators.org")) end let(:investment) do - create(:budget_investment, :unfeasible, budget: budget, price: 1234, - unfeasibility_explanation: "It is impossible", - administrator: administrator, - valuators: [valuator, second_valuator]) + create(:budget_investment, :unfeasible, budget: budget, + price: 1234, + unfeasibility_explanation: "It is impossible", + administrator: administrator, + valuators: [valuator, second_valuator]) end scenario "visible for assigned valuators" do diff --git a/spec/system/verification/email_spec.rb b/spec/system/verification/email_spec.rb index 3c3a4381f..3bd429772 100644 --- a/spec/system/verification/email_spec.rb +++ b/spec/system/verification/email_spec.rb @@ -4,13 +4,13 @@ describe "Verify email" do scenario "Verify" do user = create(:user, residence_verified_at: Time.current, - document_number: "12345678Z", - document_type: "dni") + document_number: "12345678Z", + document_type: "dni") verified_user = create(:verified_user, document_number: "12345678Z", - document_type: "dni", - email: "rock@example.com") + document_type: "dni", + email: "rock@example.com") login_as(user) @@ -44,13 +44,13 @@ describe "Verify email" do scenario "Errors on sending confirmation email" do user = create(:user, residence_verified_at: Time.current, - document_number: "12345678Z", - document_type: "dni") + document_number: "12345678Z", + document_type: "dni") verified_user = create(:verified_user, document_number: "12345678Z", - document_type: "dni", - email: "rock@example.com") + document_type: "dni", + email: "rock@example.com") login_as(user) diff --git a/spec/system/verification/letter_spec.rb b/spec/system/verification/letter_spec.rb index 5ff61fde5..f75a64669 100644 --- a/spec/system/verification/letter_spec.rb +++ b/spec/system/verification/letter_spec.rb @@ -3,14 +3,14 @@ require "rails_helper" describe "Verify Letter" do scenario "Request a letter" do user = create(:user, residence_verified_at: Time.current, - confirmed_phone: "611111111") + confirmed_phone: "611111111") login_as(user) visit new_letter_path click_link "Send me a letter with the code" - expect(page).to have_content "Thank you for requesting your maximum security code (only required for the final votes). In a few days"\ + expect(page).to have_content "Thank you for requesting your maximum security code (only required for the final votes). In a few days" \ " we will send it to the address featuring in the data we have on file." user.reload @@ -42,7 +42,7 @@ describe "Verify Letter" do context "Code verification" do scenario "Valid verification user logged in" do user = create(:user, residence_verified_at: Time.current, - confirmed_phone: "611111111", + confirmed_phone: "611111111", letter_verification_code: "123456") login_as(user) @@ -59,7 +59,7 @@ describe "Verify Letter" do scenario "Valid verification of user failing to add trailing zeros" do user = create(:user, residence_verified_at: Time.current, - confirmed_phone: "611111111", + confirmed_phone: "611111111", letter_verification_code: "012345") login_as(user) @@ -76,7 +76,7 @@ describe "Verify Letter" do scenario "Valid verification user not logged in" do user = create(:user, residence_verified_at: Time.current, - confirmed_phone: "611111111", + confirmed_phone: "611111111", letter_verification_code: "123456") visit edit_letter_path @@ -100,7 +100,7 @@ describe "Verify Letter" do scenario "Error messages on verification" do user = create(:user, residence_verified_at: Time.current, - confirmed_phone: "611111111") + confirmed_phone: "611111111") visit edit_letter_path fill_in "verification_letter_email", with: user.email @@ -111,8 +111,8 @@ describe "Verify Letter" do end scenario "6 tries allowed" do - user = create(:user, residence_verified_at: Time.current, - confirmed_phone: "611111111", + user = create(:user, residence_verified_at: Time.current, + confirmed_phone: "611111111", letter_verification_code: "123456") visit edit_letter_path diff --git a/spec/system/verification/level_three_verification_spec.rb b/spec/system/verification/level_three_verification_spec.rb index ad55f30fd..0d2a30749 100644 --- a/spec/system/verification/level_three_verification_spec.rb +++ b/spec/system/verification/level_three_verification_spec.rb @@ -7,8 +7,8 @@ describe "Level three verification" do verified_user = create(:verified_user, document_number: "12345678Z", - document_type: "1", - phone: "611111111") + document_type: "1", + phone: "611111111") login_as(user) @@ -39,8 +39,8 @@ describe "Level three verification" do verified_user = create(:verified_user, document_number: "12345678Z", - document_type: "1", - email: "rock@example.com") + document_type: "1", + email: "rock@example.com") login_as(user) @@ -87,7 +87,7 @@ describe "Level three verification" do click_link "Send me a letter with the code" - expect(page).to have_content "Thank you for requesting your maximum security code (only required for the final votes)."\ + expect(page).to have_content "Thank you for requesting your maximum security code (only required for the final votes)." \ " In a few days we will send it to the address featuring in the data we have on file." end end diff --git a/spec/system/verification/residence_spec.rb b/spec/system/verification/residence_spec.rb index 22ad66d11..c54e44fee 100644 --- a/spec/system/verification/residence_spec.rb +++ b/spec/system/verification/residence_spec.rb @@ -48,9 +48,9 @@ describe "Residence" do click_link "Verify my account" expect(page).to have_select("residence_date_of_birth_1i", - with_options: [min_age.years.ago.year]) + with_options: [min_age.years.ago.year]) expect(page).not_to have_select("residence_date_of_birth_1i", - with_options: [underage.years.ago.year]) + with_options: [underage.years.ago.year]) end scenario "When trying to verify a deregistered account old votes are reassigned" do