From 911fe4e481be33d915c472379895bd528f29f73c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sat, 22 Jun 2019 03:59:53 +0200 Subject: [PATCH] Simplify calls to render partial We're also adding a bit of consistency, since most of our calls to partial rendering omit the `partial` and `locals` keys. --- app/helpers/images_helper.rb | 6 +++--- .../admin/admin_notifications/show.html.erb | 2 +- .../budget_investments/_investments.html.erb | 4 ++-- app/views/admin/budget_investments/show.html.erb | 2 +- .../local_census_records/imports/show.html.erb | 8 ++++---- .../admin/poll/booth_assignments/manage.html.erb | 2 +- app/views/admin/poll/booths/index.html.erb | 2 +- .../admin/system_emails/preview_pending.html.erb | 4 ++-- app/views/admin/valuators/_valuators.html.erb | 6 +++--- app/views/admin/valuators/index.html.erb | 2 +- app/views/admin/valuators/search.html.erb | 2 +- .../budgets/investments/_investment.html.erb | 8 ++++---- .../investments/_investment_show.html.erb | 11 +++++------ app/views/budgets/investments/_votes.html.erb | 4 ++-- app/views/budgets/investments/index.html.erb | 16 +++++++--------- app/views/budgets/investments/show.html.erb | 10 +++++----- app/views/dashboard/mailing/index.html.erb | 4 ++-- app/views/debates/index.html.erb | 2 +- app/views/debates/show.html.erb | 4 ++-- app/views/layouts/application.html.erb | 2 +- app/views/layouts/dashboard.html.erb | 12 ++++++------ app/views/layouts/proposals_dashboard.html.erb | 12 ++++++------ app/views/legislation/annotations/show.html.erb | 6 +++--- app/views/legislation/processes/_header.html.erb | 4 ++-- .../proposals/_featured_votes.html.erb | 4 ++-- app/views/legislation/proposals/_votes.html.erb | 4 ++-- app/views/legislation/proposals/show.html.erb | 4 ++-- app/views/legislation/questions/show.html.erb | 6 +++--- .../budgets/investments/index.html.erb | 4 ++-- .../budgets/investments/print.html.erb | 4 ++-- .../management/budgets/investments/show.html.erb | 4 ++-- .../management/proposals/_proposal.html.erb | 2 +- app/views/notifications/_notification.html.erb | 2 +- app/views/notifications/index.html.erb | 2 +- app/views/polls/_poll_header.html.erb | 4 ++-- app/views/polls/index.html.erb | 4 ++-- app/views/proposals/_featured_votes.html.erb | 4 ++-- app/views/proposals/index.html.erb | 2 +- app/views/proposals/share.html.erb | 4 ++-- .../_valuation_comments.html.erb | 4 ++-- .../valuation/budget_investments/edit.html.erb | 6 +++--- .../valuation/budget_investments/show.html.erb | 2 +- 42 files changed, 99 insertions(+), 102 deletions(-) diff --git a/app/helpers/images_helper.rb b/app/helpers/images_helper.rb index 1998e63f5..1508d1a43 100644 --- a/app/helpers/images_helper.rb +++ b/app/helpers/images_helper.rb @@ -65,9 +65,9 @@ module ImagesHelper def render_image(image, version, show_caption = true) version = image.persisted? ? version : :original - render partial: "images/image", locals: { image: image, - version: version, - show_caption: show_caption } + render "images/image", image: image, + version: version, + show_caption: show_caption end def image_direct_upload_url(imageable) diff --git a/app/views/admin/admin_notifications/show.html.erb b/app/views/admin/admin_notifications/show.html.erb index 2fc79cf0e..ad2445edf 100644 --- a/app/views/admin/admin_notifications/show.html.erb +++ b/app/views/admin/admin_notifications/show.html.erb @@ -55,7 +55,7 @@ title: @admin_notification.title, body: @admin_notification.body, timestamp: Time.current } %> - <% link_text = render partial: "/notifications/notification_body", locals: locals %> + <% link_text = render "/notifications/notification_body", locals %> <%= link_to_if @admin_notification.link.present?, link_text, @admin_notification.link %> diff --git a/app/views/admin/budget_investments/_investments.html.erb b/app/views/admin/budget_investments/_investments.html.erb index d0464ad3b..59044bb55 100644 --- a/app/views/admin/budget_investments/_investments.html.erb +++ b/app/views/admin/budget_investments/_investments.html.erb @@ -19,8 +19,8 @@ <% if @investments.any? %>

<%= page_entries_info @investments %>

