diff --git a/app/assets/javascripts/live-coder.js b/app/assets/javascripts/live-coder.js index ee256c6..2616bd4 100644 --- a/app/assets/javascripts/live-coder.js +++ b/app/assets/javascripts/live-coder.js @@ -113,7 +113,8 @@ $(function(){ }); // If JavaScript is enabled, display the livecoder section dynamically - $("[data-id='live-coder-answer']").load("live-coder-chunk.php .layout", function(){ + var qid = 257208768; + $("[data-id='live-coder-answer']").load("/live-coder-entry/" + qid, function(){ // if it loads in, and hide "finish later" checkbox $("[data-id='live-coder-finish-later']").addClass("hidden"); $('.js-error').addClass('hidden'); diff --git a/app/controllers/candidate_controller.rb b/app/controllers/candidate_controller.rb index 336405a..fd3d445 100644 --- a/app/controllers/candidate_controller.rb +++ b/app/controllers/candidate_controller.rb @@ -35,6 +35,12 @@ class CandidateController < ApplicationController redirect_to :question end + def live_coder + @question = Question.find(params[:question_id]) + @answer = @question.answers.order("RAND()").first.answer + render layout: false + end + # private # # def question_params diff --git a/app/views/candidate/_live-coder.html.erb b/app/views/candidate/_live-coder.html.erb index bd96518..7f1d1ea 100644 --- a/app/views/candidate/_live-coder.html.erb +++ b/app/views/candidate/_live-coder.html.erb @@ -14,28 +14,7 @@