hotfix: ensure questions get proper error messages
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
<% answer = answer.try(:answer) || answer %>
|
||||
<% answer_string = answer.try(:answer) || answer %>
|
||||
<%= form.collection_radio_buttons(:answer, question.input_options, :to_s, :to_s, {}, {class: 'radio'}) do | option | %>
|
||||
<%
|
||||
option_id = "#{question.question_id}#{sanitize_to_id(option.value)}"
|
||||
checked = answer == option.value ? 'checked' : ''
|
||||
checked = answer_string == option.value ? 'checked' : ''
|
||||
%>
|
||||
|
||||
<div class="form-group-multiples">
|
||||
|
@ -1,13 +1,13 @@
|
||||
<%
|
||||
answer = question.answer.nil? ? '' : Array(question.answer['options']).first
|
||||
answer_string = question.answer.nil? ? '' : Array(question.answer['options']).first
|
||||
other_value = question.answer.nil? ? '' : question.answer['other']
|
||||
|
||||
question.input_options.each do | option |
|
||||
option_id = "#{option.parameterize}_#{question.to_i}"
|
||||
radio_html = {class: 'radio', id: option_id, data: {last: (answer == option) ? 'checked' : '' }}
|
||||
radio_html = {class: 'radio', id: option_id, data: {last: (answer_string == option) ? 'checked' : '' }}
|
||||
%>
|
||||
<div class="form-group-multiples">
|
||||
<%= radio_button_tag('answer[answer_hash][options][]', option, (answer == option), radio_html) %>
|
||||
<%= radio_button_tag('answer[answer_hash][options][]', option, (answer_string == option), radio_html) %>
|
||||
<%= label_tag(option_id, option) %>
|
||||
</div>
|
||||
<%
|
||||
@ -16,10 +16,10 @@
|
||||
<div class="form-group-multiples">
|
||||
<%
|
||||
option_id = "other_#{question.to_i}"
|
||||
radio_html = {class: 'radio', id: option_id, data: { last: answer }}
|
||||
radio_html = {class: 'radio', id: option_id, data: { last: answer_string }}
|
||||
text_html = {class: 'input-other', id: "text_#{option_id}", data: { last: other_value }}
|
||||
%>
|
||||
<%= radio_button_tag('answer[answer_hash][options][]', 'other', (answer == 'other'), radio_html) %>
|
||||
<%= radio_button_tag('answer[answer_hash][options][]', 'other', (answer_string == 'other'), radio_html) %>
|
||||
<%= label_tag option_id, 'Other' %>
|
||||
<%= text_field_tag 'answer[answer_hash][other]', other_value, text_html %>
|
||||
</div>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<% answer = answer.respond_to?(:answer) ? answer.answer : answer %>
|
||||
<% answer_string = answer.respond_to?(:answer) ? answer.answer : answer %>
|
||||
|
||||
<label for="answer_answer">Enter answer here</label>
|
||||
<%= text_area_tag 'answer[answer]', answer, {rows: 10, data: { last: answer } } %>
|
||||
<%= text_area_tag 'answer[answer]', answer_string, {rows: 10, data: { last: answer_string } } %>
|
||||
|
||||
<div class="chars <%= params[:action] == 'summary' ? 'hidden' : '' %>">Characters remaining: <span></span></div>
|
||||
|
||||
|
Reference in New Issue
Block a user