html reset
This commit is contained in:
@ -1,15 +1,14 @@
|
||||
<% answers = Array(question.answer) %>
|
||||
<%= form.collection_check_boxes(:answer_array, question.input_options, :to_s, :to_s, {}, {class: 'checkbox'}) do | option | %>
|
||||
<%= form.collection_check_boxes(:answer_array, question.input_options, :to_s, :to_s, {}, {class: ""}) do | option | %>
|
||||
<%
|
||||
option_id = "#{question.question_id}#{sanitize_to_id(option.value)}"
|
||||
checked = answers.include?(option.value) ? 'checked' : ''
|
||||
%>
|
||||
|
||||
<div class="form-group-multiples">
|
||||
<div class="">
|
||||
<%= option.check_box( id: option_id, checked: checked, data: { last: checked } ) %>
|
||||
<%= option.label(for: option_id) %>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
<%= render partial: "quiz/answer_errors", locals: {question: question, answer: answer} %>
|
||||
|
@ -4,20 +4,20 @@
|
||||
|
||||
question.input_options.each do | option |
|
||||
option_id = "#{option.parameterize}_#{question.to_i}"
|
||||
checkbox_html = {class: 'checkbox', id: option_id, data: { last: answers.include?(option) ? 'checked' : '' } }
|
||||
checkbox_html = {class: "", id: option_id, data: { last: answers.include?(option) ? 'checked' : '' } }
|
||||
%>
|
||||
<div class="form-group-multiples">
|
||||
<div class="">
|
||||
<%= check_box_tag('answer[answer_hash][options][]', option, answers.include?(option), checkbox_html) %>
|
||||
<%= label_tag(option_id, option) %>
|
||||
</div>
|
||||
<%
|
||||
end %>
|
||||
|
||||
<div class="form-group-multiples">
|
||||
<div class="">
|
||||
<%
|
||||
option_id = "other_#{question.to_i}"
|
||||
checkbox_html = {class: 'checkbox', id: option_id, data: { last: answers.include?('other') ? 'checked' : '' } }
|
||||
text_html = {class: 'input-other', id: "text_#{option_id}", data: { last: other_value }}
|
||||
checkbox_html = {class: "", id: option_id, data: { last: answers.include?('other') ? 'checked' : '' } }
|
||||
text_html = {class: "", id: "text_#{option_id}", data: { last: other_value }}
|
||||
%>
|
||||
<%= check_box_tag('answer[answer_hash][options][]', 'other', answers.include?('other'), checkbox_html) %>
|
||||
<%= label_tag(option_id, 'Other') %>
|
||||
|
@ -1,14 +1,15 @@
|
||||
<% 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_string == option.value ? 'checked' : ''
|
||||
%>
|
||||
<%= form.collection_radio_buttons(:answer, question.input_options, :to_s, :to_s, {}, {class: ""}) do | option | %>
|
||||
|
||||
<div class="form-group-multiples">
|
||||
<%= option.radio_button( id: option_id, checked: checked, data: { last: checked } ) %>
|
||||
<%= option.label(for: option_id) %>
|
||||
</div>
|
||||
<%
|
||||
option_id = "#{question.question_id}#{sanitize_to_id(option.value)}"
|
||||
checked = answer_string == option.value ? 'checked' : ''
|
||||
%>
|
||||
|
||||
<div class="">
|
||||
<%= option.radio_button( id: option_id, checked: checked, data: { last: checked } ) %>
|
||||
<%= option.label(for: option_id) %>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
|
@ -4,20 +4,20 @@
|
||||
|
||||
question.input_options.each do | option |
|
||||
option_id = "#{option.parameterize}_#{question.to_i}"
|
||||
radio_html = {class: 'radio', id: option_id, data: {last: (answer_string == option) ? 'checked' : '' }}
|
||||
radio_html = {class: "", id: option_id, data: {last: (answer_string == option) ? 'checked' : '' }}
|
||||
%>
|
||||
<div class="form-group-multiples">
|
||||
<div class="">
|
||||
<%= radio_button_tag('answer[answer_hash][options][]', option, (answer_string == option), radio_html) %>
|
||||
<%= label_tag(option_id, option) %>
|
||||
</div>
|
||||
<%
|
||||
end %>
|
||||
|
||||
<div class="form-group-multiples">
|
||||
<div class="">
|
||||
<%
|
||||
option_id = "other_#{question.to_i}"
|
||||
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_html = {class: "", id: option_id, data: { last: answer_string }}
|
||||
text_html = {class: "", id: "text_#{option_id}", data: { last: other_value }}
|
||||
%>
|
||||
<%= radio_button_tag('answer[answer_hash][options][]', 'other', (answer_string == 'other'), radio_html) %>
|
||||
<%= label_tag option_id, 'Other' %>
|
||||
|
@ -3,6 +3,6 @@
|
||||
<label for="answer_answer">Enter answer here</label>
|
||||
<%= 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>
|
||||
<div class="<%= params[:action] == 'summary' ? 'hidden' : '' %>">Characters remaining: <span></span></div>
|
||||
|
||||
<%= render partial: "quiz/answer_errors", locals: {question: question, answer: answer} %>
|
||||
|
@ -6,34 +6,19 @@
|
||||
%>
|
||||
|
||||
<%= form_for(@answer, url: post_answer_path(@answer.id), html:{method: :post, id: 'answer-form', data: {qid: @question.question_id}}) do |form| %>
|
||||
<main class="answer-sec <%= @question.input_type %>-type questions_tpl" data-qid="<%= @question.question_id %>">
|
||||
<h2 class="question-text"><%= @question.question %></h2>
|
||||
|
||||
<% if @question.attachment.present? %>
|
||||
<%= image_tag @question.attachment %>
|
||||
<% end %>
|
||||
<div><%= @question.question %></div>
|
||||
<%= image_tag @question.attachment if @question.attachment.present? %>
|
||||
|
||||
<div class="content-well">
|
||||
<%= hidden_field_tag 'answer[question_id]', @question.question_id %>
|
||||
<%= hidden_field_tag 'answer[answer_id]', @question.answer_id %>
|
||||
<%= render partial: @question.input_type, locals: {question: @question, form: form, answer: @answer } %>
|
||||
</div>
|
||||
<%= render partial: @question.input_type, locals: {question: @question, form: form, answer: @answer } %>
|
||||
|
||||
<% if @status.on_summary %>
|
||||
<% if @status.on_summary %>
|
||||
<button type="submit" name="submit">Save and return to summary</button>
|
||||
<% else %>
|
||||
<button type="submit" name="save">Save</button>
|
||||
<button type="submit" name="submit">Next →</button>
|
||||
<% end %>
|
||||
|
||||
<div class="btn-container-summary button-wrap">
|
||||
<input type="submit" name="submit" value="Save and return to summary">
|
||||
</div>
|
||||
|
||||
<% else %>
|
||||
|
||||
<div class="btn-container-left">
|
||||
<input type="submit" class="secondary-btn" name="save" value="Save">
|
||||
</div>
|
||||
<div class="btn-container-right">
|
||||
<input type="submit" class="tertiary-btn arrow-btn-right" name="submit" value="Next →">
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
</main>
|
||||
<%= hidden_field_tag 'answer[question_id]', @question.question_id %>
|
||||
<%= hidden_field_tag 'answer[answer_id]', @question.answer_id %>
|
||||
<% end %>
|
||||
|
@ -7,49 +7,40 @@
|
||||
end
|
||||
%>
|
||||
|
||||
<main class="summary_tpl">
|
||||
<h2 class="prft-heading">Almost done!</h2>
|
||||
<p>
|
||||
Now's the time to review your answers and go back and change any, if you need to.
|
||||
Once you're done, hit the button at the bottom of the page to submit your answers.
|
||||
</p>
|
||||
<h1>Almost done!</h1>
|
||||
<p>
|
||||
Now's the time to review your answers and go back and change any, if you need to.
|
||||
Once you're done, hit the button at the bottom of the page to submit your answers.
|
||||
</p>
|
||||
|
||||
<hr>
|
||||
<hr>
|
||||
|
||||
<% @quiz.each do |question| %>
|
||||
<%= form_for(:answer, remote: true, url: post_answer_path(answer_id: question.answer_id), html:{class: 'summary-form'}) do |form| %>
|
||||
<article class="answer-sec">
|
||||
<div class="question-heading">
|
||||
<div class="question-title">
|
||||
<h3><%= question.question %></h3>
|
||||
</div>
|
||||
<div class="answer-buttons">
|
||||
<a href="<%= question_path(question.question_id) %>" class="tertiary-btn button-edit">Edit</a>
|
||||
<button class="tertiary-btn button-save">Save</button>
|
||||
<button class="tertiary-btn button-cancel">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
<% @quiz.each do |question| %>
|
||||
<%= form_for(:answer, remote: true, url: post_answer_path(answer_id: question.answer_id), html:{class: ""}) do |form| %>
|
||||
<h2><%= question.question %></h2>
|
||||
|
||||
<div class="answer-container">
|
||||
<% if question.attachment.present? %>
|
||||
<%= image_tag question.attachment %>
|
||||
<% end %>
|
||||
<div>
|
||||
<%= link_to('Edit', question_path(question.question_id)) %>
|
||||
<button>Save</button>
|
||||
<button>Cancel</button>
|
||||
</div>
|
||||
|
||||
<fieldset disabled class="answer-block">
|
||||
<%= hidden_field_tag 'answer[question_id]', question.question_id %>
|
||||
<%= hidden_field_tag 'answer[answer_id]', question.answer_id %>
|
||||
<%= hidden_field_tag 'submit', true %>
|
||||
<%= render partial: question.input_type, locals: {question: question, form: form, answer: question.answer} %>
|
||||
</fieldset>
|
||||
</div>
|
||||
</article>
|
||||
<% end %>
|
||||
<%= image_tag question.attachment if question.attachment.present? %>
|
||||
|
||||
<fieldset disabled>
|
||||
<%= render partial: question.input_type, locals: {question: question, form: form, answer: question.answer} %>
|
||||
</fieldset>
|
||||
|
||||
<%= hidden_field_tag 'answer[question_id]', question.question_id %>
|
||||
<%= hidden_field_tag 'answer[answer_id]', question.answer_id %>
|
||||
<%= hidden_field_tag 'submit', true %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<%= form_tag post_summary_path, id: 'summary-submit', class: "btn-center" do %>
|
||||
<% unless @status.can_submit %>
|
||||
<div class="error">Sorry, you must answer all questions before you can submit.</div>
|
||||
<% end %>
|
||||
<%= submit_tag "Submit all answers", {class: 'submit-button', disabled: !@status.can_submit } %>
|
||||
|
||||
<%= form_tag post_summary_path, id: 'summary-submit', class: "" do %>
|
||||
<% unless @status.can_submit %>
|
||||
<div class="error">Sorry, you must answer all questions before you can submit.</div>
|
||||
<% end %>
|
||||
</main>
|
||||
<%= submit_tag "Submit all answers", {class: "", disabled: !@status.can_submit } %>
|
||||
<% end %>
|
||||
|
Reference in New Issue
Block a user