- <%= render partial: "admin/shared/columns_selector", - locals: { cookie: "investments-columns", default: %w[id title supports admin valuator geozone feasibility price valuation_finished visible_to_valuators selected incompatible] } %> + <%= 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] %>
<%= render "filters_description", i18n_namespace: "admin.budget_investments.index" %> diff --git a/app/views/admin/budget_investments/show.html.erb b/app/views/admin/budget_investments/show.html.erb index 2f6f3fbce..6b628f304 100644 --- a/app/views/admin/budget_investments/show.html.erb +++ b/app/views/admin/budget_investments/show.html.erb @@ -17,7 +17,7 @@
-<%= render partial: "/budgets/investments/investment_detail", locals: {investment: @investment, preview: true} %> +<%= render "/budgets/investments/investment_detail", investment: @investment, preview: true %>

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

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 eede90e38..ba66a87f8 100644 --- a/app/views/admin/local_census_records/imports/show.html.erb +++ b/app/views/admin/local_census_records/imports/show.html.erb @@ -8,12 +8,12 @@

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

-<%= render partial: "local_census_records", locals: { +<%= render "local_census_records", title: t("admin.local_census_records.imports.show.errored"), id: "invalid-local-census-records", - local_census_records: @import.invalid_records } %> + local_census_records: @import.invalid_records %> -<%= render partial: "local_census_records", locals: { +<%= render "local_census_records", title: t("admin.local_census_records.imports.show.created"), id: "created-local-census-records", - local_census_records: @import.created_records } %> + local_census_records: @import.created_records %> diff --git a/app/views/admin/poll/booth_assignments/manage.html.erb b/app/views/admin/poll/booth_assignments/manage.html.erb index 449037b9e..63ef6c49a 100644 --- a/app/views/admin/poll/booth_assignments/manage.html.erb +++ b/app/views/admin/poll/booth_assignments/manage.html.erb @@ -17,7 +17,7 @@ <% @booths.each do |booth| %> - <%= render partial: "booth_assignment", locals: { booth: booth, booth_assignment: booth.assignment_on_poll(@poll) } %> + <%= render "booth_assignment", booth: booth, booth_assignment: booth.assignment_on_poll(@poll) %> <% end %> diff --git a/app/views/admin/poll/booths/index.html.erb b/app/views/admin/poll/booths/index.html.erb index f1a21d06e..6a03b38fa 100644 --- a/app/views/admin/poll/booths/index.html.erb +++ b/app/views/admin/poll/booths/index.html.erb @@ -20,7 +20,7 @@ <% @booths.each do |booth| %> - <%= render partial: "booth", locals: { booth: booth } %> + <%= render "booth", booth: booth %> <% end %> diff --git a/app/views/admin/system_emails/preview_pending.html.erb b/app/views/admin/system_emails/preview_pending.html.erb index 6de1c993f..de0805247 100644 --- a/app/views/admin/system_emails/preview_pending.html.erb +++ b/app/views/admin/system_emails/preview_pending.html.erb @@ -8,8 +8,8 @@

<%= t("admin.system_emails.#{@system_email}.preview_detail") %>

<% @previews.each do |preview| %> - <%= render partial: "admin/system_emails/preview_pending/#{@system_email}", - locals: { preview: preview } %> + <%= render "admin/system_emails/preview_pending/#{@system_email}", + preview: preview %> <% end %> diff --git a/app/views/admin/valuators/_valuators.html.erb b/app/views/admin/valuators/_valuators.html.erb index 49ef87fdc..cd80dc7f2 100644 --- a/app/views/admin/valuators/_valuators.html.erb +++ b/app/views/admin/valuators/_valuators.html.erb @@ -10,11 +10,11 @@ <% valuators.each do |valuator| %> <% if valuator.is_a?(Valuator) %> - <%= render partial: 'valuator_row', locals: {valuator: valuator} %> + <%= render "valuator_row", valuator: valuator %> <% elsif valuator.valuator? %> - <%= render partial: 'valuator_row', locals: {valuator: valuator.valuator} %> + <%= render "valuator_row", valuator: valuator.valuator %> <% else %> - <%= render partial: 'user_row', locals: {user: valuator} %> + <%= render "user_row", user: valuator %> <% end %> <% end %> diff --git a/app/views/admin/valuators/index.html.erb b/app/views/admin/valuators/index.html.erb index 50bd7b1ca..7f9489722 100644 --- a/app/views/admin/valuators/index.html.erb +++ b/app/views/admin/valuators/index.html.erb @@ -8,7 +8,7 @@ <% if @valuators.any? %>

<%= page_entries_info @valuators %>

- <%= render partial: "valuators", locals: {valuators: @valuators} %> + <%= render "valuators", valuators: @valuators %> <%= paginate @valuators %> <% else %> diff --git a/app/views/admin/valuators/search.html.erb b/app/views/admin/valuators/search.html.erb index b90a7c58f..faa999c31 100644 --- a/app/views/admin/valuators/search.html.erb +++ b/app/views/admin/valuators/search.html.erb @@ -5,7 +5,7 @@
<% if @users.any? %>

<%= page_entries_info @users %>

