Add ability to set a default brand for organisation#2935
Open
theseanything wants to merge 6 commits into
Open
Conversation
theseanything
marked this pull request as ready for review
July 15, 2026 12:03
Organisations can have several available brands, but there is no way to say which brand new forms in the organisation should start with, so every form starts with GOV.UK branding until someone changes it. Add a nullable default_brand_id foreign key to organisations, with a validation that the default brand must be one of the organisation's available brands. The validation only runs when the default brand is changing, so the nightly organisation sync cannot fail on unrelated updates. A nil default means GOV.UK branding.
The organisation's default brand will be applied to new forms created in the organisation's groups. There is no way to set it yet. Add a default-brand route nested under organisations, handled by an update_default action on the organisation brands controller and restricted to super admins by the existing policy. Setting the default with no brand ID clears it, which means new forms use GOV.UK branding. A brand that is not one of the organisation's available brands returns a 404, matching how removing an unknown brand behaves.
Removing the default brand from an organisation's available brands would leave the default pointing at a brand the organisation can no longer use. Refuse to destroy the organisation brand when it is the current default and redirect back to the organisation page. The remove button will be disabled in the interface for the default brand, so this guard only protects against crafted requests.
Super admins need a way to choose which of an organisation's available brands new forms should start with. Add a permanent GOV.UK row to the available brands table and tag the current default brand, or GOV.UK when no default is set. Each other row has a make default button, and the remove button is disabled for the current default. Making GOV.UK the default clears the setting, so there is no separate action to unset it. The table now always renders because the GOV.UK row is always present.
Setting a default brand on an organisation has no effect until new forms pick it up. Set the form's brand to the organisation's default brand slug when creating a form, but only in groups with custom branding enabled, so that forms never get a brand their editors cannot see or change. The branding task list item still lets editors change or remove the brand on each form.
The make default and remove buttons each rendered in their own block-level form with the standard button bottom margin, so they stacked vertically and made the available brands table rows very tall. Place the pair of buttons in a button group so they sit side by side, and remove the bottom margin from all of the action buttons so the rows stay compact.
theseanything
force-pushed
the
add-organisation-default-brand
branch
from
July 15, 2026 12:23
9fc6641 to
a7c238d
Compare
|
🎉 A review copy of this PR has been deployed! You can reach it at: https://pr-2935.admin.review.forms.service.gov.uk/ It may take 5 minutes or so for the application to be fully deployed and working. If it still isn't ready For the sign in details and more information, see the review apps wiki page. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Lets super admins set a default brand for an organisation, from the available brands section on the organisation page.
New forms created in the organisation's groups start with that brand, as long as the group has custom branding enabled.
People editing a form can still change/override the brand using the existing branding task list item.
The interface prevents people removing a brand from available brand if its set at the default.
Screenshots