gtoolkit
gtoolkit copied to clipboard
LePageViewModel Creation Should Delegate to Page Type
What: Delegate creation to the page type (or at least the page). Why: This would make it very easy for custom page types to supply their own pageViewModel class.
I know custom Lepiter pages are not a high priority right now for the team, but this will take ~10 minutes. I would do it myself if not for the contribution morass...
There is:
LePage>>#asContentUIModel
<return: #LeContentViewModel>
^ LePageViewModel new pageModel: self
But there are many (maybe ~ 30) places where this logic is duplicated:

This makes it extremely hard and brittle to customize pages.
All code like this:
LePageViewModel new
pageModel: self page
Should at least be rewritten as:
page asContentUIModel
It would be ideal to also modify to:
LePage>>#asContentUIModel
^ self type pageViewModelClass new pageModel: self
PRs tied to https://github.com/feenkcom/gtoolkit/issues/4167 currently do not address this.