Skip to content

Search: Add breadcrumbs to search results in order to provide more context#2282

Merged
Tschuppi81 merged 78 commits intomasterfrom
feature/ogc-2880-search-results-with-path
Mar 18, 2026
Merged

Search: Add breadcrumbs to search results in order to provide more context#2282
Tschuppi81 merged 78 commits intomasterfrom
feature/ogc-2880-search-results-with-path

Conversation

@Tschuppi81
Copy link
Copy Markdown
Contributor

@Tschuppi81 Tschuppi81 commented Jan 6, 2026

Search: Add breadcrumbs to search results in order to provide more context

TYPE: Feature
LINK: ogc-2880

@linear
Copy link
Copy Markdown

linear Bot commented Jan 6, 2026

@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 6, 2026

Codecov Report

❌ Patch coverage is 81.95876% with 35 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.28%. Comparing base (cf2d9f6) to head (b3e40f5).
⚠️ Report is 8 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/onegov/org/layout.py 74.32% 19 Missing ⚠️
src/onegov/people/models/person.py 14.28% 12 Missing ⚠️
src/onegov/town6/layout.py 96.00% 3 Missing ⚠️
src/onegov/core/framework.py 88.88% 1 Missing ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
src/onegov/core/directives.py 99.25% <100.00%> (+0.09%) ⬆️
src/onegov/org/directives.py 94.87% <ø> (ø)
src/onegov/org/exports/base.py 90.90% <100.00%> (ø)
src/onegov/org/request.py 91.44% <100.00%> (+0.23%) ⬆️
src/onegov/core/framework.py 93.07% <88.88%> (-0.07%) ⬇️
src/onegov/town6/layout.py 89.86% <96.00%> (+0.78%) ⬆️
src/onegov/people/models/person.py 90.50% <14.28%> (-7.42%) ⬇️
src/onegov/org/layout.py 91.10% <74.32%> (-0.98%) ⬇️

... and 5 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cf2d9f6...b3e40f5. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Tschuppi81
Copy link
Copy Markdown
Contributor Author

Tschuppi81 commented Jan 9, 2026

Also i switched the red color in the results to primary and italic

left: previous, right: now
image

@Tschuppi81
Copy link
Copy Markdown
Contributor Author

Not sure if the breadcrumbs color in search shall be primary or oil, what do you think?

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 PageLayout to TopicLayout throughout 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 Layout directive
  • 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.

Comment thread src/onegov/org/layout.py Outdated
Comment thread src/onegov/town6/layout.py Outdated
Comment thread src/onegov/org/request.py Outdated
Comment thread src/onegov/org/directives.py Outdated
Comment thread src/onegov/town6/templates/macros.pt
Comment thread src/onegov/town6/theme/styles/search.scss
Comment thread src/onegov/town6/templates/macros.pt Outdated
Comment thread src/onegov/town6/layout.py
Comment thread src/onegov/town6/layout.py
Copy link
Copy Markdown
Contributor

@BreathingFlesh BreathingFlesh left a comment

Choose a reason for hiding this comment

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

I would give the breadcrumbs a light background so they look more like a separate element

Copy link
Copy Markdown
Member

@Daverball Daverball left a comment

Choose a reason for hiding this comment

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

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.

Comment thread src/onegov/core/directives.py Outdated
Comment thread src/onegov/core/framework.py
Comment thread src/onegov/core/framework.py Outdated
Comment thread src/onegov/core/framework.py
Comment thread src/onegov/org/layout.py Outdated
Comment thread src/onegov/org/layout.py Outdated
Comment thread src/onegov/org/request.py Outdated
Comment thread src/onegov/town6/layout.py Outdated
Comment thread src/onegov/core/directives.py Outdated
Tschuppi81 and others added 10 commits February 24, 2026 15:31
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>
Copy link
Copy Markdown
Member

@Daverball Daverball left a comment

Choose a reason for hiding this comment

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

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.

Comment thread src/onegov/town6/templates/macros.pt Outdated
Comment thread src/onegov/org/layout.py Outdated
Comment thread src/onegov/org/layout.py Outdated
Comment thread src/onegov/org/layout.py Outdated
Comment thread src/onegov/town6/layout.py Outdated
Comment thread src/onegov/town6/layout.py Outdated
Comment thread src/onegov/town6/layout.py Outdated
Comment thread src/onegov/town6/layout.py
Tschuppi81 and others added 2 commits March 18, 2026 08:12
Co-authored-by: David Salvisberg <david.salvisberg@seantis.ch>
Copy link
Copy Markdown
Member

@Daverball Daverball left a comment

Choose a reason for hiding this comment

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

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.

@Tschuppi81
Copy link
Copy Markdown
Contributor Author

The request came from Wil, that is where I tested it the most

@Daverball
Copy link
Copy Markdown
Member

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.

@Daverball
Copy link
Copy Markdown
Member

Daverball commented Mar 18, 2026

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 agenda_item_number and votum_number on the files attached to the lower hierarchy levels (and their corresponding titles), so we can link to the specific agenda item and provide an additional breadcrumb with an anchor to the specific votum, if it was attached to a votum. But even just adding one breadcrumb for which assembly the file belongs to would be a nice start and we don't need to add any additional cached properties for that.

@Tschuppi81
Copy link
Copy Markdown
Contributor Author

Ok, let me open a separate PR for Landsgemeinde

@Tschuppi81 Tschuppi81 merged commit 7cf4501 into master Mar 18, 2026
14 of 15 checks passed
@Tschuppi81 Tschuppi81 deleted the feature/ogc-2880-search-results-with-path branch March 18, 2026 09:32
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.

4 participants