From 0d7d35058198bd59b6825a891e584f971a9fbee2 Mon Sep 17 00:00:00 2001 From: Maximilian Grundke Date: Thu, 10 Mar 2016 16:51:19 +0100 Subject: [PATCH] Collapse files in exercise index view --- app/views/exercises/show.html.slim | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/app/views/exercises/show.html.slim b/app/views/exercises/show.html.slim index dbeca3d3..cd0cabf3 100644 --- a/app/views/exercises/show.html.slim +++ b/app/views/exercises/show.html.slim @@ -21,12 +21,15 @@ h1 h2 = t('activerecord.attributes.exercise.files') -ul.list-unstyled +ul.list-unstyled.panel-group#files - @exercise.files.each do |file| li.panel.panel-default - .panel-heading - h3.panel-title = file.name_with_extension - .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) - = render('shared/file', file: file) + .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" + .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) + = render('shared/file', file: file)