Stop duplicating common html page data
Issue #412
resolved
Whenever we write code for a new page for VidGrind, we copy all the fields from the pagedata struct for all the commonly used fields. We should structure it so that we don’t have to copy over the fields but instead we only add the fields for data specific to the new page.
This is done in preparation for adding the sitemenu to all pages, as I would have had to add a User slice to each page handler’s data.
Comments (3)
-
-
reporter Ah yes! That would be a better way.
-
reporter - changed status to resolved
Resolved in PR #431
- Log in to comment
We should use struct embedding which, AFAIK, is the preferred approach in Go.
So we define our commonPagedata (i.e, what is now pagedata), then embed it on other pages.