Overrides of default Wagtail CRX settings, eg. navbars, footers, etc.
Project description
Wagtail CRX (CodeRed) Settings Override
Overrides of default Wagtail CRX settings, eg. navbars, footers, etc.
Quick start
-
Install the package from PyPi:
pip install crx-settings-override
-
Add "crx_settings_override" to your INSTALLED_APPS setting like this::
INSTALLED_APPS = [ ..., "crx_settings_override", ]
-
Add "crx_settings_override.context_processors.navbars" and "crx_settings_override.context_processors.footers" to your TEMPLATES settings like this::
TEMPLATES = [ { ..., "OPTIONS": { "context_processors": [ ..., "crx_settings_override.context_processors.navbars", "crx_settings_override.context_processors.footers" ], "loaders": [...] }, }, ]
-
To make translations work for navbars, override navbar template of CodeRed by creating /templates/coderedcms/snippets/navbar.html and change
{% if settings.coderedcms.LayoutSettings.site_navbar %} {% get_navbars as navbars %} {% for navbar in navbars %} <ul class="navbar-nav {{navbar.custom_css_class}}" {% if navbar.custom_id %}id="{{navbar.custom_id}}" {% endif %}> {% for item in navbar.menu_items %} {% include_block item with liclass="nav-item" aclass="nav-link" ga_event_category="Navbar" %} {% endfor %} </ul> {% endfor %} {% endif %}
so it doesn't use site_navbar and get_navbars method (this is overriden by the context_processor), eg. simply erase those lines like this
{% for navbar in navbars %} <div> <ul class="navbar-nav flex-wrap justify-content-around"> {% for item in navbar.menu_items %} {% include_block item with liclass="nav-item fs-5" aclass="nav-link" ga_event_category="Navbar" %} {% endfor %} </ul> </div> {% endfor %}
-
Run
python manage.py migrate
to create the models. -
Start the development server and visit the admin to:
- create localized navbars under Snippets > Translatable Navigation Bars
- set one of the localized navbar as a site navigation in CRX Settings Overrides.
-
Navigation switches automatically based on current site localization.
Development
Update semantic version of the package
Run test update without commiting
$ bumpver update --patch(--minor|--major) --dry
Run update and commit the changes to the repo
$ bumpver update --patch(--minor|--major)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for crx-settings-override-1.0.0b0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | de4b091d43eb17db395ceabb5b56bf3a4bafcc33397b9a83498aaa3de3c2305a |
|
MD5 | 1a865dff0f208d0f4c16fe40b4eb888b |
|
BLAKE2b-256 | 636bea1a78a2ac84abfdae79bea9e1625ef6472a286b8e501b2069e7bb10ae8a |
Hashes for crx_settings_override-1.0.0b0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53593e3859a351958704ceb535a73911dd6d3ddc0ace11c761fd704ff350c3c1 |
|
MD5 | cd81d212278bacbf64f71ea6c9b9ed3e |
|
BLAKE2b-256 | cb8ba503f0bd0c8e1a77b3ffd4b0f04bbd97cb7f574b9dd56331b032a44a9aa3 |