Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ContentItemPresenter re-models the response from content store. #4409

Open
leenagupte opened this issue Nov 18, 2024 · 0 comments
Open

ContentItemPresenter re-models the response from content store. #4409

leenagupte opened this issue Nov 18, 2024 · 0 comments

Comments

@leenagupte
Copy link
Contributor

At the moment the response from content store is being modelled in two places:

  1. ContentItem model - This is a new model added to allow the creation of subclasses of ContentItem based on the document_type, that would then allow document_type specific behaviour to be modelled.
  2. ContentItemPresenter - This takes a content item hash and models it.

Ideally ContentItemPresenter should take an instance of the ContentItem model and add presentation code on top of it.

The move of Travel Advice country pages from government-frontend has highlighted the issues with the presenters. A page_title method needed to be added to the presenter. The page_title is reliant on the withdrawn status of the content item to determine how to build the title. The withdrawn status was added to the ContentItem model, but this meant that it wasn't accessible to the presenter without either duplicating the modelling code in the presenter or creating a new presenter. The second option was chosen as a stop-gap until the presenter logic is updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant