From 7bead2c4730c741eed184485f2baa0c5635582e0 Mon Sep 17 00:00:00 2001 From: yqbk Date: Wed, 17 Aug 2016 15:53:16 +0200 Subject: [PATCH] implementation ready for testing --- app/assets/javascripts/editor.js.erb | 8 +++----- app/assets/stylesheets/editor.css.scss | 9 ++------- app/controllers/exercises_controller.rb | 1 - app/views/exercises/_file_form.html.slim | 1 - app/views/exercises/_form.html.slim | 2 +- app/views/exercises/edit.html.slim | 2 +- 6 files changed, 7 insertions(+), 16 deletions(-) diff --git a/app/assets/javascripts/editor.js.erb b/app/assets/javascripts/editor.js.erb index dff940e8..52ee8f20 100644 --- a/app/assets/javascripts/editor.js.erb +++ b/app/assets/javascripts/editor.js.erb @@ -403,8 +403,6 @@ $(function() { $('.editor').each(function(index, element) { var editor = ace.edit(element); - console.log('ace', element) - if (qa_api) { editor.getSession().on("change", function (deltaObject) { qa_api.executeCommand('syncEditor', [active_file, deltaObject]); @@ -836,9 +834,9 @@ $(function() { var showFrame = function(frame) { active_frame = frame; - // should not be hidden to generate multiple ace editors in edit mode - //$('.frame').hide(); - $('.frame').show(); + $('.frame').hide(); + frame.show(); + }; var showOutput = function(event) { diff --git a/app/assets/stylesheets/editor.css.scss b/app/assets/stylesheets/editor.css.scss index 8b68b6b2..e41153e2 100644 --- a/app/assets/stylesheets/editor.css.scss +++ b/app/assets/stylesheets/editor.css.scss @@ -4,14 +4,12 @@ button i.fa-spin { .editor { height: 100%; - width: auto; - margin: 12px; + width: 100%; } .frame { display: none; - height: 200px; - width: auto; + height: 400px; audio, img, video { max-width: 100%; @@ -57,11 +55,8 @@ button i.fa-spin { #files { overflow: auto; - } - - #hint { display: none; } diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index d1fcadd4..45fd04d9 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -63,7 +63,6 @@ class ExercisesController < ApplicationController end def edit - end def import_proforma_xml diff --git a/app/views/exercises/_file_form.html.slim b/app/views/exercises/_file_form.html.slim index 6efad9d1..cfd17783 100644 --- a/app/views/exercises/_file_form.html.slim +++ b/app/views/exercises/_file_form.html.slim @@ -1,4 +1,3 @@ -//- id = f.object.id = form_for(file) do |f| li.panel.panel-default .panel-heading role="tab" id="heading" diff --git a/app/views/exercises/_form.html.slim b/app/views/exercises/_form.html.slim index 7ce719b3..b498cbb3 100644 --- a/app/views/exercises/_form.html.slim +++ b/app/views/exercises/_form.html.slim @@ -31,7 +31,7 @@ h2 = t('activerecord.attributes.exercise.files') ul#files.list-unstyled.panel-group - = @exercise.files.each do |file| + - @exercise.files.each do |file| = render partial: 'file_form', locals: { file: file } a#add-file.btn.btn-default.btn-sm.pull-right href='#' = t('.add_file') diff --git a/app/views/exercises/edit.html.slim b/app/views/exercises/edit.html.slim index 6681eff5..43550759 100644 --- a/app/views/exercises/edit.html.slim +++ b/app/views/exercises/edit.html.slim @@ -1,3 +1,3 @@ h1 = @exercise -= render('form', exercise: @exercise, files: @files) += render('form')