Files
nairobi/app/views/legislation/questions/_answer_form.html.erb
Javi Martín 9154614577 Always show not allowed message in legislation debates
This message is only shown in the `show` action, so it's shown at most
once in the whole page, so it doesn't take up too much space and it
isn't as overwhelming as if we were showing it on the index page, once
per debate.

We're only showing it when there are closed options, though, since
there's already a message to sign in to comment when the question
accepts open answers.
2022-02-21 18:48:09 +01:00

31 lines
1.3 KiB
Plaintext

<% if question.question_options.any? %>
<% if process.debate_phase.open? && !answer.persisted? && can?(:create, Legislation::Answer) %>
<%= form_for answer, url: legislation_process_question_answers_path(process, question, answer), remote: true, html: { class: "controls-stacked" } do |f| %>
<% question.question_options.each do |question_option| %>
<label class="control radio <%= "is-active" if @answer.legislation_question_option_id == question_option.id %>">
<%= f.radio_button :legislation_question_option_id, question_option.id, label: false %>
<span class="control-indicator"></span>
<%= question_option.value %>
</label>
<% end %>
<%= f.submit t("legislation.questions.show.answer_question"), class: "button" %>
<% end %>
<% else %>
<form class="controls-stacked disabled">
<% question.question_options.each do |question_option| %>
<label class="control radio <%= "is-active" if answer.persisted? && (answer.legislation_question_option_id == question_option.id) %>">
<input id="quiz-1" name="radio" type="radio" disabled="true">
<span class="control-indicator"></span>
<%= question_option.value %>
</label>
<% end %>
</form>
<% end %>
<%= render "participation_not_allowed" %>
<% end %>