Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
ae72f66
Adds breadcrumbs to search resutls for Topic and News
Tschuppi81 Jan 6, 2026
0ece469
Adds breadcrumbs to search resutls for Person and User
Tschuppi81 Jan 6, 2026
6cc9cb1
Adds breadcrumbs to search resutls for Files and highlights it on the…
Tschuppi81 Jan 6, 2026
713a697
Fix town import in org
Tschuppi81 Jan 8, 2026
1d0b009
Adds breadcrumbs to search resutls for forms
Tschuppi81 Jan 8, 2026
bd1b9d2
Adds breadcrumbs to search resutls for image sets
Tschuppi81 Jan 8, 2026
d32a3d6
Adds breadcrumbs to search resutls for resources
Tschuppi81 Jan 8, 2026
7e0f149
Adds breadcrumbs to search resutls for Event/Occurrence
Tschuppi81 Jan 8, 2026
8ecbaff
Remove print statement
Tschuppi81 Jan 8, 2026
502a4cc
Adds breadcrumbs to search resutls for Ticket
Tschuppi81 Jan 8, 2026
80facd9
Adds breadcrumbs to search resutls for Directory and DirectoryEntry
Tschuppi81 Jan 8, 2026
ce6a0c9
Adds breadcrumbs to search resutls for RIS models
Tschuppi81 Jan 8, 2026
7f971d5
Adjust tests
Tschuppi81 Jan 9, 2026
104a248
Fix wrong model registration
Tschuppi81 Jan 9, 2026
b96c10f
Merge master
Tschuppi81 Jan 9, 2026
c74f7c3
Move styles from template to stylesheet
Tschuppi81 Jan 9, 2026
56b3905
Adjust search preview color and font style
Tschuppi81 Jan 9, 2026
2026859
Adds layout for MeetingItem
Tschuppi81 Jan 13, 2026
baa55ab
Get rid of z-index for breadcrumbs
Tschuppi81 Jan 13, 2026
8952372
Styling improvements
Tschuppi81 Jan 13, 2026
35e646e
Get rid of z-index for breadcrumbs
Tschuppi81 Jan 13, 2026
2a354c7
Update src/onegov/org/layout.py
Tschuppi81 Jan 13, 2026
7f19e29
Link meeting items to meeting with anchor
Tschuppi81 Jan 13, 2026
a9d6c18
Merge branch 'feature/ogc-2880-search-results-with-path' of github.co…
Tschuppi81 Jan 13, 2026
73ae86d
Fix layout condition for events
Tschuppi81 Jan 13, 2026
b26baad
Fix lost link color transition
Tschuppi81 Jan 13, 2026
e4cc346
Improve styling
Tschuppi81 Jan 13, 2026
e2006d1
Merge branch 'feature/ogc-2880-search-results-with-path' of github.co…
Tschuppi81 Jan 13, 2026
c531b26
Adjust styling
Tschuppi81 Jan 15, 2026
0c8c712
Improve link to meeting item using fragment
Tschuppi81 Jan 15, 2026
325f9d2
Undo rename PageLayout
Tschuppi81 Jan 15, 2026
1aa413e
Undo rename PageLayout in agency
Tschuppi81 Jan 15, 2026
f7fe90c
makes sense
Tschuppi81 Jan 15, 2026
2314336
Remove falsly added file
Tschuppi81 Jan 15, 2026
73a98a0
Merge branch 'master' into feature/ogc-2880-search-results-with-path
Tschuppi81 Jan 26, 2026
1966907
Try to use morepath predicate
Tschuppi81 Jan 29, 2026
34a7f44
Tell the action class to inject the app class
Tschuppi81 Jan 30, 2026
0ddfbff
Change dispatch method name and fix arguments and type annotations
Tschuppi81 Feb 2, 2026
3a13a85
Register org layouts
Tschuppi81 Feb 2, 2026
50d0ba3
Move layout directive to core and add request to dispatch method and …
Tschuppi81 Feb 2, 2026
9f96326
Prevent passing type to predicate
Tschuppi81 Feb 2, 2026
c7dd09e
Remove request from layout decorator
Tschuppi81 Feb 3, 2026
f3ba92a
Fix registering to match signature
Tschuppi81 Feb 3, 2026
760a871
Registers more layouts
Tschuppi81 Feb 5, 2026
af433e0
Provide more about a parliamentarian
Tschuppi81 Feb 12, 2026
df7319c
Provide more about a person
Tschuppi81 Feb 12, 2026
6c506ba
Simplify z-index for search breadcrumbs
Tschuppi81 Feb 13, 2026
91be5b3
Revert org search template
Tschuppi81 Feb 13, 2026
9b1acbe
Show more for political businesses
Tschuppi81 Feb 13, 2026
12f0b6a
Fix fallback predicate registration (its the Framework class)
Tschuppi81 Feb 13, 2026
52aac65
Resolve merge conflicts
Tschuppi81 Feb 23, 2026
199f603
Move predicate fallbacks to corresponding layouts getting rid of circ…
Tschuppi81 Feb 23, 2026
16ef9db
ignore already have registration error
Tschuppi81 Feb 23, 2026
0e0afb1
Fix linter issue
Tschuppi81 Feb 23, 2026
28fcf3e
Fix import
Tschuppi81 Feb 23, 2026
8ab8489
Fix linter issues
Tschuppi81 Feb 23, 2026
556a0f6
Fix more linter issues
Tschuppi81 Feb 23, 2026
53cbd61
Adjust test
Tschuppi81 Feb 23, 2026
dcfb896
Fix type annotation for layout not found in town
Tschuppi81 Feb 24, 2026
2eb7f2c
Fix type annotation for layout not found in org
Tschuppi81 Feb 24, 2026
84a9997
Fix type annotation for get layout
Tschuppi81 Feb 24, 2026
c835325
Fix type annotation for layout predicate
Tschuppi81 Feb 24, 2026
4179a66
Fix predicate registration after signature change
Tschuppi81 Feb 24, 2026
a605371
assign layout
Tschuppi81 Feb 26, 2026
73934ac
Improve and fix linter issues
Tschuppi81 Feb 26, 2026
0192a74
Merge branch 'master' into feature/ogc-2880-search-results-with-path
Tschuppi81 Mar 2, 2026
efc6a4a
Fix duplicate registration issue
Tschuppi81 Mar 17, 2026
62c2357
Revert breadcrumb change in TicketLayout and handle it in template
Tschuppi81 Mar 17, 2026
66fa53b
Massively simplify template
Tschuppi81 Mar 17, 2026
a006b78
Add breadcrumb test
Tschuppi81 Mar 17, 2026
0733526
Merge branch 'feature/ogc-2880-search-results-with-path' of github.co…
Tschuppi81 Mar 17, 2026
ff6ac6d
Fix bad formatting
Tschuppi81 Mar 17, 2026
4d05615
Use `#` instead of link to self model
Tschuppi81 Mar 17, 2026
9bd999b
For meeting items link to the meeting
Tschuppi81 Mar 17, 2026
b7126ab
Move file breadcrumbs to GeneralFileLayout. Add link to publications …
Tschuppi81 Mar 18, 2026
a3be800
Resolve merge conflict
Tschuppi81 Mar 18, 2026
d04a34e
Show publication if not manager
Tschuppi81 Mar 18, 2026
b3e40f5
Extend breadcrumb test
Tschuppi81 Mar 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 41 additions & 3 deletions src/onegov/core/directives.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@

