From a2d92f1521175f0344aefa3a9183d3655b6998d7 Mon Sep 17 00:00:00 2001 From: Ralf Teusner Date: Fri, 24 Jun 2016 16:41:51 +0200 Subject: [PATCH] file ordering in show of exercises, collapse behavior --- app/assets/stylesheets/exercises.css.scss | 5 ++++- app/views/exercises/_file_form.html.slim | 8 ++++---- app/views/exercises/show.html.slim | 12 +++++++----- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/app/assets/stylesheets/exercises.css.scss b/app/assets/stylesheets/exercises.css.scss index f348c025..eb1b5300 100644 --- a/app/assets/stylesheets/exercises.css.scss +++ b/app/assets/stylesheets/exercises.css.scss @@ -49,7 +49,10 @@ div#chart_2 { } - +a.file-heading { + color: black !important; + text-decoration: none; +} .bar { fill: orange; diff --git a/app/views/exercises/_file_form.html.slim b/app/views/exercises/_file_form.html.slim index c737f068..66fa4bbf 100644 --- a/app/views/exercises/_file_form.html.slim +++ b/app/views/exercises/_file_form.html.slim @@ -1,10 +1,10 @@ - id = f.object.id li.panel.panel-default .panel-heading role="tab" id="heading" - div.clearfix role="button" - span = f.object.name - a.pull-right data-toggle="collapse" data-parent="#files" href="#collapse#{id}" collapse - .panel-collapse.collapse.in id="collapse#{id}" role="tabpanel" + 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-body .clearfix = link_to(t('shared.destroy'), '#', class:'btn btn-warning btn-sm discard-file pull-right') .form-group diff --git a/app/views/exercises/show.html.slim b/app/views/exercises/show.html.slim index fc28272a..b4b72932 100644 --- a/app/views/exercises/show.html.slim +++ b/app/views/exercises/show.html.slim @@ -23,13 +23,15 @@ h1 h2 = t('activerecord.attributes.exercise.files') ul.list-unstyled.panel-group#files - - @exercise.files.each do |file| + - @exercise.files.order('name').each do |file| li.panel.panel-default .panel-heading role="tab" id="heading" - div.clearfix role="button" - span.panel-title = file.name_with_extension - a.pull-right data-toggle="collapse" data-parent="#files" href="#collapse#{file.id}" collapse - .panel-collapse.collapse.in id="collapse#{file.id}" role="tabpanel" + a.file-heading data-toggle="collapse" data-parent="#files" href=".collapse#{file.id}" + div.clearfix role="button" + span = file.name_with_extension + // probably set an icon here that shows that the rows can be collapsed + //span.pull-right.collapse.in class="collapse#{file.id}" ☼ + .panel-collapse.collapse class="collapse#{file.id}" role="tabpanel" .panel-body - if policy(file).destroy? .clearfix = link_to(t('shared.destroy'), file, class:'btn btn-warning btn-sm pull-right', data: {confirm: t('shared.confirm_destroy')}, method: :delete)