From 71786f3c6eaa2e5472eda676442f43fd817c89eb Mon Sep 17 00:00:00 2001 From: Derek Montgomery Date: Fri, 29 Jul 2016 16:28:02 -0500 Subject: [PATCH] Summary dynamic load progress --- app/assets/javascripts/summary-edit.js | 11 +++++++++++ app/views/candidate/_live-coder.html.erb | 22 ++++++++++++---------- app/views/candidate/summary.html.erb | 2 +- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/app/assets/javascripts/summary-edit.js b/app/assets/javascripts/summary-edit.js index 7a8c0a7..0b4a764 100644 --- a/app/assets/javascripts/summary-edit.js +++ b/app/assets/javascripts/summary-edit.js @@ -161,3 +161,14 @@ $('.answer-block').prop('disabled', true); .on('click', '.button-edit', editClickHandler) .on('click', '.button-cancel', cancelClickHandler) .on('click', '.button-save', saveClickHandler); + + // Dynamically load in coders + $.each($('.answer-sec.live-coder-type'), function(index, elem){ + var qid = $(elem).data('qid'); + $(elem).find("[data-id='live-coder-answer']").load("/live-coder-entry/" + qid, function(){ + $(elem).find('.js-error').addClass('hidden'); + // updateResults(); + $(elem).find(".code-input textarea").linedtextarea(); + }); + +}); diff --git a/app/views/candidate/_live-coder.html.erb b/app/views/candidate/_live-coder.html.erb index 7f1d1ea..7690f65 100644 --- a/app/views/candidate/_live-coder.html.erb +++ b/app/views/candidate/_live-coder.html.erb @@ -2,16 +2,18 @@ Please revisit this page with JavaScript enabled to modify your answer. -
-

- This is a question where you will be asked to write code, and it utilizes a JavaScript-enabled - environment. It looks like JavaScript is not loaded for some reason. Please check the box below - to acknowledge that you agree to come back at a later time to finish answering this question - before you can submit the test. -

- - -
+<% unless params[:action] == 'summary' %> +
+

+ This is a question where you will be asked to write code, and it utilizes a JavaScript-enabled + environment. It looks like JavaScript is not loaded for some reason. Please check the box below + to acknowledge that you agree to come back at a later time to finish answering this question + before you can submit the test. +

+ + +
+<% end %>
<% # answers inserted dynamically via jQuery .load() diff --git a/app/views/candidate/summary.html.erb b/app/views/candidate/summary.html.erb index f0ba7bc..4ab116c 100644 --- a/app/views/candidate/summary.html.erb +++ b/app/views/candidate/summary.html.erb @@ -7,7 +7,7 @@ <%= form_tag(post_summary_path) do %> <% @quiz.each do |question| %> -
+

<%= question.question %>