Summary dynamic load progress

This commit is contained in:
Derek Montgomery 2016-07-29 16:28:02 -05:00
parent 58c4661607
commit 71786f3c6e
3 changed files with 24 additions and 11 deletions

View File

@ -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();
});
});

View File

@ -2,7 +2,8 @@
Please revisit this page with JavaScript enabled to modify your answer.
</div>
<div data-id="live-coder-finish-later">
<% unless params[:action] == 'summary' %>
<div data-id="live-coder-finish-later">
<p class="warning">
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
@ -11,7 +12,8 @@
</p>
<input type="checkbox" class="checkbox" name="live-coder-later" value="check_1" id="check_1" />
<label for="check_1">I will come back later to finish this live coding question</label>
</div>
</div>
<% end %>
<div data-id="live-coder-answer">
<% # answers inserted dynamically via jQuery .load()

View File

@ -7,7 +7,7 @@
<%= form_tag(post_summary_path) do %>
<% @quiz.each do |question| %>
<article class="answer-sec">
<article class="answer-sec <%= question.input_type %>-type" data-qid="<%= question.question_id %>">
<div class="question-heading">
<div class="question-title">
<h3><%= question.question %></h3>