From a1907c6f50052f758e0c9c175cd7ebe8ca44c36d Mon Sep 17 00:00:00 2001 From: Angel Perez Date: Fri, 6 Oct 2017 14:40:54 -0400 Subject: [PATCH] Show answer's associated documents on polls As requested by #2003 --- app/views/polls/show.html.erb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/views/polls/show.html.erb b/app/views/polls/show.html.erb index e3405c0a8..8347455ae 100644 --- a/app/views/polls/show.html.erb +++ b/app/views/polls/show.html.erb @@ -67,7 +67,7 @@ <% @poll.questions.map(&:question_answers).flatten.each do |answer| %> - <% if answer.description.present? || answer.images.any? %> + <% if answer.description.present? || answer.images.any? || answer.documents.present? %>
@@ -86,7 +86,18 @@ <%= render "gallery", answer: answer %> <% end %> + <% if answer.documents.present? %> + <% answer.documents.each do |document| %> + + <%= link_to document.title, + document.attachment.url, + target: "_blank", + rel: "nofollow" %> + + <% end %> + <% end %>
+
<% end %>