Skip to content

Commit

Permalink
feat: add option to capilize breadcrums
Browse files Browse the repository at this point in the history
  • Loading branch information
abe-101 committed May 24, 2024
1 parent b5e5bc0 commit 26db8fa
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/ref/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,13 @@ DYNAMIC_BREADCRUMBS_PATH_MAX_COMPONENT_LENGTH
Default: ``50``

Each path component's maximum length.


DYNAMIC_BREADCRUMBS_CAPITALIZE_BREADCRUMS
---------------------------------------------

Default: ``False``

Automatically capitalize the first letter of each breadcrumb title.
When set to `True`, the first letter of each breadcrumb title will be capitalized.

1 change: 1 addition & 0 deletions dynamic_breadcrumbs/app_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
PATH_MAX_COMPONENT_LENGTH = getattr(
settings, "DYNAMIC_BREADCRUMBS_PATH_MAX_COMPONENT_LENGTH", 50
)
CAPITALIZE_BREADCRUMS = getattr(settings, "DYNAMIC_BREADCRUMBS_CAPITALIZE_BREADCRUMS", FALSE)
4 changes: 4 additions & 0 deletions dynamic_breadcrumbs/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ def get_name(self):
return apps.get_app_config(self.name_raw).verbose_name
except Exception:
pass

if settings.CAPITALIZE_BREADCRUMS:
self.name_raw = self.name_raw.capitalize()

return self.name_raw

def as_dict(self):
Expand Down

0 comments on commit 26db8fa

Please sign in to comment.