Make election styling configurable by adding nomination kinds#3030
Merged
Conversation
Inject a per-election accent color (from the election's kind) into the nominations templates via a shared _theme.html partial, so Board vs. Packaging Council pages are visually distinct. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Covers ElectionKind slug generation, Election.accent_color resolution (kind set, no kind, kind deleted via SET_NULL), and that the election detail page renders the accent color from its kind. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds an admin-managed “election kind” concept to the nominations app so different election categories (e.g., Board vs. Packaging Council) can carry their own accent color and be visually themed consistently across election/nomination/nominee pages.
Changes:
- Introduces
ElectionKind(withaccent_color+ generatedslug) and linksElection.kindto it. - Adds
Election.accent_colorconvenience property and a reusable_theme.htmltemplate partial to apply per-election theming. - Adds admin UI support for managing kinds and updates/extends test coverage for theming + model behavior.
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| apps/nominations/models.py | Adds ElectionKind, Election.kind FK, DEFAULT_ACCENT_COLOR, and Election.accent_color property. |
| apps/nominations/migrations/0003_election_kind.py | Creates ElectionKind table and adds Election.kind field. |
| apps/nominations/admin.py | Registers ElectionKind in admin; enhances ElectionAdmin list display/filtering for kind. |
| apps/nominations/templates/nominations/_theme.html | New shared template partial that emits per-election CSS variables/styles. |
| apps/nominations/templates/nominations/election_detail.html | Includes _theme.html in the head to apply election theming. |
| apps/nominations/templates/nominations/nominee_list.html | Includes _theme.html in the head for themed nominee list pages. |
| apps/nominations/templates/nominations/nominee_detail.html | Includes _theme.html in the head for themed nominee detail pages. |
| apps/nominations/templates/nominations/nomination_form.html | Includes _theme.html in the head for themed nomination create/edit pages. |
| apps/nominations/templates/nominations/nomination_detail.html | Includes _theme.html (explicitly passing nomination.election). |
| apps/nominations/templates/nominations/nomination_accept_form.html | Includes _theme.html in the head for themed nomination accept pages. |
| apps/nominations/tests/test_models.py | Adds tests for ElectionKind slug/accent defaults and Election.accent_color behavior. |
| apps/nominations/tests/test_views.py | Adds view-level tests asserting themed CSS output and default fallback behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Uh oh!
There was an error while loading. Please reload this page.