From eccf906e45039ae6431d3ebf8ea15d6f923ac0b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Tue, 14 May 2024 20:45:21 +0200 Subject: [PATCH] Add component to render the form poll Right now it just renders the questions as it used to. --- app/components/polls/form_component.html.erb | 1 + app/components/polls/form_component.rb | 7 +++++++ app/views/polls/show.html.erb | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 app/components/polls/form_component.html.erb create mode 100644 app/components/polls/form_component.rb diff --git a/app/components/polls/form_component.html.erb b/app/components/polls/form_component.html.erb new file mode 100644 index 000000000..bd1704133 --- /dev/null +++ b/app/components/polls/form_component.html.erb @@ -0,0 +1 @@ +<%= render Polls::Questions::QuestionComponent.with_collection(questions) %> diff --git a/app/components/polls/form_component.rb b/app/components/polls/form_component.rb new file mode 100644 index 000000000..0a2bc5668 --- /dev/null +++ b/app/components/polls/form_component.rb @@ -0,0 +1,7 @@ +class Polls::FormComponent < ApplicationComponent + attr_reader :questions + + def initialize(questions) + @questions = questions + end +end diff --git a/app/views/polls/show.html.erb b/app/views/polls/show.html.erb index f90679a9d..3feae7f1e 100644 --- a/app/views/polls/show.html.erb +++ b/app/views/polls/show.html.erb @@ -31,7 +31,7 @@ <% end %> <% end %> - <%= render Polls::Questions::QuestionComponent.with_collection(@questions) %> + <%= render Polls::FormComponent.new(@questions) %>