Class { #name : 'MFTWorkoutPrescriptionTable', #superclass : 'WAComponent', #instVars : [ 'workoutPrescription' ], #category : 'MyFitnessTracker-Web-Components', #package : 'MyFitnessTracker-Web', #tag : 'Components' } { #category : 'accessing' } MFTWorkoutPrescriptionTable class >> forPrescription: aMFTWorkoutPrescription [ ^ self new workoutPrescription: aMFTWorkoutPrescription; yourself ] { #category : 'rendering' } MFTWorkoutPrescriptionTable >> renderContentOn: html [ html table style: 'max-width: 30rem'; with: [ html tableHead: [ html tableHeading; tableHeading: 'Set'; tableHeading: 'Exercise' ]; tableBody: [ workoutPrescription setGroups doWithIndex: [ :setGroup :setGroupIdx | html tableRow: [ html tableData attributeAt: 'rowspan' put: setGroup sets size + 1; with: setGroupIdx. html tableData attributeAt: 'rowspan' put: setGroup sets size + 1; with: setGroup canonicalName capitalized ]. setGroup uniqueExercisesInSets do: [ :exercise | html tableRow: [ html tableData: exercise canonicalName capitalized ] ] ] ] ] ] { #category : 'accessing' } MFTWorkoutPrescriptionTable >> workoutPrescription: aMFTWorkoutPrescription [ workoutPrescription := aMFTWorkoutPrescription ]