Search: Add breadcrumbs to search results in order to provide more context#2282
Search: Add breadcrumbs to search results in order to provide more context#2282Tschuppi81 merged 78 commits intomasterfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files
... and 5 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
|
Not sure if the breadcrumbs color in search shall be |
There was a problem hiding this comment.
Pull request overview
This pull request adds breadcrumb navigation to search results for various content types (Topics, News, People, Files, Tickets, Events, Directory Entries, etc.) to provide better context when viewing search results. The implementation includes:
Changes:
- Renamed
PageLayouttoTopicLayoutthroughout the codebase for clarity - Added a new
get_layout()method to the request object to retrieve layouts for model instances - Implemented a layout registry system via a new
Layoutdirective - Updated search result templates to display breadcrumbs for various content types
- Added breadcrumb styling and fixed CSS issues related to z-index stacking
- Added file ID anchors and highlight styling for targeted files
- Updated test selectors to use regex anchors for more precise matching
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/onegov/winterthur/test_search.py | Updated click selectors to use regex anchors for precise matching |
| tests/onegov/town6/test_views_directory.py | Updated click selectors to use regex anchors for precise matching |
| tests/onegov/org/test_views_ticket.py | Updated click selectors to use regex anchors for precise matching |
| tests/onegov/org/test_views_directory.py | Updated click selectors to use regex anchors for precise matching |
| tests/onegov/org/test_layout.py | Updated imports from PageLayout to TopicLayout |
| src/onegov/town6/theme/styles/town6.scss | Added z-index reset for breadcrumb links |
| src/onegov/town6/theme/styles/search.scss | Added breadcrumb styling and updated search preview styles |
| src/onegov/town6/theme/styles/files.scss | Added highlight and scroll margin for targeted file rows |
| src/onegov/town6/templates/macros.pt | Added breadcrumbs to search result macros, changed p to div tags for consistency |
| src/onegov/town6/layout.py | Renamed PageLayout to TopicLayout, added layout decorators for multiple models, implemented breadcrumbs for GeneralFile and various RIS models |
| src/onegov/org/views/page.py | Updated imports and references from PageLayout to TopicLayout |
| src/onegov/org/views/editor.py | Updated imports and references from PageLayout to TopicLayout |
| src/onegov/org/request.py | Added get_layout() method to retrieve layouts for model instances |
| src/onegov/org/layout.py | Renamed PageLayout to TopicLayout, added FormDefinitionLayout, DirectoryLayout, improved breadcrumbs for various layouts |
| src/onegov/org/exports/base.py | Fixed import to use onegov.org instead of onegov.town6 |
| src/onegov/org/directives.py | Added Layout directive for registering layouts to models |
| src/onegov/org/app.py | Added layout directive to OrgApp |
| src/onegov/agency/views/page.py | Updated imports and references from PageLayout to TopicLayout |
| src/onegov/agency/layout.py | Updated imports and class name from PageLayout to TopicLayout |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
BreathingFlesh
left a comment
There was a problem hiding this comment.
I would give the breadcrumbs a light background so they look more like a separate element
Daverball
left a comment
There was a problem hiding this comment.
We're getting pretty close, but the request parameter is still missing and some of the type annotations aren't quite correct.
You also made some changes to the breadcrumb links I'm not sure are a good idea, I'd rather you make that transformation when rendering the search result, since # should generally be able to be replaced by request.link(result). If that isn't the case for some models, I think I'd prefer if you added a new self_url property to Layout, which defaults to return self.request.link(self.model) and can be changed for any layouts where it's different.
Co-authored-by: David Salvisberg <david.salvisberg@seantis.ch>
Co-authored-by: David Salvisberg <david.salvisberg@seantis.ch>
Co-authored-by: David Salvisberg <david.salvisberg@seantis.ch>
Co-authored-by: David Salvisberg <david.salvisberg@seantis.ch>
Co-authored-by: David Salvisberg <david.salvisberg@seantis.ch>
Co-authored-by: David Salvisberg <david.salvisberg@seantis.ch>
Daverball
left a comment
There was a problem hiding this comment.
We're almost there, there's some breadcrumbs that still need to be cleaned up a bit, but other than that we're good I think.
Co-authored-by: David Salvisberg <david.salvisberg@seantis.ch>
…m:OneGov/onegov-cloud into feature/ogc-2880-search-results-with-path
Co-authored-by: David Salvisberg <dave@daverball.com>
Co-authored-by: David Salvisberg <david.salvisberg@seantis.ch>
Daverball
left a comment
There was a problem hiding this comment.
Looks good. Although it might be nice to register some Layouts in derived applications like LandsgemeindeApp (this one especially, since I think that's where the request initially came from), so they get the benefit of breadcrumbs for all of their search results as well. You can either do this in a follow-up PR or this one.
|
The request came from Wil, that is where I tested it the most |
You're right, but I think Landsgemeinde also requested something similar. Although they may have specifically requested it for files. |
|
Their file breadcrumbs would be easier to implement than the general case, since we already cache the date of the assembly on each file, which is unique. We would need to also cache |
|
Ok, let me open a separate PR for |

Search: Add breadcrumbs to search results in order to provide more context
TYPE: Feature
LINK: ogc-2880