From f0c0621b3114d17ffd7d54f959fb53d866c6d628 Mon Sep 17 00:00:00 2001 From: Maximilian Grundke Date: Wed, 27 Sep 2017 16:52:42 +0200 Subject: [PATCH] Implement show route --- app/models/exercise_collection.rb | 4 ++++ app/views/exercise_collections/show.html.slim | 12 +++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app/models/exercise_collection.rb b/app/models/exercise_collection.rb index 2dca0e9d..f672554d 100644 --- a/app/models/exercise_collection.rb +++ b/app/models/exercise_collection.rb @@ -2,4 +2,8 @@ class ExerciseCollection < ActiveRecord::Base has_and_belongs_to_many :exercises + def to_s + "#{I18n.t('activerecord.models.exercise_collection.one')}: #{name} (#{id})" + end + end \ No newline at end of file diff --git a/app/views/exercise_collections/show.html.slim b/app/views/exercise_collections/show.html.slim index 6ed2b5f7..89081efe 100644 --- a/app/views/exercise_collections/show.html.slim +++ b/app/views/exercise_collections/show.html.slim @@ -1 +1,11 @@ -h1 = 'ExerciseCollection#show' +h1 + = @exercise_collection + = render('shared/edit_button', object: @exercise_collection) + += row(label: 'exercise_collections.name', value: @exercise_collection.name) += row(label: 'exercise_collections.updated_at', value: @exercise_collection.updated_at) + +h4 = t('activerecord.attributes.exercise_collections.exercises') +ul.list-unstyled + - @exercise_collection.exercises.sort_by{|c| c.title}.each do |exercise| + li = exercise \ No newline at end of file