Merge pull request #238 from openHPI/fix_editing_exercises

Fix adding files to exercises (as admin)
This commit is contained in:
rteusner
2018-11-30 15:39:58 +01:00
committed by GitHub
2 changed files with 9 additions and 5 deletions

View File

@ -66,7 +66,6 @@ $(document).on('turbolinks:load', function() {
$('#files').append(html);
$('#files li:last select[name*="file_type_id"]').val(getSelectedExecutionEnvironment().file_type_id);
$('#files li:last select').chosen(window.CodeOcean.CHOSEN_OPTIONS);
$('#files li:last select').remove();
$('#files li:last>div:last').removeClass('in').addClass('show')
$('body, html').scrollTo('#add-file');

View File

@ -2,13 +2,18 @@
li.card.mt-2
.card-header role="tab" id="heading"
a.file-heading.collapsed data-toggle="collapse" href="#collapse#{id}"
- collapsed_class = f.index != 'index' ? 'collapsed' : nil
- aria_expanded = f.index != 'index' ? 'false' : 'true'
a class=['file-heading', collapsed_class] data-toggle="collapse" href="#collapse#{f.index}" aria-expanded="#{aria_expanded}"
div.clearfix role="button"
i class="fa" aria-hidden="true"
span = f.object.name
.card-collapse.collapse class=('in' if f.object.name.nil?) id="collapse#{id}" role="tabpanel"
- if f.object.name.present? && f.object.file_type.present?
span = f.object.name_with_extension
- else
span = f.object.name
.card-collapse.collapse class=('in' if f.object.name.nil?) id="collapse#{f.index}" role="tabpanel"
.card-body
- if policy(f.object).destroy?
- if policy(f.object).destroy? && id.present?
.clearfix
.btn.btn-warning.btn-sm.float-right.delete-file data-file-url=code_ocean_file_path(id) = t('shared.destroy')
.form-group