Files
grecia/app/components/polls/questions/answers_component.html.erb
Senén Rodero Rodríguez df65ba57cc Use the same order criteria always
The relation of question with its questions answers is ordered by default by
`given_order`.
2022-10-18 10:38:08 +02:00

32 lines
1.4 KiB
Plaintext

<div class="poll-question-answers">
<% if can?(:answer, question) && !question.poll.voted_in_booth?(current_user) %>
<% question_answers.each do |question_answer| %>
<% if already_answered?(question_answer) && !voted_before_sign_in? %>
<span class="button answered"
title="<%= t("poll_questions.show.voted", answer: question_answer.title) %>">
<%= question_answer.title %>
</span>
<% else %>
<%= button_to answer_question_path(question, answer: question_answer.title),
remote: true,
title: t("poll_questions.show.vote_answer", answer: question_answer.title),
class: "button secondary hollow" do %>
<%= question_answer.title %>
<% end %>
<% end %>
<% end %>
<% elsif !user_signed_in? %>
<% question_answers.each do |question_answer| %>
<%= link_to question_answer.title, new_user_session_path, class: "button secondary hollow" %>
<% end %>
<% elsif !current_user.level_two_or_three_verified? %>
<% question_answers.each do |question_answer| %>
<%= link_to question_answer.title, verification_path, class: "button secondary hollow" %>
<% end %>
<% else %>
<% question_answers.each do |question_answer| %>
<span class="button secondary hollow disabled"><%= question_answer.title %></span>
<% end %>
<% end %>
</div>