gtoolkit icon indicating copy to clipboard operation
gtoolkit copied to clipboard

LePageViewModel Creation Should Delegate to Page Type

Open seandenigris opened this issue 4 years ago • 1 comments

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: Screen Shot 2022-02-10 at 8 52 07 PM

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

seandenigris avatar Feb 11 '22 02:02 seandenigris

PRs tied to https://github.com/feenkcom/gtoolkit/issues/4167 currently do not address this.

botwhytho avatar Apr 30 '25 19:04 botwhytho