Implement index page

This commit is contained in:
Maximilian Grundke
2017-09-27 16:37:52 +02:00
parent 44a3cabe98
commit 93797a665d
4 changed files with 41 additions and 2 deletions

View File

@@ -3,7 +3,7 @@ class ExerciseCollectionsController < ApplicationController
before_action :set_exercise_collection, only: [:show]
def index
@exercise_collections = ExerciseCollection.all
@exercise_collections = ExerciseCollection.all.paginate(:page => params[:page])
authorize!
end

View File

@@ -1 +1,24 @@
h1 = 'ExerciseCollections#index'
h1 = ExerciseCollection.model_name.human(count: 2)
.table-responsive
table.table
thead
tr
th = t('activerecord.attributes.exercise_collections.id')
th = t('activerecord.attributes.exercise_collections.name')
th = t('activerecord.attributes.exercise_collections.updated_at')
th = t('activerecord.attributes.exercise_collections.exercises')
th colspan=3 = t('shared.actions')
tbody
- @exercise_collections.each do |collection|
tr
td = collection.id
td = link_to(collection.name, collection)
td = collection.updated_at
td = collection.exercises.size
td = link_to(t('shared.show'), collection)
td = link_to(t('shared.edit'), edit_exercise_collection_path(collection))
td = link_to(t('shared.destroy'), collection, data: {confirm: t('shared.confirm_destroy')}, method: :delete)
= render('shared/pagination', collection: @exercise_collections)
p = render('shared/new_button', model: ExerciseCollection)