[Pharo] Personal fitness tracker web app.
Uncollapse workout prescription and logging components.
Changed files
- src/MyFitnessTracker-Web/MFTHomePage.class.st
- src/MyFitnessTracker-Web/MFTLogWorkoutComponent.class.st
- src/MyFitnessTracker-Web/MFTLogWorkoutPage.class.st
- src/MyFitnessTracker-Web/MFTRestComponent.class.st
- src/MyFitnessTracker-Web/MFTRoutineComponent.class.st
- src/MyFitnessTracker-Web/MFTStatusComponent.class.st
- src/MyFitnessTracker-Web/MFTViewWorkoutComponent.class.st
- src/MyFitnessTracker-Web/MFTWorkoutComponent.class.st
- src/MyFitnessTracker-Web/MFTWorkoutDetailsComponent.class.st
- src/MyFitnessTracker-Web/MFTWorkoutLogBookComponent.class.st
- src/MyFitnessTracker-Web/MFTWorkoutSetComponent.class.st
- src/MyFitnessTracker-Web/MFTWorkoutSetGroupComponent.class.st
src/MyFitnessTracker-Web/MFTHomePage.class.st
@@ -22,7 +22,7 @@
22
22
23
23
super initialize.
24
24
statusComponent := MFTStatusComponent new.
25
Removed:
nextWorkoutPrescriptionComponent := MFTWorkoutComponent new
25
Added:
nextWorkoutPrescriptionComponent := MFTViewWorkoutComponent new
26
26
beLoggable.
27
27
workoutLogBookComponent := MFTWorkoutLogBookComponent new
28
28
]
@@ -47,9 +47,7 @@
47
47
level: 2;
48
48
with: 'Next workout'.
49
49
html
50
Removed:
render: (nextWorkoutPrescriptionComponent
51
Removed:
workoutPrescription: trainee nextWorkoutPrescription;
52
Removed:
workoutLog:
50
Added:
render: (nextWorkoutPrescriptionComponent workoutLog:
53
51
(MFTWorkoutLog forPrescription: trainee nextWorkoutPrescription));
54
52
render: (workoutLogBookComponent workoutLogBook: trainee logBook) ]
55
53
]
src/MyFitnessTracker-Web/MFTLogWorkoutComponent.class.st
@@ -0,0 +1,71 @@
1
Added:
Class {
2
Added:
#name : 'MFTLogWorkoutComponent',
3
Added:
#superclass : 'WAComponent',
4
Added:
#instVars : [
5
Added:
'workoutLog',
6
Added:
'workoutDetailsComponent',
7
Added:
'workoutSetGroupComponents'
8
Added:
],
9
Added:
#category : 'MyFitnessTracker-Web-Components',
10
Added:
#package : 'MyFitnessTracker-Web',
11
Added:
#tag : 'Components'
12
Added:
}
13
Added:
14
Added:
{ #category : 'as yet unclassified' }
15
Added:
MFTLogWorkoutComponent class >> forWorkoutLog: aMFTWorkoutLog [
16
Added:
17
Added:
^ self new
18
Added:
workoutLog: aMFTWorkoutLog;
19
Added:
yourself
20
Added:
]
21
Added:
22
Added:
{ #category : 'as yet unclassified' }
23
Added:
MFTLogWorkoutComponent >> children [
24
Added:
25
Added:
^ workoutSetGroupComponents , { workoutDetailsComponent }
26
Added:
]
27
Added:
28
Added:
{ #category : 'as yet unclassified' }
29
Added:
MFTLogWorkoutComponent >> initialize [
30
Added:
31
Added:
super initialize.
32
Added:
workoutDetailsComponent := MFTWorkoutDetailsComponent new.
33
Added:
workoutSetGroupComponents := OrderedCollection new
34
Added:
]
35
Added:
36
Added:
{ #category : 'as yet unclassified' }
37
Added:
MFTLogWorkoutComponent >> renderActionsOn: html [
38
Added:
39
Added:
html form: [
40
Added:
html submitButton
41
Added:
callback: [
42
Added:
workoutLog finishNow.
43
Added:
self session user logWorkout: workoutLog.
44
Added:
self session pageManager setActivePage: MFTHomePage new ];
45
Added:
with: 'Save Workout' ]
46
Added:
]
47
Added:
48
Added:
{ #category : 'rendering' }
49
Added:
MFTLogWorkoutComponent >> renderContentOn: html [
50
Added:
51
Added:
workoutSetGroupComponents := workoutLog prescription setGroups
52
Added:
collect: [ :each |
53
Added:
MFTWorkoutSetGroupComponent new
54
Added:
setGroup: each ].
55
Added:
html div
56
Added:
class: 'workout-card';
57
Added:
with: [
58
Added:
html heading
59
Added:
level: 3;
60
Added:
with: workoutLog prescription canonicalName.
61
Added:
html
62
Added:
render: (workoutDetailsComponent workoutLog: workoutLog);
63
Added:
render: workoutSetGroupComponents.
64
Added:
self renderActionsOn: html ]
65
Added:
]
66
Added:
67
Added:
{ #category : 'accessing' }
68
Added:
MFTLogWorkoutComponent >> workoutLog: aMFTWorkoutLog [
69
Added:
70
Added:
workoutLog := aMFTWorkoutLog
71
Added:
]
src/MyFitnessTracker-Web/MFTLogWorkoutPage.class.st
@@ -2,7 +2,8 @@
2
2
#name : 'MFTLogWorkoutPage',
3
3
#superclass : 'MFTPage',
4
4
#instVars : [
5
Removed:
'workoutComponent'
5
Added:
'workoutLog',
6
Added:
'logWorkoutComponent'
6
7
],
7
8
#category : 'MyFitnessTracker-Web-Components',
8
9
#package : 'MyFitnessTracker-Web',
@@ -12,9 +13,16 @@
12
13
{ #category : 'as yet unclassified' }
13
14
MFTLogWorkoutPage >> children [
14
15
15
Removed:
^ { workoutComponent }
16
Added:
^ { logWorkoutComponent }
16
17
]
17
18
19
Added:
{ #category : 'initialization' }
20
Added:
MFTLogWorkoutPage >> initialize [
21
Added:
22
Added:
super initialize.
23
Added:
logWorkoutComponent := MFTLogWorkoutComponent new
24
Added:
]
25
Added:
18
26
{ #category : 'rendering' }
19
27
MFTLogWorkoutPage >> renderContentOn: html [
20
28
@@ -22,7 +30,7 @@
22
30
html heading
23
31
level: 1;
24
32
with: 'Log Workout'.
25
Removed:
html render: workoutComponent ]
33
Added:
html render: (logWorkoutComponent workoutLog: workoutLog) ]
26
34
]
27
35
28
36
{ #category : 'accessing' }
@@ -32,13 +40,7 @@
32
40
]
33
41
34
42
{ #category : 'accessing' }
35
Removed:
MFTLogWorkoutPage >> workoutComponent [
43
Added:
MFTLogWorkoutPage >> workoutLog: aMFTWorkoutLog [
36
44
37
Removed:
^ workoutComponent
38
Removed:
]
39
Removed:
40
Removed:
{ #category : 'accessing' }
41
Removed:
MFTLogWorkoutPage >> workoutComponent: aMFTWorkoutComponent [
42
Removed:
43
Removed:
workoutComponent := aMFTWorkoutComponent
45
Added:
workoutLog := aMFTWorkoutLog
44
46
]
src/MyFitnessTracker-Web/MFTRestComponent.class.st
@@ -42,11 +42,11 @@
42
42
html heading
43
43
level: 3;
44
44
with: prescription.
45
Removed:
self renderWorkoutSetsAsTableOn: html ]
45
Added:
self renderWorkoutSetsAsListOn: html ]
46
46
]
47
47
48
48
{ #category : 'as yet unclassified' }
49
Removed:
MFTRestComponent >> renderWorkoutSetsAsTableOn: html [
49
Added:
MFTRestComponent >> renderWorkoutSetsAsListOn: html [
50
50
51
51
html table: [
52
52
html tableHead: [
src/MyFitnessTracker-Web/MFTRoutineComponent.class.st
@@ -34,8 +34,9 @@
34
34
{ #category : 'rendering' }
35
35
MFTRoutineComponent >> renderContentOn: html [
36
36
37
Removed:
html render: routine title.
38
Removed:
workoutComponents do: [ :each | html render: each ]
37
Added:
html
38
Added:
render: routine title;
39
Added:
render: workoutComponents
39
40
]
40
41
41
42
{ #category : 'accessing' }
@@ -49,6 +50,6 @@
49
50
50
51
routine := aMFTRoutine.
51
52
workoutComponents := routine workouts collect: [ :each |
52
Removed:
MFTWorkoutComponent forWorkoutPrescription:
53
Removed:
each ]
53
Added:
MFTLogWorkoutComponent forWorkoutLog:
54
Added:
(MFTWorkoutLog forPrescription: each) ]
54
55
]
src/MyFitnessTracker-Web/MFTStatusComponent.class.st
@@ -15,7 +15,7 @@
15
15
MFTStatusComponent >> renderContentOn: html [
16
16
17
17
html definitionList: [
18
Removed:
html definitionTerm: 'Last workout'.
18
Added:
html definitionTerm: 'Last workout:'.
19
19
html definitionData: (self session user logBook workoutLogs
20
20
ifNotEmpty: [ :workoutLogs |
21
21
| lastLog |
@@ -25,6 +25,6 @@
25
25
, lastLog finish asTime print24 ]
26
26
ifEmpty: [ 'no workout logged' ]).
27
27
28
Removed:
html definitionTerm: 'Recovery completed'.
28
Added:
html definitionTerm: 'Recovery completed:'.
29
29
html definitionData: self session user isRecovered ]
30
30
]
src/MyFitnessTracker-Web/MFTViewWorkoutComponent.class.st
@@ -0,0 +1,70 @@
1
Added:
Class {
2
Added:
#name : 'MFTViewWorkoutComponent',
3
Added:
#superclass : 'WAComponent',
4
Added:
#instVars : [
5
Added:
'workoutLog',
6
Added:
'isLoggable'
7
Added:
],
8
Added:
#category : 'MyFitnessTracker-Web-Components',
9
Added:
#package : 'MyFitnessTracker-Web',
10
Added:
#tag : 'Components'
11
Added:
}
12
Added:
13
Added:
{ #category : 'as yet unclassified' }
14
Added:
MFTViewWorkoutComponent class >> forWorkoutLog: aMFTWorkoutLog [
15
Added:
16
Added:
^ self new
17
Added:
workoutLog: aMFTWorkoutLog;
18
Added:
yourself
19
Added:
]
20
Added:
21
Added:
{ #category : 'accessing' }
22
Added:
MFTViewWorkoutComponent >> beLoggable [
23
Added:
24
Added:
isLoggable := true
25
Added:
]
26
Added:
27
Added:
{ #category : 'initialization' }
28
Added:
MFTViewWorkoutComponent >> initialize [
29
Added:
30
Added:
super initialize.
31
Added:
isLoggable := false
32
Added:
]
33
Added:
34
Added:
{ #category : 'accessing' }
35
Added:
MFTViewWorkoutComponent >> isLoggable [
36
Added:
37
Added:
^ isLoggable
38
Added:
]
39
Added:
40
Added:
{ #category : 'as yet unclassified' }
41
Added:
MFTViewWorkoutComponent >> renderActionsOn: html [
42
Added:
43
Added:
html form: [
44
Added:
html submitButton
45
Added:
callback: [
46
Added:
workoutLog startNow.
47
Added:
self session user logWorkout: workoutLog.
48
Added:
self session pageManager setActivePage:
49
Added:
(MFTLogWorkoutPage new workoutLog: workoutLog) ];
50
Added:
with: 'Log Workout' ]
51
Added:
]
52
Added:
53
Added:
{ #category : 'rendering' }
54
Added:
MFTViewWorkoutComponent >> renderContentOn: html [
55
Added:
56
Added:
html div
57
Added:
class: 'workout-card';
58
Added:
with: [
59
Added:
html heading
60
Added:
level: 3;
61
Added:
with: workoutLog prescription canonicalName.
62
Added:
html render: workoutLog.
63
Added:
isLoggable ifTrue: [ self renderActionsOn: html ] ]
64
Added:
]
65
Added:
66
Added:
{ #category : 'accessing' }
67
Added:
MFTViewWorkoutComponent >> workoutLog: aMFTWorkoutLog [
68
Added:
69
Added:
workoutLog := aMFTWorkoutLog
70
Added:
]
src/MyFitnessTracker-Web/MFTWorkoutComponent.class.st
@@ -1,197 +0,0 @@
1
Removed:
Class {
2
Removed:
#name : 'MFTWorkoutComponent',
3
Removed:
#superclass : 'WAComponent',
4
Removed:
#instVars : [
5
Removed:
'isLoggable',
6
Removed:
'workoutPrescription',
7
Removed:
'workoutLog',
8
Removed:
'isLogging'
9
Removed:
],
10
Removed:
#category : 'MyFitnessTracker-Web-Components',
11
Removed:
#package : 'MyFitnessTracker-Web',
12
Removed:
#tag : 'Components'
13
Removed:
}
14
Removed:
15
Removed:
{ #category : 'as yet unclassified' }
16
Removed:
MFTWorkoutComponent class >> forWorkoutLog: aMFTWorkoutLog [
17
Removed:
18
Removed:
^ self new
19
Removed:
workoutLog: aMFTWorkoutLog;
20
Removed:
workoutPrescription: aMFTWorkoutLog prescription;
21
Removed:
yourself
22
Removed:
]
23
Removed:
24
Removed:
{ #category : 'as yet unclassified' }
25
Removed:
MFTWorkoutComponent class >> forWorkoutPrescription: aMFTWorkoutPrescription [
26
Removed:
27
Removed:
^ self new
28
Removed:
workoutLog:
29
Removed:
(MFTWorkoutLog forPrescription: aMFTWorkoutPrescription);
30
Removed:
workoutPrescription: aMFTWorkoutPrescription;
31
Removed:
yourself
32
Removed:
]
33
Removed:
34
Removed:
{ #category : 'accessing' }
35
Removed:
MFTWorkoutComponent >> beLoggable [
36
Removed:
37
Removed:
isLoggable := true
38
Removed:
]
39
Removed:
40
Removed:
{ #category : 'as yet unclassified' }
41
Removed:
MFTWorkoutComponent >> initialize [
42
Removed:
43
Removed:
super initialize.
44
Removed:
isLoggable := false.
45
Removed:
isLogging := false
46
Removed:
]
47
Removed:
48
Removed:
{ #category : 'accessing' }
49
Removed:
MFTWorkoutComponent >> isLoggable [
50
Removed:
51
Removed:
^ isLoggable
52
Removed:
]
53
Removed:
54
Removed:
{ #category : 'as yet unclassified' }
55
Removed:
MFTWorkoutComponent >> isLogging [
56
Removed:
57
Removed:
isLogging := true
58
Removed:
]
59
Removed:
60
Removed:
{ #category : 'as yet unclassified' }
61
Removed:
MFTWorkoutComponent >> isNotLogging [
62
Removed:
63
Removed:
isLogging := false
64
Removed:
]
65
Removed:
66
Removed:
{ #category : 'as yet unclassified' }
67
Removed:
MFTWorkoutComponent >> renderActionsOn: html [
68
Removed:
69
Removed:
isLoggable ifTrue: [
70
Removed:
html form: [
71
Removed:
isLogging
72
Removed:
ifTrue: [
73
Removed:
html submitButton
74
Removed:
callback: [
75
Removed:
self isNotLogging.
76
Removed:
workoutLog finishNow.
77
Removed:
self session user logWorkout: workoutLog.
78
Removed:
self session pageManager setActivePage: MFTHomePage new ];
79
Removed:
with: 'Save Workout' ]
80
Removed:
ifFalse: [
81
Removed:
html submitButton
82
Removed:
callback: [
83
Removed:
self isLogging.
84
Removed:
workoutLog startNow.
85
Removed:
self session pageManager setActivePage:
86
Removed:
(MFTLogWorkoutPage new workoutComponent: self) ];
87
Removed:
with: 'Log Workout' ] ] ]
88
Removed:
]
89
Removed:
90
Removed:
{ #category : 'rendering' }
91
Removed:
MFTWorkoutComponent >> renderContentOn: html [
92
Removed:
93
Removed:
html div
94
Removed:
class: 'workout-card';
95
Removed:
with: [
96
Removed:
html heading
97
Removed:
level: 3;
98
Removed:
with: workoutPrescription canonicalName.
99
Removed:
workoutLog ifNotNil: [ self renderWorkoutLogDetailsOn: html ].
100
Removed:
isLogging
101
Removed:
ifTrue: [ self renderWorkoutSetsAsFormOn: html ]
102
Removed:
ifFalse: [ self renderWorkoutSetsAsTableOn: html ].
103
Removed:
self renderActionsOn: html ]
104
Removed:
]
105
Removed:
106
Removed:
{ #category : 'rendering' }
107
Removed:
MFTWorkoutComponent >> renderWorkoutLogDetailsOn: html [
108
Removed:
109
Removed:
workoutLog start ifNotNil: [
110
Removed:
html definitionList: [
111
Removed:
html
112
Removed:
definitionTerm: 'Started:';
113
Removed:
definitionData: workoutLog start asDate asString , ' at '
114
Removed:
, workoutLog start asTime print24;
115
Removed:
definitionTerm: 'Duration:';
116
Removed:
definitionData:
117
Removed:
(Duration seconds: workoutLog duration asSeconds rounded)
118
Removed:
humanReadablePrintString ] ]
119
Removed:
]
120
Removed:
121
Removed:
{ #category : 'as yet unclassified' }
122
Removed:
MFTWorkoutComponent >> renderWorkoutSetsAsFormOn: html [
123
Removed:
124
Removed:
html form: [
125
Removed:
workoutPrescription setGroups doWithIndex: [ :setGroupPrescription :i |
126
Removed:
html fieldSet: [
127
Removed:
html legend: setGroupPrescription.
128
Removed:
setGroupPrescription sets doWithIndex: [ :setPrescription :j |
129
Removed:
| uid setLog |
130
Removed:
uid := i asString , '.' , j asString.
131
Removed:
"setLog := workoutLog setForPrescription: setPrescription."
132
Removed:
setLog := MFTSetLog forPrescription: setPrescription.
133
Removed:
html heading
134
Removed:
level: 4;
135
Removed:
with: setPrescription exercise.
136
Removed:
html div
137
Removed:
class: 'exercise-log-container';
138
Removed:
with: [
139
Removed:
html label
140
Removed:
for: 'reps-' , uid;
141
Removed:
with: 'Reps'.
142
Removed:
html numberInput
143
Removed:
id: 'reps-' , uid;
144
Removed:
callback: [ :value | setLog reps: value asNumber ].
145
Removed:
html label
146
Removed:
for: 'load-' , uid;
147
Removed:
with: 'Load'.
148
Removed:
html numberInput
149
Removed:
id: 'load-' , uid;
150
Removed:
callback: [ :value | setLog reps: value asNumber ].
151
Removed:
html label
152
Removed:
for: 'failure-' , uid;
153
Removed:
with: 'Failure reached'.
154
Removed:
html checkbox
155
Removed:
id: 'failure-' , uid;
156
Removed:
callback: [ :value | setLog failureAchieved: value ] ] ] ] ] ]
157
Removed:
]
158
Removed:
159
Removed:
{ #category : 'as yet unclassified' }
160
Removed:
MFTWorkoutComponent >> renderWorkoutSetsAsTableOn: html [
161
Removed:
162
Removed:
html table: [
163
Removed:
html tableHead: [
164
Removed:
html
165
Removed:
tableHeading: 'Set';
166
Removed:
tableHeading: 'Exercise' ].
167
Removed:
html tableBody: [
168
Removed:
workoutPrescription setGroups do: [ :setGroupPrescription |
169
Removed:
html tableRow: [
170
Removed:
html tableData: setGroupPrescription canonicalName.
171
Removed:
html tableData:
172
Removed:
((setGroupPrescription sets collect: #exercise) joinUsing: ', ') ] ] ] ]
173
Removed:
]
174
Removed:
175
Removed:
{ #category : 'accessing' }
176
Removed:
MFTWorkoutComponent >> workoutLog [
177
Removed:
178
Removed:
^ workoutLog
179
Removed:
]
180
Removed:
181
Removed:
{ #category : 'accessing' }
182
Removed:
MFTWorkoutComponent >> workoutLog: aMFTWorkoutLog [
183
Removed:
184
Removed:
workoutLog := aMFTWorkoutLog
185
Removed:
]
186
Removed:
187
Removed:
{ #category : 'accessing' }
188
Removed:
MFTWorkoutComponent >> workoutPrescription [
189
Removed:
190
Removed:
^ workoutPrescription
191
Removed:
]
192
Removed:
193
Removed:
{ #category : 'accessing' }
194
Removed:
MFTWorkoutComponent >> workoutPrescription: aMFTWorkoutPrescription [
195
Removed:
196
Removed:
workoutPrescription := aMFTWorkoutPrescription
197
Removed:
]
src/MyFitnessTracker-Web/MFTWorkoutDetailsComponent.class.st
@@ -0,0 +1,42 @@
1
Added:
Class {
2
Added:
#name : 'MFTWorkoutDetailsComponent',
3
Added:
#superclass : 'WAComponent',
4
Added:
#instVars : [
5
Added:
'workoutLog'
6
Added:
],
7
Added:
#category : 'MyFitnessTracker-Web-Components',
8
Added:
#package : 'MyFitnessTracker-Web',
9
Added:
#tag : 'Components'
10
Added:
}
11
Added:
12
Added:
{ #category : 'as yet unclassified' }
13
Added:
MFTWorkoutDetailsComponent class >> forWorkoutLog: aMFTWorkoutLog [
14
Added:
15
Added:
^ self new
16
Added:
workoutLog: aMFTWorkoutLog;
17
Added:
yourself
18
Added:
]
19
Added:
20
Added:
{ #category : 'rendering' }
21
Added:
MFTWorkoutDetailsComponent >> renderContentOn: html [
22
Added:
23
Added:
html definitionList: [
24
Added:
html
25
Added:
definitionTerm: 'Start time:';
26
Added:
definitionData: workoutLog start asTime print24.
27
Added:
html
28
Added:
definitionTerm: 'Finish time:';
29
Added:
definitionData: workoutLog finish asTime print24 ]
30
Added:
]
31
Added:
32
Added:
{ #category : 'accessing' }
33
Added:
MFTWorkoutDetailsComponent >> workoutLog [
34
Added:
35
Added:
^ workoutLog
36
Added:
]
37
Added:
38
Added:
{ #category : 'accessing' }
39
Added:
MFTWorkoutDetailsComponent >> workoutLog: aMFTWorkoutLog [
40
Added:
41
Added:
workoutLog := aMFTWorkoutLog
42
Added:
]
src/MyFitnessTracker-Web/MFTWorkoutLogBookComponent.class.st
@@ -12,11 +12,11 @@
12
12
{ #category : 'rendering' }
13
13
MFTWorkoutLogBookComponent >> renderContentOn: html [
14
14
15
Added:
html heading
16
Added:
level: 2;
17
Added:
with: 'Workout Logbook'.
15
18
workoutLogBook workoutLogs reverseDo: [ :workoutLog |
16
Removed:
html heading
17
Removed:
level: 2;
18
Removed:
with: 'Workout Logbook'.
19
Removed:
html render: (MFTWorkoutComponent forWorkoutLog: workoutLog) ]
19
Added:
html render: (MFTViewWorkoutComponent forWorkoutLog: workoutLog) ]
20
20
]
21
21
22
22
{ #category : 'accessing' }
src/MyFitnessTracker-Web/MFTWorkoutSetComponent.class.st
@@ -0,0 +1,52 @@
1
Added:
Class {
2
Added:
#name : 'MFTWorkoutSetComponent',
3
Added:
#superclass : 'WAComponent',
4
Added:
#instVars : [
5
Added:
'set',
6
Added:
'isEditing'
7
Added:
],
8
Added:
#category : 'MyFitnessTracker-Web-Components',
9
Added:
#package : 'MyFitnessTracker-Web',
10
Added:
#tag : 'Components'
11
Added:
}
12
Added:
13
Added:
{ #category : 'as yet unclassified' }
14
Added:
MFTWorkoutSetComponent >> beEditing [
15
Added:
16
Added:
isEditing := true
17
Added:
]
18
Added:
19
Added:
{ #category : 'initialization' }
20
Added:
MFTWorkoutSetComponent >> initialize [
21
Added:
22
Added:
super initialize.
23
Added:
isEditing := false
24
Added:
]
25
Added:
26
Added:
{ #category : 'accessing' }
27
Added:
MFTWorkoutSetComponent >> isEditing: aBoolean [
28
Added:
29
Added:
isEditing := aBoolean
30
Added:
]
31
Added:
32
Added:
{ #category : 'rendering' }
33
Added:
MFTWorkoutSetComponent >> renderContentOn: html [
34
Added:
35
Added:
html div: [
36
Added:
html text: set asString.
37
Added:
isEditing
38
Added:
ifTrue: [
39
Added:
html numberInput
40
Added:
callback: [ :value | set reps: value asNumber ];
41
Added:
with: 'Reps'.
42
Added:
html numberInput
43
Added:
callback: [ :value | set load: value asNumber ];
44
Added:
with: 'Load' ]
45
Added:
ifFalse: [ ] ]
46
Added:
]
47
Added:
48
Added:
{ #category : 'accessing' }
49
Added:
MFTWorkoutSetComponent >> set: aMFTWorkoutSet [
50
Added:
51
Added:
set := aMFTWorkoutSet
52
Added:
]
src/MyFitnessTracker-Web/MFTWorkoutSetGroupComponent.class.st
@@ -0,0 +1,49 @@
1
Added:
Class {
2
Added:
#name : 'MFTWorkoutSetGroupComponent',
3
Added:
#superclass : 'WAComponent',
4
Added:
#instVars : [
5
Added:
'setGroup',
6
Added:
'setComponents',
7
Added:
'isEditing'
8
Added:
],
9
Added:
#category : 'MyFitnessTracker-Web-Components',
10
Added:
#package : 'MyFitnessTracker-Web',
11
Added:
#tag : 'Components'
12
Added:
}
13
Added:
14
Added:
{ #category : 'hooks' }
15
Added:
MFTWorkoutSetGroupComponent >> children [
16
Added:
17
Added:
^ setComponents
18
Added:
]
19
Added:
20
Added:
{ #category : 'hooks' }
21
Added:
MFTWorkoutSetGroupComponent >> initialize [
22
Added:
23
Added:
super initialize.
24
Added:
isEditing := false.
25
Added:
setComponents := OrderedCollection new
26
Added:
]
27
Added:
28
Added:
{ #category : 'rendering' }
29
Added:
MFTWorkoutSetGroupComponent >> renderContentOn: html [
30
Added:
31
Added:
setComponents := setGroup sets collect: [ :each |
32
Added:
MFTWorkoutSetComponent new set: each ].
33
Added:
html form: [
34
Added:
html heading
35
Added:
level: 4;
36
Added:
with: setGroup asString asUppercase.
37
Added:
html render: setComponents.
38
Added:
html submitButton
39
Added:
callback: [
40
Added:
isEditing := true.
41
Added:
setComponents do: #beEditing ];
42
Added:
with: 'Log' ]
43
Added:
]
44
Added:
45
Added:
{ #category : 'accessing' }
46
Added:
MFTWorkoutSetGroupComponent >> setGroup: anObject [
47
Added:
48
Added:
setGroup := anObject
49
Added:
]