From 8311e7e6b843cfadaa64d0e632eb0e98cfa0dd0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sen=C3=A9n=20Rodero=20Rodr=C3=ADguez?= <15726+Senen@users.noreply.github.com> Date: Wed, 31 Aug 2022 16:32:18 +0200 Subject: [PATCH] Extract component to render answers additional information --- .../read_more_answer_component.html.erb | 60 ++++++++++++++++++ .../questions/read_more_answer_component.rb | 9 +++ app/views/polls/show.html.erb | 63 +------------------ .../read_more_answer_component_spec.rb | 32 ++++++++++ spec/system/polls/polls_spec.rb | 17 ----- 5 files changed, 102 insertions(+), 79 deletions(-) create mode 100644 app/components/polls/questions/read_more_answer_component.html.erb create mode 100644 app/components/polls/questions/read_more_answer_component.rb create mode 100644 spec/components/polls/questions/read_more_answer_component_spec.rb diff --git a/app/components/polls/questions/read_more_answer_component.html.erb b/app/components/polls/questions/read_more_answer_component.html.erb new file mode 100644 index 000000000..becece5a7 --- /dev/null +++ b/app/components/polls/questions/read_more_answer_component.html.erb @@ -0,0 +1,60 @@ +
+ + <%= t("polls.show.documents") %> +
+ + <% answer.documents.each do |document| %> + <%= link_to document.title, + document.attachment, + target: "_blank", + rel: "nofollow" %>+ + <%= t("polls.show.videos") %> +
+ + <% answer.videos.each do |video| %> + <%= link_to video.title, + video.url, + target: "_blank", + rel: "nofollow" %>