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-edit', editClickHandler)
.on('click', '.button-cancel', cancelClickHandler) .on('click', '.button-cancel', cancelClickHandler)
.on('click', '.button-save', saveClickHandler); .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,16 +2,18 @@
Please revisit this page with JavaScript enabled to modify your answer. Please revisit this page with JavaScript enabled to modify your answer.
</div> </div>
<div data-id="live-coder-finish-later"> <% unless params[:action] == 'summary' %>
<p class="warning"> <div data-id="live-coder-finish-later">
This is a question where you will be asked to write code, and it utilizes a JavaScript-enabled <p class="warning">
environment. It looks like JavaScript is not loaded for some reason. Please check the box below This is a question where you will be asked to write code, and it utilizes a JavaScript-enabled
to acknowledge that you agree to come back at a later time to finish answering this question environment. It looks like JavaScript is not loaded for some reason. Please check the box below
before you can submit the test. to acknowledge that you agree to come back at a later time to finish answering this question
</p> before you can submit the test.
<input type="checkbox" class="checkbox" name="live-coder-later" value="check_1" id="check_1" /> </p>
<label for="check_1">I will come back later to finish this live coding question</label> <input type="checkbox" class="checkbox" name="live-coder-later" value="check_1" id="check_1" />
</div> <label for="check_1">I will come back later to finish this live coding question</label>
</div>
<% end %>
<div data-id="live-coder-answer"> <div data-id="live-coder-answer">
<% # answers inserted dynamically via jQuery .load() <% # answers inserted dynamically via jQuery .load()

View File

@ -7,7 +7,7 @@
<%= form_tag(post_summary_path) do %> <%= form_tag(post_summary_path) do %>
<% @quiz.each do |question| %> <% @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-heading">
<div class="question-title"> <div class="question-title">
<h3><%= question.question %></h3> <h3><%= question.question %></h3>