View raw

1 Class { 2 #name : 'MFTWorkoutPrescriptionTable', 3 #superclass : 'WAComponent', 4 #instVars : [ 5 'workoutPrescription' 6 ], 7 #category : 'MyFitnessTracker-Web-Components', 8 #package : 'MyFitnessTracker-Web', 9 #tag : 'Components' 10 } 11 12 { #category : 'accessing' } 13 MFTWorkoutPrescriptionTable class >> forPrescription: aMFTWorkoutPrescription [ 14 15 ^ self new 16 workoutPrescription: aMFTWorkoutPrescription; 17 yourself 18 ] 19 20 { #category : 'rendering' } 21 MFTWorkoutPrescriptionTable >> renderContentOn: html [ 22 23 html table 24 style: 'max-width: 30rem'; 25 with: [ 26 html 27 tableHead: [ 28 html 29 tableHeading; 30 tableHeading: 'Set'; 31 tableHeading: 'Exercise' ]; 32 tableBody: [ 33 workoutPrescription setGroups doWithIndex: [ :setGroup :setGroupIdx | 34 html tableRow: [ 35 html tableData 36 attributeAt: 'rowspan' put: setGroup sets size + 1; 37 with: setGroupIdx. 38 html tableData 39 attributeAt: 'rowspan' put: setGroup sets size + 1; 40 with: setGroup canonicalName capitalized ]. 41 setGroup uniqueExercisesInSets do: [ :exercise | 42 html tableRow: [ 43 html tableData: exercise canonicalName capitalized ] ] ] ] ] 44 ] 45 46 { #category : 'accessing' } 47 MFTWorkoutPrescriptionTable >> workoutPrescription: aMFTWorkoutPrescription [ 48 49 workoutPrescription := aMFTWorkoutPrescription 50 ] 51