From ab2c548964c057fb96b548a8480d0be032e5b583 Mon Sep 17 00:00:00 2001 From: taitus Date: Tue, 27 Jun 2023 14:44:54 +0200 Subject: [PATCH 1/2] Remove unused code for legislation proposals votes In these commits 38ba5e159b and 8805037e2fad we added the parameter "vote_url" in the call to the partial "votes" in collaborative legislation proposals. It seems that this parameter is only used in the proposals module and not in collaborative legislation proposals. While it is true that in the partial "votes" in these commits this parameter "vote_url" is referred to, in commit 276baedcf it seems to be removed. For this reason, we remove the parameter. --- app/views/legislation/proposals/_proposal.html.erb | 3 +-- app/views/legislation/proposals/show.html.erb | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/views/legislation/proposals/_proposal.html.erb b/app/views/legislation/proposals/_proposal.html.erb index 3df7e5c1b..c89742c2e 100644 --- a/app/views/legislation/proposals/_proposal.html.erb +++ b/app/views/legislation/proposals/_proposal.html.erb @@ -64,8 +64,7 @@
- <%= render "legislation/proposals/votes", - { proposal: proposal, vote_url: vote_legislation_process_proposal_path(proposal.legislation_process_id, proposal, value: "yes") } %> + <%= render "legislation/proposals/votes", proposal: proposal %>
diff --git a/app/views/legislation/proposals/show.html.erb b/app/views/legislation/proposals/show.html.erb index 9be3ee3b3..8ace8381c 100644 --- a/app/views/legislation/proposals/show.html.erb +++ b/app/views/legislation/proposals/show.html.erb @@ -105,8 +105,7 @@

<%= t("votes.supports") %>

- <%= render "votes", - { proposal: @proposal, vote_url: vote_legislation_process_proposal_path(@proposal.legislation_process_id, @proposal, value: "yes") } %> + <%= render "votes", proposal: @proposal %>
<%= render "shared/social_share", share_title: t("proposals.show.share"), From d2b181777dc47f935f9449b1e5a887aaf87e76c5 Mon Sep 17 00:00:00 2001 From: taitus Date: Tue, 27 Jun 2023 14:59:21 +0200 Subject: [PATCH 2/2] Call Legislation::Proposals::VotesComponent directly --- app/views/legislation/proposals/_proposal.html.erb | 2 +- app/views/legislation/proposals/_votes.html.erb | 1 - app/views/legislation/proposals/show.html.erb | 2 +- app/views/legislation/proposals/vote.js.erb | 3 ++- 4 files changed, 4 insertions(+), 4 deletions(-) delete mode 100644 app/views/legislation/proposals/_votes.html.erb diff --git a/app/views/legislation/proposals/_proposal.html.erb b/app/views/legislation/proposals/_proposal.html.erb index c89742c2e..b784e3ff8 100644 --- a/app/views/legislation/proposals/_proposal.html.erb +++ b/app/views/legislation/proposals/_proposal.html.erb @@ -64,7 +64,7 @@
- <%= render "legislation/proposals/votes", proposal: proposal %> + <%= render Legislation::Proposals::VotesComponent.new(proposal) %>
diff --git a/app/views/legislation/proposals/_votes.html.erb b/app/views/legislation/proposals/_votes.html.erb deleted file mode 100644 index 175527233..000000000 --- a/app/views/legislation/proposals/_votes.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render Legislation::Proposals::VotesComponent.new(proposal) %> diff --git a/app/views/legislation/proposals/show.html.erb b/app/views/legislation/proposals/show.html.erb index 8ace8381c..0dc8654d0 100644 --- a/app/views/legislation/proposals/show.html.erb +++ b/app/views/legislation/proposals/show.html.erb @@ -105,7 +105,7 @@

<%= t("votes.supports") %>

- <%= render "votes", proposal: @proposal %> + <%= render Legislation::Proposals::VotesComponent.new(@proposal) %>
<%= render "shared/social_share", share_title: t("proposals.show.share"), diff --git a/app/views/legislation/proposals/vote.js.erb b/app/views/legislation/proposals/vote.js.erb index eccb9ea61..1845c6d80 100644 --- a/app/views/legislation/proposals/vote.js.erb +++ b/app/views/legislation/proposals/vote.js.erb @@ -1 +1,2 @@ -$("#<%= dom_id(@proposal) %>_votes").html("<%= j render("legislation/proposals/votes", proposal: @proposal) %>"); +$("#<%= dom_id(@proposal) %>_votes") + .html("<%= j render Legislation::Proposals::VotesComponent.new(@proposal) %>");