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

[WIP] Model organisation backup #4663

Closed
wants to merge 21 commits into from
Closed

Conversation

leenagupte
Copy link
Contributor

⚠️ This repo is Continuously Deployed: make sure you follow the guidance ⚠️

What

Why

Trello card?

How

Screenshots?

KludgeKML and others added 21 commits February 21, 2025 11:49
The Organisation model will be used to model the organisation links
in a ContentItem as well as eventually be used to render the
organisation page itself when it is moved from collections.

We're using OpenStruct to model logo since it gives us a light model and
we don't need to attach any code to it.

Co-authored-by: Deborah Chua <deborah.chua@digital.cabinet-office.gov.uk>
Co-authored-by: Leena Gupte <leena.gupte@digital.cabinet-office.gov.uk>
Co-authored-by: Keith Lawrence <keith.lawrence@digital.cabinet-office.gov.uk>
Co-authored-by: Ramya Vidapanakal<ramya.vidapanakal@digital.cabinet-office.gov.uk>
Co-authored-by: Deborah Chua <deborah.chua@digital.cabinet-office.gov.uk>
Co-authored-by: Leena Gupte <leena.gupte@digital.cabinet-office.gov.uk>
Co-authored-by: Keith Lawrence <keith.lawrence@digital.cabinet-office.gov.uk>
Co-authored-by: Ramya Vidapanakal<ramya.vidapanakal@digital.cabinet-office.gov.uk>
- add test
- organisations method relies on a private method that gets and models links. Almost all content items have organisations, so we are safe to add that utility method.

Co-authored-by: Deborah Chua <deborah.chua@digital.cabinet-office.gov.uk>
Co-authored-by: Leena Gupte <leena.gupte@digital.cabinet-office.gov.uk>
Co-authored-by: Keith Lawrence <keith.lawrence@digital.cabinet-office.gov.uk>
Co-authored-by: Ramya Vidapanakal<ramya.vidapanakal@digital.cabinet-office.gov.uk>
Co-authored-by: Deborah Chua <deborah.chua@digital.cabinet-office.gov.uk>
Co-authored-by: Leena Gupte <leena.gupte@digital.cabinet-office.gov.uk>
Co-authored-by: Keith Lawrence <keith.lawrence@digital.cabinet-office.gov.uk>
Co-authored-by: Ramya Vidapanakal<ramya.vidapanakal@digital.cabinet-office.gov.uk>
- test uses examples
- code maps Organisation models to hash

Co-authored-by: Deborah Chua <deborah.chua@digital.cabinet-office.gov.uk>
Co-authored-by: Leena Gupte <leena.gupte@digital.cabinet-office.gov.uk>
Co-authored-by: Keith Lawrence <keith.lawrence@digital.cabinet-office.gov.uk>
Co-authored-by: Ramya Vidapanakal<ramya.vidapanakal@digital.cabinet-office.gov.uk>
Co-authored-by: Deborah Chua <deborah.chua@digital.cabinet-office.gov.uk>
Co-authored-by: Leena Gupte <leena.gupte@digital.cabinet-office.gov.uk>
Co-authored-by: Keith Lawrence <keith.lawrence@digital.cabinet-office.gov.uk>
Co-authored-by: Ramya Vidapanakal<ramya.vidapanakal@digital.cabinet-office.gov.uk>
…lude in CaseStudy explicitly

Co-authored-by: Deborah Chua <deborah.chua@digital.cabinet-office.gov.uk>
Co-authored-by: Leena Gupte <leena.gupte@digital.cabinet-office.gov.uk>
Co-authored-by: Keith Lawrence <keith.lawrence@digital.cabinet-office.gov.uk>
Co-authored-by: Ramya Vidapanakal<ramya.vidapanakal@digital.cabinet-office.gov.uk>
Co-authored-by: Deborah Chua <deborah.chua@digital.cabinet-office.gov.uk>
Co-authored-by: Leena Gupte <leena.gupte@digital.cabinet-office.gov.uk>
Co-authored-by: Keith Lawrence <keith.lawrence@digital.cabinet-office.gov.uk>
Co-authored-by: Ramya Vidapanakal<ramya.vidapanakal@digital.cabinet-office.gov.uk>
Co-authored-by: Deborah Chua <deborah.chua@digital.cabinet-office.gov.uk>
Co-authored-by: Leena Gupte <leena.gupte@digital.cabinet-office.gov.uk>
Co-authored-by: Keith Lawrence <keith.lawrence@digital.cabinet-office.gov.uk>
Co-authored-by: Ramya Vidapanakal<ramya.vidapanakal@digital.cabinet-office.gov.uk>
This allows us to simplify how the contributors list is built. We
should only need to create the contributors has once by passing it a
list of link models rather than duplicating the mapping code in all
of the content item models.

The idea is that each contributors method in the child class will pass
the contributors method in the parent ContentItem class as list of
objects. For example for CaseStudy, that would be a list of modelled
Organisation and Worldwide Organisation objects. This
is the `content_items` list that is passed in. It still defaults
to "organisations" as that is the bare minimum that appears in the
"From" field on documents that this contributors method is used to
populate.

Event though the list of content items can be different, as they all
inherit from ContentItem, we know that they will have a title and
base_path, so can be processed in the same way.

Co-authored-by: Deborah Chua <deborah.chua@digital.cabinet-office.gov.uk>
Co-authored-by: Leena Gupte <leena.gupte@digital.cabinet-office.gov.uk>
Co-authored-by: Keith Lawrence <keith.lawrence@digital.cabinet-office.gov.uk>
Co-authored-by: Ramya Vidapanakal<ramya.vidapanakal@digital.cabinet-office.gov.uk>
Updates the emphasised organisations test to check the that first
organisation in a list of organisation models.

Co-authored-by: Deborah Chua <deborah.chua@digital.cabinet-office.gov.uk>
Co-authored-by: Leena Gupte <leena.gupte@digital.cabinet-office.gov.uk>
Co-authored-by: Keith Lawrence <keith.lawrence@digital.cabinet-office.gov.uk>
Co-authored-by: Ramya Vidapanakal<ramya.vidapanakal@digital.cabinet-office.gov.uk>
Co-authored-by: Deborah Chua <deborah.chua@digital.cabinet-office.gov.uk>
Co-authored-by: Leena Gupte <leena.gupte@digital.cabinet-office.gov.uk>
Co-authored-by: Keith Lawrence <keith.lawrence@digital.cabinet-office.gov.uk>
Co-authored-by: Ramya Vidapanakal<ramya.vidapanakal@digital.cabinet-office.gov.uk>
The contributors method now passes a list of emphasised organisations
objects and worldwide organisations object to the parent class
contributors method.

Co-authored-by: Deborah Chua <deborah.chua@digital.cabinet-office.gov.uk>
Co-authored-by: Leena Gupte <leena.gupte@digital.cabinet-office.gov.uk>
Co-authored-by: Keith Lawrence <keith.lawrence@digital.cabinet-office.gov.uk>
Co-authored-by: Ramya Vidapanakal<ramya.vidapanakal@digital.cabinet-office.gov.uk>
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4663 February 27, 2025 11:32 Inactive
@KludgeKML
Copy link
Contributor

Main branch merged in

@KludgeKML KludgeKML closed this Mar 3, 2025
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

Successfully merging this pull request may close these issues.

5 participants