From 988f1346c18b7a6978ab46f4c2727a1cf8a80779 Mon Sep 17 00:00:00 2001 From: Derek Montgomery Date: Tue, 2 Aug 2016 16:26:55 -0500 Subject: [PATCH] Live coder JS adjustments --- app/assets/javascripts/live-coder.js | 3 +++ app/assets/javascripts/summary-edit.js | 12 +++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/live-coder.js b/app/assets/javascripts/live-coder.js index 26aee9d..099766b 100644 --- a/app/assets/javascripts/live-coder.js +++ b/app/assets/javascripts/live-coder.js @@ -93,6 +93,9 @@ function loadLiveCoders(){ $(elem).find("[data-id='live-coder-answer']").load("/live-coder-entry/" + qid, function(){ $(elem).find('.js-error').addClass('hidden'); $(elem).find(".code-input textarea").linedtextarea(); + if(window.location.href.indexOf("summary") > -1) { + $(elem).find(".code-input textarea").attr('disabled', true); + } updateResults(this); }); }); diff --git a/app/assets/javascripts/summary-edit.js b/app/assets/javascripts/summary-edit.js index 5f5dc12..8948a99 100644 --- a/app/assets/javascripts/summary-edit.js +++ b/app/assets/javascripts/summary-edit.js @@ -165,7 +165,7 @@ var saveClickHandler = function(e) { $('.answer-block').prop('disabled', true); // Question events - $('.answer-sec') +$('.answer-sec') .find('.button-cancel, .button-save').hide().end() // // delegating events .on('click', '.button-edit', editClickHandler) @@ -173,12 +173,10 @@ $('.answer-block').prop('disabled', true); .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(){ +$.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(); + $(elem).find(".code-input textarea").linedtextarea(); }); - });