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

Model organisations #4653

Merged
merged 9 commits into from
Mar 3, 2025
Merged

Model organisations #4653

merged 9 commits into from
Mar 3, 2025

Conversation

leenagupte
Copy link
Contributor

@leenagupte leenagupte commented Feb 20, 2025

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

What

Many of the document types like Case studies, Speeches, Corporate Information pages that need to be moved from government-frontend to frontend as part of app consolidation render Organisations.The idea is to create an organisation model that inherits from content item. but could then be reused when organisation pages are consolidated.

Why

By modelling organisations separately this will make consolidation easier, and also in preparation for consolidating organisations from the Collections app.

Trello card

Collaborators

Deborah Chua deborah.chua@digital.cabinet-office.gov.uk
Leena Gupte leena.gupte@digital.cabinet-office.gov.uk
Keith Lawrence keith.lawrence@digital.cabinet-office.gov.uk
Ramya Vidapanakalramya.vidapanakal@digital.cabinet-office.gov.uk

@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4653 February 20, 2025 16:56 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4653 February 20, 2025 17:24 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4653 February 21, 2025 10:24 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4653 February 21, 2025 10:25 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4653 February 21, 2025 10:26 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4653 February 21, 2025 10:29 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4653 February 21, 2025 10:30 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4653 February 21, 2025 10:31 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4653 February 21, 2025 10:35 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4653 February 21, 2025 10:36 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4653 February 21, 2025 10:44 Inactive
@leenagupte leenagupte changed the title Model organisations [WIP] Model organisations Feb 21, 2025
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4653 February 21, 2025 10:47 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4653 February 21, 2025 10:54 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4653 February 21, 2025 11:33 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4653 February 21, 2025 11:51 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4653 February 27, 2025 15:44 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4653 February 27, 2025 15:49 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4653 February 27, 2025 15:58 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4653 February 27, 2025 16:20 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4653 February 27, 2025 16:32 Inactive
@sairamya93 sairamya93 changed the title [WIP] Model organisations Model organisations Feb 27, 2025
@sairamya93 sairamya93 marked this pull request as ready for review February 27, 2025 16:41
@sairamya93 sairamya93 requested a review from KludgeKML February 27, 2025 16:42
Copy link
Contributor Author

@leenagupte leenagupte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great. Thanks for organising the commits.

One minor thing. I think the commit to add "content_id" to ContentItem should come before "Rename Organisations concern -> EmphasisedOrganisations" as that's where it's being used.

deborahchua and others added 2 commits March 3, 2025 10:24
- Added image,crest and formatted title to the logo model
- This model will be used in the organisation model
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.

Added logo and brand to organisation model in preparation for moving corporate information pages from government-frontend

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>
@sairamya93 sairamya93 force-pushed the model-organisations branch from bf746ba to 1acd947 Compare March 3, 2025 10:25
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4653 March 3, 2025 10:25 Inactive
Copy link
Contributor

@KludgeKML KludgeKML left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

KludgeKML and others added 7 commits March 3, 2025 11:44
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>
This allows us to simplify how the contributors list is built. We
should only need to create the contributors 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  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.

Even 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>
The contributors method now passes a list of emphasised organisations
objects and worldwide organisations object to the parent class
contributors method.

Since worldwide organisations are not always present, add a test for
them, which also adds coverage to the private linked method in
content_item.

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>
We now model organisations separately, so this concern can be updated to deal with emphasised organisations.
Updated the emphasised organisations test to check that the first
organisation is an emphasised 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>
…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>
We call the linked method in the content_item model which returns the title and base path

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>
@KludgeKML KludgeKML force-pushed the model-organisations branch from 1acd947 to 4bc7fa8 Compare March 3, 2025 11:45
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4653 March 3, 2025 11:45 Inactive
@leenagupte
Copy link
Contributor Author

LGTM 👍

@KludgeKML KludgeKML merged commit c31c82b into main Mar 3, 2025
13 checks passed
@KludgeKML KludgeKML deleted the model-organisations branch March 3, 2025 12:02
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