From 6e7c250ad1668ef632c649f4ddb02692c78773bf Mon Sep 17 00:00:00 2001 From: Ralf Teusner Date: Wed, 29 Jun 2016 15:38:53 +0200 Subject: [PATCH] revert collapsed file forms in edit mode, this caused too much trouble. Added some comments concerning that. --- app/assets/javascripts/exercises.js | 3 +++ app/views/exercises/_file_form.html.slim | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/exercises.js b/app/assets/javascripts/exercises.js index 1f861ef6..e6773f40 100644 --- a/app/assets/javascripts/exercises.js +++ b/app/assets/javascripts/exercises.js @@ -12,6 +12,9 @@ $(function() { $('#files li:last select[name*="file_type_id"]').val(getSelectedExecutionEnvironment().file_type_id); $('#files li:last select').chosen(window.CodeOcean.CHOSEN_OPTIONS); $('body, html').scrollTo('#add-file'); + // if we collapse the file forms by default, we need to click on the new element in order to open it. + // however, this crashes for more files (if we add several ones by clicking the add button more often), since the elements are probably not correctly added to the files list. + //$('#files li:last>div:first>a>div').click(); }; var ajaxError = function() { diff --git a/app/views/exercises/_file_form.html.slim b/app/views/exercises/_file_form.html.slim index 66fa4bbf..7bb4cd27 100644 --- a/app/views/exercises/_file_form.html.slim +++ b/app/views/exercises/_file_form.html.slim @@ -4,7 +4,7 @@ li.panel.panel-default a.file-heading data-toggle="collapse" data-parent="#files" href="#collapse#{id}" div.clearfix role="button" span = f.object.name - .panel-collapse.collapse id="collapse#{id}" role="tabpanel" + .panel-collapse.collapse-in id="collapse#{id}" role="tabpanel" .panel-body .clearfix = link_to(t('shared.destroy'), '#', class:'btn btn-warning btn-sm discard-file pull-right') .form-group