Improve exercise list and link to statistics

This commit is contained in:
Maximilian Grundke
2017-12-10 19:17:02 +01:00
parent fafa55f85c
commit a6744c20e6
2 changed files with 18 additions and 3 deletions

View File

@ -9,6 +9,7 @@ class ExerciseCollectionsController < ApplicationController
end end
def show def show
@exercises = @exercise_collection.exercises.paginate(:page => params[:page])
end end
def new def new

View File

@ -7,6 +7,20 @@ h1
= row(label: 'exercise_collections.updated_at', value: @exercise_collection.updated_at) = row(label: 'exercise_collections.updated_at', value: @exercise_collection.updated_at)
h4 = t('activerecord.attributes.exercise_collections.exercises') h4 = t('activerecord.attributes.exercise_collections.exercises')
ul.list-unstyled .table-responsive
- @exercise_collection.exercises.sort_by{|c| c.title}.each do |exercise| table.table
li = link_to(exercise, exercise) thead
tr
th = t('activerecord.attributes.exercise.title')
th = t('activerecord.attributes.exercise.execution_environment')
th = t('activerecord.attributes.exercise.user')
th = t('shared.actions')
tbody
- @exercises.sort_by{|c| c.title}.each do |exercise|
tr
td = link_to(exercise.title, exercise)
td = link_to_if(exercise.execution_environment && policy(exercise.execution_environment).show?, exercise.execution_environment, exercise.execution_environment)
td = exercise.user.name
td = link_to(t('shared.statistics'), statistics_exercise_path(exercise))
= render('shared/pagination', collection: @exercises)