Since now poll question answers have been renamed to poll question options, using HTML IDs, classes and data attributes named `answer` was confusing.
36 lines
1.7 KiB
Plaintext
36 lines
1.7 KiB
Plaintext
<div class="poll-question-options">
|
|
<% if can?(:answer, question) && !question.poll.voted_in_booth?(current_user) %>
|
|
<% question_options.each do |question_option| %>
|
|
<% if already_answered?(question_option) %>
|
|
<%= button_to question_option.title,
|
|
question_answer_path(question, user_answer(question_option)),
|
|
method: :delete,
|
|
remote: true,
|
|
title: t("poll_questions.show.voted", answer: question_option.title),
|
|
class: "button answered",
|
|
"aria-pressed": true %>
|
|
<% else %>
|
|
<%= button_to question_option.title,
|
|
answer_question_path(question, answer: question_option.title),
|
|
remote: true,
|
|
title: t("poll_questions.show.vote_answer", answer: question_option.title),
|
|
class: "button secondary hollow",
|
|
"aria-pressed": false,
|
|
disabled: disable_option?(question_option) %>
|
|
<% end %>
|
|
<% end %>
|
|
<% elsif !user_signed_in? %>
|
|
<% question_options.each do |question_option| %>
|
|
<%= link_to question_option.title, new_user_session_path, class: "button secondary hollow" %>
|
|
<% end %>
|
|
<% elsif !current_user.level_two_or_three_verified? %>
|
|
<% question_options.each do |question_option| %>
|
|
<%= link_to question_option.title, verification_path, class: "button secondary hollow" %>
|
|
<% end %>
|
|
<% else %>
|
|
<% question_options.each do |question_option| %>
|
|
<span class="button secondary hollow disabled"><%= question_option.title %></span>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|