import os.path

from dectate import Action, Query
from dectate import Action, Query, convert_dotted_name # type:ignore[attr-defined]
from itertools import count
from morepath.directive import HtmlAction
from morepath.directive import isbaseclass
from morepath.directive import PredicateAction
from morepath.directive import PredicateFallbackAction
from morepath.directive import SettingAction
from morepath.settings import SettingRegistry, SettingSection
from onegov.core.utils import Bunch

from onegov.core.utils import Bunch

from typing import Any, ClassVar, TYPE_CHECKING
if TYPE_CHECKING:
Expand All @@ -18,7 +21,9 @@
from wtforms import Form

from .analytics import AnalyticsProvider
from .request import CoreRequest
from onegov.core import Framework
from onegov.core.layout import Layout as CoreLayout
from onegov.core.request import CoreRequest


class HtmlHandleFormAction(HtmlAction):
Expand Down Expand Up @@ -383,3 +388,36 @@ class ReplaceSettingAction(SettingAction):
"""

depends = [ReplaceSettingSectionAction]


class Layout(Action):
"""
Registers a layout for a model. This is used to show breadcrumbs
for search results.
"""

app_class_arg = True
depends = [PredicateFallbackAction, PredicateAction]
filter_convert = {'model': convert_dotted_name}
filter_compare = {'model': isbaseclass}

def __init__(self, model: type) -> None:
self.model = model

def identifier( # type:ignore[override]
self,
app_class: type[Framework]
) -> str:
return str(self.model)

def perform( # type:ignore[override]
self,
obj: type[CoreLayout],
app_class: type[Framework]
) -> None:

layout_class = obj
# `lambda self, obj, request` is required to match the signature
app_class.get_layout.register( # type:ignore[attr-defined]
lambda self, obj, request: layout_class(obj, request),
model=self.model)
28 changes: 28 additions & 0 deletions src/onegov/core/framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class MyApplication(Framework):
from functools import cached_property, wraps
from itsdangerous import BadSignature, Signer
from libres.db.models import ORMBase
from morepath import dispatch_method
from morepath.publish import resolve_model, get_view_name
from more.content_security import ContentSecurityApp
from more.content_security import ContentSecurityPolicy
Expand All @@ -46,6 +47,8 @@ class MyApplication(Framework):
from more.webassets import WebassetsApp
from more.webassets.core import webassets_injector_tween
from more.webassets.tweens import METHODS, CONTENT_TYPES
from reg import ClassIndex

from onegov.core import cache, log, utils
from onegov.core import directives
from onegov.core.crypto import stored_random_token
Expand All @@ -68,6 +71,7 @@ class MyApplication(Framework):


from typing import overload, Any, Literal, TypeVar, TYPE_CHECKING

if TYPE_CHECKING:
from _typeshed import StrPath
from _typeshed.wsgi import WSGIApplication, WSGIEnvironment, StartResponse
Expand All @@ -83,6 +87,7 @@ class MyApplication(Framework):
from webob import Response

from .analytics import AnalyticsProvider
from .layout import Layout
from .mail import Attachment
from .metadata import Metadata
from .security.permissions import Intent
Expand Down Expand Up @@ -129,6 +134,7 @@ class Framework(
template_variables = directive(directives.TemplateVariablesAction)
replace_setting = directive(directives.ReplaceSettingAction)
replace_setting_section = directive(directives.ReplaceSettingSectionAction)
layout = directive(directives.Layout)

#: sets the same-site cookie directive, (may need removal inside iframes)
same_site_cookie_policy: str | None = 'Lax'
Expand Down Expand Up @@ -1552,6 +1558,28 @@ def decrypt(self, cyphertext: bytes) -> str:
self.hashed_identity_key
).decrypt(cyphertext).decode('utf-8')

@dispatch_method()
def get_layout(
self,
obj: object,
request: CoreRequest
) -> Layout | None:
return None


@Framework.predicate(
Framework.get_layout,
name='model',
default=None,
index=ClassIndex
)
def layout_predicate(
self: type[Framework],
obj: object,
request: CoreRequest
) -> type[object]:
return obj.__class__


@Framework.webasset_url()
def get_webasset_url() -> str:
Expand Down
2 changes: 1 addition & 1 deletion src/onegov/org/directives.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from dectate import Action
from itertools import count


from typing import cast, Any, ClassVar, Literal, TYPE_CHECKING

if TYPE_CHECKING:
from collections.abc import Callable
from onegov.core.elements import LinkGroup
Expand Down
2 changes: 1 addition & 1 deletion src/onegov/org/exports/base.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from onegov.org.models import Export
from onegov.town6 import _
from onegov.org import _


from typing import Any, TYPE_CHECKING
Expand Down
Loading
Loading