save properly
This commit is contained in:
@ -23,6 +23,15 @@ $(function() {
|
|||||||
editor.setReadOnly($(element).data('read-only') !== undefined);
|
editor.setReadOnly($(element).data('read-only') !== undefined);
|
||||||
editor.setShowPrintMargin(false);
|
editor.setShowPrintMargin(false);
|
||||||
editor.setTheme(THEME);
|
editor.setTheme(THEME);
|
||||||
|
|
||||||
|
//todo
|
||||||
|
// var textarea = $('textarea[name="2822862"]');
|
||||||
|
// alert($(element).data('file-id'));
|
||||||
|
// editor.getSession().setValue(textarea.val());
|
||||||
|
// editor.getSession().on('change', function(){
|
||||||
|
// textarea.val(editor.getSession().getValue());
|
||||||
|
// });
|
||||||
|
|
||||||
editor.commands.bindKey("ctrl+alt+0", null);
|
editor.commands.bindKey("ctrl+alt+0", null);
|
||||||
var session = editor.getSession();
|
var session = editor.getSession();
|
||||||
session.setMode($(element).data('mode'));
|
session.setMode($(element).data('mode'));
|
||||||
|
@ -836,7 +836,6 @@ $(function() {
|
|||||||
active_frame = frame;
|
active_frame = frame;
|
||||||
$('.frame').hide();
|
$('.frame').hide();
|
||||||
frame.show();
|
frame.show();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var showOutput = function(event) {
|
var showOutput = function(event) {
|
||||||
|
@ -2,5 +2,6 @@
|
|||||||
= form.label(attribute, label)
|
= form.label(attribute, label)
|
||||||
|
|
|
|
||||||
a.toggle-input data={text_initial: t('shared.upload_file'), text_toggled: t('shared.back')} href='#' = t('shared.upload_file')
|
a.toggle-input data={text_initial: t('shared.upload_file'), text_toggled: t('shared.back')} href='#' = t('shared.upload_file')
|
||||||
|
/= form.text_area(attribute, class: 'code-field form-control original-input', rows: 16, name: file.id)
|
||||||
= form.text_area(attribute, class: 'code-field form-control original-input', rows: 16)
|
= form.text_area(attribute, class: 'code-field form-control original-input', rows: 16)
|
||||||
= form.file_field(attribute, class: 'alternative-input form-control', disabled: true)
|
= form.file_field(attribute, class: 'alternative-input form-control', disabled: true)
|
||||||
|
@ -1,4 +1,85 @@
|
|||||||
= fields_for(file) do |f|
|
li.panel.panel-default
|
||||||
|
.panel-heading role="tab" id="heading"
|
||||||
|
a.file-heading data-toggle="collapse" data-parent="#files" href="#collapse#{file.id}"
|
||||||
|
div.clearfix role="button"
|
||||||
|
span = file.name
|
||||||
|
.panel-collapse.collapse id="collapse#{file.id}" role="tabpanel"
|
||||||
|
.panel-body
|
||||||
|
.clearfix = link_to(t('shared.destroy'), '#', class:'btn btn-warning btn-sm discard-file pull-right')
|
||||||
|
.form-group
|
||||||
|
= f.label(:name, t('activerecord.attributes.file.name'))
|
||||||
|
= f.text_field(:name, class: 'form-control')
|
||||||
|
.form-group
|
||||||
|
= f.label(:path, t('activerecord.attributes.file.path'))
|
||||||
|
= f.text_field(:path, class: 'form-control')
|
||||||
|
.help-block = t('.hints.path')
|
||||||
|
.form-group
|
||||||
|
= f.label(:file_type_id, t('activerecord.attributes.file.file_type_id'))
|
||||||
|
= f.collection_select(:file_type_id, @file_types, :id, :name, {}, class: 'form-control')
|
||||||
|
.form-group
|
||||||
|
= f.label(:role, t('activerecord.attributes.file.role'))
|
||||||
|
= f.select(:role, CodeOcean::File::TEACHER_DEFINED_ROLES.map { |role| [t("files.roles.#{role}"), role] }, {include_blank: true}, class: 'form-control')
|
||||||
|
.checkbox
|
||||||
|
label
|
||||||
|
= f.check_box(:hidden)
|
||||||
|
= t('activerecord.attributes.file.hidden')
|
||||||
|
.checkbox
|
||||||
|
label
|
||||||
|
= f.check_box(:read_only)
|
||||||
|
= t('activerecord.attributes.file.read_only')
|
||||||
|
.test-related-fields style="display: #{file.teacher_defined_test? ? 'initial' : 'none'};"
|
||||||
|
.form-group
|
||||||
|
= f.label(:name, t('activerecord.attributes.file.feedback_message'))
|
||||||
|
= f.text_area(:feedback_message, class: 'form-control', maxlength: 255)
|
||||||
|
.help-block = t('.hints.feedback_message')
|
||||||
|
.form-group
|
||||||
|
= f.label(:role, t('activerecord.attributes.file.weight'))
|
||||||
|
= f.number_field(:weight, class: 'form-control', min: 1, step: 'any')
|
||||||
|
- unless file.new_record?
|
||||||
|
/= render partial: 'ace', locals: { exercise: @exercise, file: file }
|
||||||
|
|
||||||
|
/Disabled blank text editor field
|
||||||
|
= render('code_field', attribute: :content, form: f, label: t('activerecord.attributes.file.content'))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/- id = f.object.id
|
||||||
|
/
|
||||||
|
/li.panel.panel-default
|
||||||
|
/ .panel-heading role="tab" id="heading"
|
||||||
|
/ a.file-heading data-toggle="collapse" data-parent="#files" href="#collapse#{id}"
|
||||||
|
/ div.clearfix role="button"
|
||||||
|
/ span = f.object.name
|
||||||
|
/ .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
|
||||||
|
/ = f.label(:name, t('activerecord.attributes.file.name'))
|
||||||
|
/ = f.text_field(:name, class: 'form-control')
|
||||||
|
/
|
||||||
|
/
|
||||||
|
/ = render('code_field', attribute: :content, form: f, label: t('activerecord.attributes.file.content'))
|
||||||
|
/ = render partial: 'ace', locals: { exercise: @exercise, file: file, }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/= fields_for(file) do |f|
|
||||||
li.panel.panel-default
|
li.panel.panel-default
|
||||||
.panel-heading role="tab" id="heading"
|
.panel-heading role="tab" id="heading"
|
||||||
a.file-heading data-toggle="collapse" data-parent="#files" href="#collapse#{file.id}"
|
a.file-heading data-toggle="collapse" data-parent="#files" href="#collapse#{file.id}"
|
||||||
@ -8,36 +89,9 @@
|
|||||||
.panel-body
|
.panel-body
|
||||||
.clearfix = link_to(t('shared.destroy'), '#', class:'btn btn-warning btn-sm discard-file pull-right')
|
.clearfix = link_to(t('shared.destroy'), '#', class:'btn btn-warning btn-sm discard-file pull-right')
|
||||||
.form-group
|
.form-group
|
||||||
= f.label(:name, t('activerecord.attributes.file.name'))
|
= f.label(:name, t('activerecord.attributes.file.name'))
|
||||||
= f.text_field(:name, class: 'form-control')
|
= f.text_field(:name, class: 'form-control')
|
||||||
.form-group
|
= render('code_field', attribute: :content, form: f, label: t('activerecord.attributes.file.content'))
|
||||||
= f.label(:path, t('activerecord.attributes.file.path'))
|
|
||||||
= f.text_field(:path, class: 'form-control')
|
|
||||||
.help-block = t('.hints.path')
|
|
||||||
.form-group
|
|
||||||
= f.label(:file_type_id, t('activerecord.attributes.file.file_type_id'))
|
|
||||||
= f.collection_select(:file_type_id, @file_types, :id, :name, {}, class: 'form-control')
|
|
||||||
.form-group
|
|
||||||
= f.label(:role, t('activerecord.attributes.file.role'))
|
|
||||||
= f.select(:role, CodeOcean::File::TEACHER_DEFINED_ROLES.map { |role| [t("files.roles.#{role}"), role] }, {include_blank: true}, class: 'form-control')
|
|
||||||
.checkbox
|
|
||||||
label
|
|
||||||
= f.check_box(:hidden)
|
|
||||||
= t('activerecord.attributes.file.hidden')
|
|
||||||
.checkbox
|
|
||||||
label
|
|
||||||
= f.check_box(:read_only)
|
|
||||||
= t('activerecord.attributes.file.read_only')
|
|
||||||
.test-related-fields style="display: #{file.teacher_defined_test? ? 'initial' : 'none'};"
|
|
||||||
.form-group
|
|
||||||
= f.label(:name, t('activerecord.attributes.file.feedback_message'))
|
|
||||||
= f.text_area(:feedback_message, class: 'form-control', maxlength: 255)
|
|
||||||
.help-block = t('.hints.feedback_message')
|
|
||||||
.form-group
|
|
||||||
= f.label(:role, t('activerecord.attributes.file.weight'))
|
|
||||||
= f.number_field(:weight, class: 'form-control', min: 1, step: 'any')
|
|
||||||
- unless file.new_record?
|
|
||||||
= render partial: 'ace', locals: { exercise: @exercise, file: file }
|
|
||||||
|
|
||||||
/Disabled blank text editor field
|
/Disabled blank text editor field
|
||||||
/= render('code_field', attribute: :content, form: f, label: t('activerecord.attributes.file.content'))
|
|
||||||
|
@ -29,11 +29,23 @@
|
|||||||
= f.check_box(:allow_file_creation)
|
= f.check_box(:allow_file_creation)
|
||||||
= t('activerecord.attributes.exercise.allow_file_creation')
|
= t('activerecord.attributes.exercise.allow_file_creation')
|
||||||
h2 = t('activerecord.attributes.exercise.files')
|
h2 = t('activerecord.attributes.exercise.files')
|
||||||
|
|
||||||
|
/----------------------
|
||||||
|
/todo
|
||||||
|
/ul#files.list-unstyled.panel-group
|
||||||
|
= f.fields_for :files do |files_form|
|
||||||
|
= render('file_form', f: files_form)
|
||||||
|
|
||||||
|
|
||||||
ul#files.list-unstyled.panel-group
|
ul#files.list-unstyled.panel-group
|
||||||
- @exercise.files.each do |file|
|
- @exercise.files.each_with_index do |file, index|
|
||||||
= render partial: 'file_form', locals: {file: file}
|
= f.fields_for(:files) do |files_form|
|
||||||
|
- if index == (files_form.index - 1)
|
||||||
|
= render('file_form', file: file, f: files_form)
|
||||||
|
/----------------------
|
||||||
|
|
||||||
a#add-file.btn.btn-default.btn-sm.pull-right href='#' = t('.add_file')
|
a#add-file.btn.btn-default.btn-sm.pull-right href='#' = t('.add_file')
|
||||||
ul#dummies.hidden
|
ul#dummies.hidden = f.fields_for(:files, CodeOcean::File.new, child_index: 'index') do |files_form|
|
||||||
= render partial: 'file_form', locals: {file: CodeOcean::File.new}
|
= render('file_form', file: CodeOcean::File.new, f: files_form)
|
||||||
.actions = render('shared/submit_button', f: f, object: @exercise)
|
.actions = render('shared/submit_button', f: f, object: @exercise)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user