diff --git a/app/assets/javascripts/summary-edit.js b/app/assets/javascripts/summary-edit.js index 55e2915..7a8c0a7 100644 --- a/app/assets/javascripts/summary-edit.js +++ b/app/assets/javascripts/summary-edit.js @@ -92,7 +92,17 @@ var saveClickHandler = function(e) { var data =[]; var executeQuery; var questionId = thisEd.find('.button-edit').attr('data-questionid'); - if(thisEd.find('input').attr('type')=='radio') { + + if (thisEd.find('textarea.code-answer')) { + var htmlAnswer = $(thisEd.find('textarea.code-html')[0]).val(); + var cssAnswer = $(thisEd.find('textarea.code-css')[0]).val(); + var jsAnswer = $(thisEd.find('textarea.code-js')[0]).val(); + data = { + 'html': htmlAnswer, + 'css': cssAnswer, + 'js': jsAnswer + } + } else if(thisEd.find('input').attr('type')=='radio') { $(thisEd.find('input')).each(function() { if($(this).prop('checked')==true) { data = $(this).val(); @@ -104,15 +114,6 @@ var saveClickHandler = function(e) { data.push($(this).val()); } }); - } else if (thisEd.find('textarea.code-answer')) { - var htmlAnswer = $(thisEd.find('textarea.code-html')[0]).val(); - var cssAnswer = $(thisEd.find('textarea.code-css')[0]).val(); - var jsAnswer = $(thisEd.find('textarea.code-js')[0]).val(); - data = { - 'html': htmlAnswer, - 'css': cssAnswer, - 'js': jsAnswer - } } else { data = thisEd.find('textarea').val(); } @@ -122,7 +123,7 @@ var saveClickHandler = function(e) { thisEd.find('textarea:not(.code-answer)').replaceWith('

' + $.trim(thisEd.find('textarea').val()) + '

'); $.ajax({ type: "POST", - url: "assets/update_from_summary.php", + url: "/summary", data:{ id: questionId, answer: data}, success: function(data){ executeQuery = true; diff --git a/app/views/candidate/live_coder.html.erb b/app/views/candidate/live_coder.html.erb index 99be003..c971f6b 100644 --- a/app/views/candidate/live_coder.html.erb +++ b/app/views/candidate/live_coder.html.erb @@ -1,16 +1,16 @@
- +
- +
- +
-- MOVE TO FLASH HASH --