fixed live-coder answer issues

This commit is contained in:
Mark Moser 2016-08-01 17:06:24 -05:00
parent ab8d983e62
commit f4be785b61
3 changed files with 7 additions and 5 deletions

View File

@ -18,7 +18,7 @@ class CandidateController < ApplicationController
redirect_to :summary and return if qid.nil?
prep_question qid
@answer = Answer.new
@answer = @question.answer.nil? ? Answer.new : Answer.find(@question.answer_id)
end
def update_answer

View File

@ -1,16 +1,18 @@
<% answer = @answer.answer || {} %>
<div class="code-input">
<label for="answer_live_code_html">HTML</label>
<%= text_area_tag 'answer[live_code][html]', (@answer['html'] unless @answer.nil?), { 'data-id' => 'code-html', class: 'code-answer code-html' } %>
<%= text_area_tag 'answer[live_code][html]', (answer['html']), { 'data-id' => 'code-html', class: 'code-answer code-html' } %>
</div>
<div class="code-input">
<label for="answer_live_code_css">CSS</label>
<%= text_area_tag 'answer[live_code][css]', (@answer['css'] unless @answer.nil?), { 'data-id' => 'code-css', class: 'code-answer code-css' } %>
<%= text_area_tag 'answer[live_code][css]', (answer['css']), { 'data-id' => 'code-css', class: 'code-answer code-css' } %>
</div>
<div class="code-input">
<label for="answer_live_code_js">JS</label>
<%= text_area_tag 'answer[live_code][js]', (@answer['js'] unless @answer.nil?), { 'data-id' => 'code-js', class: 'code-answer code-js' } %>
<%= text_area_tag 'answer[live_code][js]', (answer['js']), { 'data-id' => 'code-js', class: 'code-answer code-js' } %>
</div>
<div class="results" data-id="results"></div>

View File

@ -5,7 +5,7 @@
content_for :footer_title, "Skills Assessment"
%>
<%= form_for(@answer, url: post_answer_path(@answer.id), html:{id: 'answer-form', data: {qid: @question.question_id}}) do |form| %>
<%= form_for(@answer, url: post_answer_path(@answer.id), html:{method: :post, id: 'answer-form', data: {qid: @question.question_id}}) do |form| %>
<main class="questions_tpl">
<h2 class="question-text"><%= @question.question %></h2>