Class { #name : 'MFTPlanEditorPage', #superclass : 'MFTPage', #instVars : [ 'routine', 'tmp' ], #category : 'MyFitnessTracker-Web-Components', #package : 'MyFitnessTracker-Web', #tag : 'Components' } { #category : 'as yet unclassified' } MFTPlanEditorPage class >> forRoutine: aMFTRoutine [ ^ self new routine: aMFTRoutine; yourself ] { #category : 'rendering' } MFTPlanEditorPage >> renderContentOn: html [ html heading level: 1; with: 'Edit routine'. html form: [ html heading: tmp. html button callback: [ tmp := self request: 'Change the title' ]; with: 'foo'. html textInput value: routine title; placeholder: 'Routine title'; callback: [ :value | routine title: value ]. html horizontalRule. routine workouts do: [ :workoutPrescription | self renderWorkoutPrescription: workoutPrescription on: html. html horizontalRule ]. html button class: 'outline'; callback: [ routine addWorkout: MFTWorkoutPrescription new ]; with: 'Add workout'. html div class: 'grid'; with: [ html submitButton callback: [ self answer: routine ]; with: 'Save plan'. html submitButton class: 'secondary'; callback: [ self answer ]; with: 'Cancel' ] ] ] { #category : 'rendering' } MFTPlanEditorPage >> renderWorkoutPrescription: aMFTWorkoutPrescription on: html [ html div: [ html fieldSet attributeAt: 'role' put: 'group'; with: [ html textInput value: aMFTWorkoutPrescription title; placeholder: 'New workout title'; callback: [ :value | aMFTWorkoutPrescription title: value asString ]; with: aMFTWorkoutPrescription canonicalName. html button class: 'outline'; callback: [ routine removeWorkout: aMFTWorkoutPrescription ]; with: 'Delete' ]. aMFTWorkoutPrescription setGroups do: [ :setGroupPrescription | html div class: 'grid'; with: [ html heading level: 3; with: setGroupPrescription canonicalName. html button class: 'outline'; callback: [ aMFTWorkoutPrescription removeSetGroup: setGroupPrescription ]; with: 'Delete' ] ]. html div class: 'grid'; with: [ html button class: 'outline'; callback: [ aMFTWorkoutPrescription addSetGroup: MFTStraightSetGroupPrescription new ]; with: 'Add straight set'. html button class: 'outline'; callback: [ aMFTWorkoutPrescription addSetGroup: MFTSupersetGroupPrescription new ]; with: 'Add superset' ] ] ] { #category : 'accessing' } MFTPlanEditorPage >> routine: aMFTRoutine [ routine := aMFTRoutine ] { #category : 'accessing' } MFTPlanEditorPage >> title [ ^ 'Edit plan' ]