[Pharo] Personal fitness tracker web app.
1
Class {
2
#name : 'MFTRoutineViewerPage',
3
#superclass : 'MFTPage',
4
#instVars : [
5
'routine'
6
],
7
#category : 'MyFitnessTracker-Web-Components',
8
#package : 'MyFitnessTracker-Web',
9
#tag : 'Components'
10
}
11
12
{ #category : 'as yet unclassified' }
13
MFTRoutineViewerPage class >> forRoutine: aMFTRoutine [
14
15
^ self new
16
routine: aMFTRoutine;
17
yourself
18
]
19
20
{ #category : 'rendering' }
21
MFTRoutineViewerPage >> renderActionButtonsOn: html [
22
23
html div
24
class: 'grid';
25
style: 'margin-bottom: 2rem';
26
with: [
27
html anchor
28
class: 'outline';
29
attributeAt: 'role' put: 'button';
30
callback: [ self answer ];
31
with: 'Return'.
32
33
html anchor
34
class: 'secondary outline';
35
attributeAt: 'role' put: 'button';
36
callback: [
37
routine := (self call:
38
(MFTRoutineCreationTask forRoutine: routine))
39
ifNil: [ routine ] ];
40
with: 'Edit' ]
41
]
42
43
{ #category : 'rendering' }
44
MFTRoutineViewerPage >> renderContentOn: html [
45
46
self renderActionButtonsOn: html.
47
48
html heading
49
level: 1;
50
with: routine title.
51
routine workouts do: [ :workoutPrescription |
52
html details
53
attributeAt: 'name' put: 'workoutPrescriptions';
54
with: [
55
html summary: workoutPrescription title.
56
html render:
57
(MFTWorkoutPrescriptionTable forPrescription:
58
workoutPrescription) ].
59
html horizontalRule ]
60
]
61
62
{ #category : 'accessing' }
63
MFTRoutineViewerPage >> routine: aMFTRoutine [
64
65
routine := aMFTRoutine
66
]
67
68
{ #category : 'accessing' }
69
MFTRoutineViewerPage >> title [
70
71
^ routine canonicalName
72
]
73