From c96e3b027f95a9b870f2f437169f57d4023cc521 Mon Sep 17 00:00:00 2001 From: taitus Date: Wed, 20 Sep 2023 11:52:52 +0200 Subject: [PATCH] Replace Partials with Direct Component Rendering In this commit, we have performed a refactoring to enhance code organization. Several partials that were solely responsible for rendering components have been removed. Instead, we are now directly rendering the components within the views where these partials were previously used. --- app/views/comments/_comment.html.erb | 2 +- app/views/comments/_votes.html.erb | 1 - app/views/comments/vote.js.erb | 2 +- app/views/debates/_debate.html.erb | 2 +- app/views/debates/_votes.html.erb | 1 - app/views/debates/show.html.erb | 2 +- app/views/debates/vote.js.erb | 2 +- app/views/legislation/annotations/_comments.html.erb | 2 +- 8 files changed, 6 insertions(+), 8 deletions(-) delete mode 100644 app/views/comments/_votes.html.erb delete mode 100644 app/views/debates/_votes.html.erb diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb index 75d3887ca..549bab2d1 100644 --- a/app/views/comments/_comment.html.erb +++ b/app/views/comments/_comment.html.erb @@ -81,7 +81,7 @@
<% unless valuation %>
- <%= render "comments/votes", comment: comment %> + <%= render Comments::VotesComponent.new(comment) %>
<% end %> diff --git a/app/views/comments/_votes.html.erb b/app/views/comments/_votes.html.erb deleted file mode 100644 index e45be3c2c..000000000 --- a/app/views/comments/_votes.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render Comments::VotesComponent.new(comment) %> diff --git a/app/views/comments/vote.js.erb b/app/views/comments/vote.js.erb index 2fe859cbd..f26291e73 100644 --- a/app/views/comments/vote.js.erb +++ b/app/views/comments/vote.js.erb @@ -1 +1 @@ -$("#<%= dom_id(@comment) %>_votes").html("<%= j render("comments/votes", comment: @comment) %>"); +$("#<%= dom_id(@comment) %>_votes").html("<%= j render Comments::VotesComponent.new(@comment) %>"); diff --git a/app/views/debates/_debate.html.erb b/app/views/debates/_debate.html.erb index 905c3ec79..68de5a60d 100644 --- a/app/views/debates/_debate.html.erb +++ b/app/views/debates/_debate.html.erb @@ -49,7 +49,7 @@
- <%= render "debates/votes", debate: debate %> + <%= render Debates::VotesComponent.new(debate) %>
diff --git a/app/views/debates/_votes.html.erb b/app/views/debates/_votes.html.erb deleted file mode 100644 index 01a1f2b3f..000000000 --- a/app/views/debates/_votes.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render Debates::VotesComponent.new(debate) %> diff --git a/app/views/debates/show.html.erb b/app/views/debates/show.html.erb index 52146ee68..38fc11825 100644 --- a/app/views/debates/show.html.erb +++ b/app/views/debates/show.html.erb @@ -57,7 +57,7 @@

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

- <%= render "debates/votes", debate: @debate %> + <%= render Debates::VotesComponent.new(@debate) %>
<%= render "shared/social_share", share_title: t("debates.show.share"), diff --git a/app/views/debates/vote.js.erb b/app/views/debates/vote.js.erb index aae060dbd..bee28fcc7 100644 --- a/app/views/debates/vote.js.erb +++ b/app/views/debates/vote.js.erb @@ -1 +1 @@ -$("#<%= dom_id(@debate) %>_votes").html("<%= j render("debates/votes", debate: @debate) %>"); +$("#<%= dom_id(@debate) %>_votes").html("<%= j render Debates::VotesComponent.new(@debate) %>"); diff --git a/app/views/legislation/annotations/_comments.html.erb b/app/views/legislation/annotations/_comments.html.erb index aad5a4248..c8c1bd29d 100644 --- a/app/views/legislation/annotations/_comments.html.erb +++ b/app/views/legislation/annotations/_comments.html.erb @@ -24,7 +24,7 @@
- <%= render "comments/votes", comment: comment %> + <%= render Comments::VotesComponent.new(comment) %>