Files
nairobi/app/views/admin/poll/polls/_questions.html.erb
decabeza 9709b267a2 Always show order poll questions by created at
PostgreSQL doesn't guarantee the order of the records, so we have to
specify it if we want the questions to be displayed in a consistent
order.
2021-10-18 13:31:34 +02:00

39 lines
1.2 KiB
Plaintext

<h3 class="inline-block"><%= t("admin.polls.show.questions_title") %></h3>
<%= link_to t("admin.questions.index.create"), new_admin_question_path(poll_id: @poll.id),
class: "button float-right" %>
<% if @poll.questions.empty? %>
<div class="callout primary margin-top">
<%= t("admin.polls.show.no_questions") %>
</div>
<% else %>
<table class="margin">
<thead>
<tr>
<th><%= t("admin.polls.show.table_title") %></th>
<th><%= t("admin.actions.actions") %></th>
</tr>
</thead>
<% @poll.questions.sort_for_list.each do |question| %>
<tr id="<%= dom_id(question) %>">
<td>
<strong><%= question.title %></strong>
<% if question.proposal.present? %>
<small>
<%= link_to t("admin.polls.show.see_proposal"),
proposal_path(question.proposal),
target: "_blank" %>
</small>
<% end %>
</td>
<td>
<%= render Admin::TableActionsComponent.new(question) do |actions| %>
<%= actions.action(:answers, text: t("admin.polls.show.edit_answers")) %>
<% end %>
</td>
</tr>
<% end %>
</table>
<% end %>