added the ability to discard files when creating a new exercise
This commit is contained in:
@ -14,8 +14,14 @@ $(function() {
|
|||||||
$('body, html').scrollTo('#add-file');
|
$('body, html').scrollTo('#add-file');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var discardFile = function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
$(this).parents('li').remove();
|
||||||
|
};
|
||||||
|
|
||||||
var enableInlineFileCreation = function() {
|
var enableInlineFileCreation = function() {
|
||||||
$('#add-file').on('click', addFileForm);
|
$('#add-file').on('click', addFileForm);
|
||||||
|
$('#files').on('click', 'li .discard-file', discardFile);
|
||||||
$('form.edit_exercise, form.new_exercise').on('submit', function() {
|
$('form.edit_exercise, form.new_exercise').on('submit', function() {
|
||||||
$('#dummies').html('');
|
$('#dummies').html('');
|
||||||
});
|
});
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
li.panel.panel-default
|
li.panel.panel-default
|
||||||
.panel-body
|
.panel-body
|
||||||
|
.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')
|
||||||
|
Reference in New Issue
Block a user