- <%= render partial: "valuators", locals: {valuators: @users} %> + <%= render "valuators", valuators: @users %> <% else %>
<%= t("admin.shared.no_search_results") %> diff --git a/app/views/budgets/investments/_investment.html.erb b/app/views/budgets/investments/_investment.html.erb index a1664bfbc..0a2bcea84 100644 --- a/app/views/budgets/investments/_investment.html.erb +++ b/app/views/budgets/investments/_investment.html.erb @@ -60,11 +60,11 @@
> - <%= render partial: "/budgets/investments/votes", locals: { + <%= render "/budgets/investments/votes", investment: investment, investment_votes: investment_votes, vote_url: namespaced_budget_investment_vote_path(investment, value: "yes") - } %> + %>
<% elsif investment.should_show_vote_count? %>
> - <%= render partial: "/budgets/investments/ballot", locals: { + <%= render "/budgets/investments/ballot", investment: investment, investment_ids: investment_ids, ballot: ballot - } %> + %>
<% elsif investment.should_show_price? %>
<%= back_link_to budget_investments_path(investment.budget, heading_id: investment.heading) %> - <%= render partial: "/budgets/investments/investment_detail", locals: {investment: investment} %> + <%= render "/budgets/investments/investment_detail", investment: investment %>
diff --git a/app/views/budgets/investments/index.html.erb b/app/views/budgets/investments/index.html.erb index 83e06cf00..34a6ff711 100644 --- a/app/views/budgets/investments/index.html.erb +++ b/app/views/budgets/investments/index.html.erb @@ -73,19 +73,17 @@ <% if investments_default_view? %> <% @investments.each do |investment| %> - <%= render partial: "/budgets/investments/investment", - locals: { - investment: investment, - investment_ids: @investment_ids, - investment_votes: @investment_votes, - ballot: @ballot - } %> + <%= render "/budgets/investments/investment", + investment: investment, + investment_ids: @investment_ids, + investment_votes: @investment_votes, + ballot: @ballot %> <% end %> <% else %> <% @investments.each do |investment| %> - <%= render partial: "/budgets/investments/investment_minimal", - locals: { investment: investment } %> + <%= render "/budgets/investments/investment_minimal", + investment: investment %> <% end %> <% end %> diff --git a/app/views/budgets/investments/show.html.erb b/app/views/budgets/investments/show.html.erb index ca6223639..de38661a5 100644 --- a/app/views/budgets/investments/show.html.erb +++ b/app/views/budgets/investments/show.html.erb @@ -3,12 +3,12 @@ <%= render "shared/canonical", href: budget_investment_url %> <% end %> -<%= render partial: "/budgets/investments/investment_show", locals: { +<%= render "/budgets/investments/investment_show", investment: @investment, investment_ids: @investment_ids, investment_votes: @investment_votes, ballot: @ballot -} %> +%>
@@ -18,9 +18,9 @@
- <%= render partial: "/comments/comment_tree", locals: { comment_tree: @comment_tree, - comment_flags: @comment_flags, - display_comments_count: false } %> + <%= render "/comments/comment_tree", comment_tree: @comment_tree, + comment_flags: @comment_flags, + display_comments_count: false %>
<%= render "milestones/milestones", milestoneable: @investment %> diff --git a/app/views/dashboard/mailing/index.html.erb b/app/views/dashboard/mailing/index.html.erb index 3b1519159..17805e50d 100644 --- a/app/views/dashboard/mailing/index.html.erb +++ b/app/views/dashboard/mailing/index.html.erb @@ -32,10 +32,10 @@

<%= t("dashboard.mailer.forward.share_in") %>

- <%= render partial: 'shared/social_share', locals: { + <%= render "shared/social_share", title: @proposal.title, url: proposal_url(@proposal), - description: @proposal.summary } %> + description: @proposal.summary %>
diff --git a/app/views/debates/index.html.erb b/app/views/debates/index.html.erb index 9a93e95eb..6653ffd02 100644 --- a/app/views/debates/index.html.erb +++ b/app/views/debates/index.html.erb @@ -71,7 +71,7 @@ <%= render @debates %> <% else %> <% @debates.each do |debate| %> - <%= render partial: "debates/debate_minimal", locals: { debate: debate } %> + <%= render "debates/debate_minimal", debate: debate %> <% end %> <% end %> <% else %> diff --git a/app/views/debates/show.html.erb b/app/views/debates/show.html.erb index 01e3664b1..b8814d75b 100644 --- a/app/views/debates/show.html.erb +++ b/app/views/debates/show.html.erb @@ -56,13 +56,13 @@
<%= render "debates/votes", debate: @debate %>
- <%= render partial: "shared/social_share", locals: { + <%= render "shared/social_share", share_title: t("debates.show.share"), title: @debate.title, url: debate_url(@debate), description: @debate.title, mobile: @debate.title - } %> + %>
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 78157920c..173974a58 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -22,7 +22,7 @@

<%= setting["org_name"] %>

- <%= render partial: "layouts/header", locals: { with_subnavigation: true } %> + <%= render "layouts/header", with_subnavigation: true %>