done
This commit is contained in:
@ -24,13 +24,16 @@ $(function() {
|
|||||||
editor.setShowPrintMargin(false);
|
editor.setShowPrintMargin(false);
|
||||||
editor.setTheme(THEME);
|
editor.setTheme(THEME);
|
||||||
|
|
||||||
//todo
|
var textarea = $('textarea[id="exercise_files_attributes_'+index+'_content"]');
|
||||||
// var textarea = $('textarea[name="2822862"]');
|
var content = textarea.val();
|
||||||
// alert($(element).data('file-id'));
|
|
||||||
// editor.getSession().setValue(textarea.val());
|
if (content != undefined)
|
||||||
// editor.getSession().on('change', function(){
|
{
|
||||||
// textarea.val(editor.getSession().getValue());
|
editor.getSession().setValue(content);
|
||||||
// });
|
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();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#editor-edit.panel-group.row data-exercise-id=@exercise.id
|
#editor-edit.panel-group.row data-exercise-id=@exercise.id
|
||||||
#frames
|
#frames
|
||||||
.frame data-executable=file.file_type.executable? data-filename=file.name_with_extension data-renderable=file.file_type.renderable? data-role=file.role data-binary=file.file_type.binary? data-context-type=file.context_type
|
.frame
|
||||||
.editor-content.hidden data-file-id=file.ancestor_id = file.content
|
.editor-content.hidden
|
||||||
.editor data-file-id=file.ancestor_id data-indent-size=file.file_type.indent_size data-mode=file.file_type.editor_mode data-id=file.id
|
.editor
|
@ -2,6 +2,5 @@
|
|||||||
= 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, style: "display:none;")
|
||||||
= 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,9 +1,11 @@
|
|||||||
|
- id = f.object.id
|
||||||
|
|
||||||
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#{id}"
|
||||||
div.clearfix role="button"
|
div.clearfix role="button"
|
||||||
span = file.name
|
span = f.object.name
|
||||||
.panel-collapse.collapse id="collapse#{file.id}" role="tabpanel"
|
.panel-collapse.collapse-in id="collapse#{id}" role="tabpanel"
|
||||||
.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
|
||||||
@ -27,7 +29,7 @@ li.panel.panel-default
|
|||||||
label
|
label
|
||||||
= f.check_box(:read_only)
|
= f.check_box(:read_only)
|
||||||
= t('activerecord.attributes.file.read_only')
|
= t('activerecord.attributes.file.read_only')
|
||||||
.test-related-fields style="display: #{file.teacher_defined_test? ? 'initial' : 'none'};"
|
.test-related-fields style="display: #{f.object.teacher_defined_test? ? 'initial' : 'none'};"
|
||||||
.form-group
|
.form-group
|
||||||
= f.label(:name, t('activerecord.attributes.file.feedback_message'))
|
= f.label(:name, t('activerecord.attributes.file.feedback_message'))
|
||||||
= f.text_area(:feedback_message, class: 'form-control', maxlength: 255)
|
= f.text_area(:feedback_message, class: 'form-control', maxlength: 255)
|
||||||
@ -35,63 +37,5 @@ li.panel.panel-default
|
|||||||
.form-group
|
.form-group
|
||||||
= f.label(:role, t('activerecord.attributes.file.weight'))
|
= f.label(:role, t('activerecord.attributes.file.weight'))
|
||||||
= f.number_field(:weight, class: 'form-control', min: 1, step: 'any')
|
= f.number_field(:weight, class: 'form-control', min: 1, step: 'any')
|
||||||
- unless file.new_record?
|
= render('code_field', attribute: :content, form: f, label: t('activerecord.attributes.file.content'))
|
||||||
/= render partial: 'ace', locals: { exercise: @exercise, file: file }
|
= render partial: 'ace', locals: { exercise: @exercise }
|
||||||
|
|
||||||
/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
|
|
||||||
.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')
|
|
||||||
= render('code_field', attribute: :content, form: f, label: t('activerecord.attributes.file.content'))
|
|
||||||
|
|
||||||
|
|
||||||
/Disabled blank text editor field
|
|
@ -30,20 +30,10 @@
|
|||||||
= 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')
|
||||||
|
|
||||||
/----------------------
|
ul#files.list-unstyled.panel-group
|
||||||
/todo
|
|
||||||
/ul#files.list-unstyled.panel-group
|
|
||||||
= f.fields_for :files do |files_form|
|
= f.fields_for :files do |files_form|
|
||||||
= render('file_form', f: files_form)
|
= render('file_form', f: files_form)
|
||||||
|
|
||||||
|
|
||||||
ul#files.list-unstyled.panel-group
|
|
||||||
- @exercise.files.each_with_index do |file, index|
|
|
||||||
= 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 = f.fields_for(:files, CodeOcean::File.new, child_index: 'index') do |files_form|
|
ul#dummies.hidden = f.fields_for(:files, CodeOcean::File.new, child_index: 'index') do |files_form|
|
||||||
= render('file_form', file: CodeOcean::File.new, f: files_form)
|
= render('file_form', file: CodeOcean::File.new, f: files_form)
|
||||||
|
Reference in New Issue
Block a user