[Pharo] Personal fitness tracker web app.
Updated set groups form component.
src/MyFitnessTracker/MFTSetGroupsFormComponent.class.st
@@ -7,33 +7,14 @@
7
7
}
8
8
9
9
{ #category : 'adding' }
10
Removed:
MFTSetGroupsFormComponent >> addExercise [
10
Added:
MFTSetGroupsFormComponent >> addSetGroupsForExerciseCount: anInteger [
11
11
12
Removed:
| setGroup |
13
Removed:
setGroup := self session pageManager activePage call:
14
Removed:
(MFTSetGroupDialog new heading: 'Exercise').
15
Removed:
setGroup ifNotNil: [ modelObject add: setGroup ]
12
Added:
| setGroups |
13
Added:
setGroups := self session pageManager activePage call:
14
Added:
(MFTSetGroupsTask forExerciseCount: anInteger).
15
Added:
setGroups ifNotNil: [ modelObject addSetGroups: setGroups ]
16
16
]
17
17
18
Removed:
{ #category : 'adding' }
19
Removed:
MFTSetGroupsFormComponent >> addSetGroupForExerciseCount: anInteger [
20
Removed:
21
Removed:
| setGroup |
22
Removed:
setGroup := self session pageManager activePage call:
23
Removed:
(MFTSetGroupTask forExerciseCount: anInteger).
24
Removed:
setGroup ifNotNil: [ setGroups add: setGroup ]
25
Removed:
]
26
Removed:
27
Removed:
{ #category : 'rendering' }
28
Removed:
MFTSetGroupsFormComponent >> editSetGroup: aMFTSetGroup [
29
Removed:
30
Removed:
| oldSetGroup newSetGroup |
31
Removed:
oldSetGroup := aMFTSetGroup.
32
Removed:
newSetGroup := self call: (MFTSetGroupDialog edit: aMFTSetGroup copy).
33
Removed:
newSetGroup ifNotNil: [
34
Removed:
setGroups at: (setGroups indexOf: oldSetGroup) put: newSetGroup ]
35
Removed:
]
36
Removed:
37
18
{ #category : 'initialization' }
38
19
MFTSetGroupsFormComponent >> initialize [
39
20
@@ -42,122 +23,41 @@
42
23
]
43
24
44
25
{ #category : 'rendering' }
45
Removed:
MFTSetGroupsFormComponent >> renderAddSetGroupButtonsOn: html [
26
Added:
MFTSetGroupsFormComponent >> renderContentOn: html [
46
27
28
Added:
self renderFormComponentOn: html with: [
29
Added:
modelObject setGroups ifNotEmpty: [
30
Added:
modelObject renderSetGroupsTableOn: html ].
31
Added:
self renderSetGroupButtonsOn: html ]
32
Added:
]
33
Added:
34
Added:
{ #category : 'rendering' }
35
Added:
MFTSetGroupsFormComponent >> renderSetGroupButtonsOn: html [
36
Added:
47
37
html buttonGroup: [
48
38
html outlineButton
49
39
bePrimary;
50
40
beSmall;
51
Removed:
callback: [ self addSetGroupForExerciseCount: 1 ];
41
Added:
callback: [ self addSetGroupsForExerciseCount: 1 ];
52
42
with: 'Add exercise'.
53
43
html outlineButton
54
44
beSecondary;
55
45
beSmall;
56
Removed:
callback: [ self addSetGroupForExerciseCount: 2 ];
46
Added:
callback: [ self addSetGroupsForExerciseCount: 2 ];
57
47
with: 'Add superset'.
58
48
html outlineButton
59
49
beSecondary;
60
50
beSmall;
61
Removed:
callback: [ self addSetGroupForExerciseCount: 3 ];
51
Added:
callback: [ self addSetGroupsForExerciseCount: 3 ];
62
52
with: 'Add tri-set'.
63
53
html outlineButton
64
54
beSecondary;
65
55
beSmall;
66
Removed:
callback: [ self addSetGroupForExerciseCount: 4 ];
67
Removed:
with: 'Add giant set' ]
68
Removed:
]
69
Removed:
70
Removed:
{ #category : 'rendering' }
71
Removed:
MFTSetGroupsFormComponent >> renderContentOn: html [
72
Removed:
73
Removed:
self renderFormComponentOn: html with: [
74
Removed:
modelObject setGroups ifNotEmpty: [ self renderSetGroupsTableOn: html ].
75
Removed:
self renderAddSetGroupButtonsOn: html ]
76
Removed:
]
77
Removed:
78
Removed:
{ #category : 'rendering' }
79
Removed:
MFTSetGroupsFormComponent >> renderLoad [
80
Removed:
81
Removed:
^ (modelObject setGroups flatCollect: #sets) anySatisfy: #hasLoad
82
Removed:
]
83
Removed:
84
Removed:
{ #category : 'rendering' }
85
Removed:
MFTSetGroupsFormComponent >> renderRestAfter [
86
Removed:
87
Removed:
^ (modelObject setGroups flatCollect: #sets) anySatisfy: #hasRestAfter
88
Removed:
]
89
Removed:
90
Removed:
{ #category : 'rendering' }
91
Removed:
MFTSetGroupsFormComponent >> renderRpe [
92
Removed:
93
Removed:
^ (modelObject setGroups flatCollect: #sets) anySatisfy: #hasRpe
94
Removed:
]
95
Removed:
96
Removed:
{ #category : 'rendering' }
97
Removed:
MFTSetGroupsFormComponent >> renderSetGroupButtonsOn: html For: setGroup [
98
Removed:
99
Removed:
html buttonGroupVertical: [
56
Added:
callback: [ self addSetGroupsForExerciseCount: 4 ];
57
Added:
with: 'Add giant set'.
100
58
html outlineButton
101
59
beDanger;
102
60
beSmall;
103
Removed:
callback: [ modelObject setGroups remove: setGroup ];
104
Removed:
with: 'Remove'.
105
Removed:
html outlineButton
106
Removed:
beSecondary;
107
Removed:
beSmall;
108
Removed:
callback: [ self editSetGroup: setGroup ];
109
Removed:
with: 'Edit'.
110
Removed:
html outlineButton
111
Removed:
beSecondary;
112
Removed:
beSmall;
113
Removed:
callback: [
114
Removed:
modelObject setGroups
115
Removed:
add: setGroup
116
Removed:
afterIndex: (modelObject setGroups indexOf: setGroup) ];
117
Removed:
with: 'Duplicate' ]
118
Removed:
]
119
Removed:
120
Removed:
{ #category : 'rendering' }
121
Removed:
MFTSetGroupsFormComponent >> renderSetGroupsRowsOn: html [
122
Removed:
123
Removed:
| renderLoad renderRpe renderRestAfter |
124
Removed:
renderLoad := self renderLoad.
125
Removed:
renderRpe := self renderRpe.
126
Removed:
renderRestAfter := self renderRestAfter.
127
Removed:
modelObject setGroups do: [ :setGroup |
128
Removed:
html tableRow with: [
129
Removed:
html tableData
130
Removed:
attributeAt: 'rowspan' put: setGroup sets size + 1;
131
Removed:
style: 'vertical-align: middle';
132
Removed:
with: [ self renderSetGroupButtonsOn: html For: setGroup ] ].
133
Removed:
setGroup sets do: [ :set |
134
Removed:
html tableRow: [
135
Removed:
html tableData: set exercise englishName.
136
Removed:
html tableData: set reps.
137
Removed:
setGroup hasLoad ifTrue: [ html tableData: set load ].
138
Removed:
setGroup hasRpe ifTrue: [ html tableData: set rpe ].
139
Removed:
setGroup hasRestAfter ifTrue: [ html tableData: set restAfter ] ] ] ]
140
Removed:
]
141
Removed:
142
Removed:
{ #category : 'rendering' }
143
Removed:
MFTSetGroupsFormComponent >> renderSetGroupsTableHeaderOn: html [
144
Removed:
145
Removed:
html tableHead: [
146
Removed:
html
147
Removed:
tableHeading;
148
Removed:
tableHeading: 'Exercise';
149
Removed:
tableHeading: 'Reps'.
150
Removed:
self renderLoad ifTrue: [ html tableHeading: 'Load' ].
151
Removed:
self renderRpe ifTrue: [ html tableHeading: 'RPE' ].
152
Removed:
self renderRestAfter ifTrue: [ html tableHeading: 'Rest after (s) ' ] ]
153
Removed:
]
154
Removed:
155
Removed:
{ #category : 'rendering' }
156
Removed:
MFTSetGroupsFormComponent >> renderSetGroupsTableOn: html [
157
Removed:
158
Removed:
html table
159
Removed:
class: 'table table-bordered';
160
Removed:
with: [
161
Removed:
self renderSetGroupsTableHeaderOn: html.
162
Removed:
self renderSetGroupsRowsOn: html ]
61
Added:
callback: [ modelObject setGroups removeAll ];
62
Added:
with: 'Remove all' ]
163
63
]