Revert "Fix Carbasa header overrides cleanly"
This reverts commit c7adaf94b4.
This commit is contained in:
@@ -9,7 +9,6 @@ https://docs.djangoproject.com/en/2.0/ref/settings/
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import importlib.util
|
import importlib.util
|
||||||
import os
|
|
||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
@@ -21,11 +20,7 @@ BASE_DIR = str(BASE_PATH)
|
|||||||
|
|
||||||
setup_search_paths("/etc/ocyan/", str(_project_app_path))
|
setup_search_paths("/etc/ocyan/", str(_project_app_path))
|
||||||
|
|
||||||
from ocyan.main.settings import * # noqa: F403,F405 # pylint:disable=W0401,W0614 # pyright: ignore[reportWildcardImportFromLibrary]
|
from ocyan.main.settings import * # pylint:disable=W0401,W0614
|
||||||
from ocyan.core.fender import config as ocyan_config
|
|
||||||
|
|
||||||
# Keep existing database schemas stable across Django upgrades.
|
|
||||||
DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
|
|
||||||
|
|
||||||
INSTALLED_APPS = [
|
INSTALLED_APPS = [
|
||||||
"mandelblog_content_guard.apps.MandelblogContentGuardConfig",
|
"mandelblog_content_guard.apps.MandelblogContentGuardConfig",
|
||||||
@@ -65,25 +60,6 @@ _ensure_required_app(
|
|||||||
"ocyan.plugin.coyote",
|
"ocyan.plugin.coyote",
|
||||||
)
|
)
|
||||||
|
|
||||||
def _ensure_installed_app(app_label: str, *, before: str | None = None) -> None:
|
|
||||||
"""Ensure an app is present in INSTALLED_APPS with optional ordering."""
|
|
||||||
if app_label in INSTALLED_APPS:
|
|
||||||
INSTALLED_APPS.remove(app_label)
|
|
||||||
if before and before in INSTALLED_APPS:
|
|
||||||
INSTALLED_APPS.insert(INSTALLED_APPS.index(before), app_label)
|
|
||||||
else:
|
|
||||||
INSTALLED_APPS.append(app_label)
|
|
||||||
|
|
||||||
|
|
||||||
# Production-clean: prefer the Carbasa webshop template package when Oscar is enabled.
|
|
||||||
# This guarantees that `carbasa/headers/*` resolves to the webshop templates (search, user bar, cart, megamenu).
|
|
||||||
_oscar_enabled = ocyan_config.is_webshop or any(
|
|
||||||
app == "ocyan.plugin.oscar" or app.startswith("ocyan.plugin.oscar_")
|
|
||||||
for app in INSTALLED_APPS
|
|
||||||
)
|
|
||||||
if _oscar_enabled and importlib.util.find_spec("ocyan.plugin.carbasa.webshop"):
|
|
||||||
_ensure_installed_app("ocyan.plugin.carbasa.webshop", before="ocyan.plugin.carbasa")
|
|
||||||
|
|
||||||
# Keep Carbasa/Coyote defaults stable even when plugin settings are not
|
# Keep Carbasa/Coyote defaults stable even when plugin settings are not
|
||||||
# injected early enough during startup on this deployment.
|
# injected early enough during startup on this deployment.
|
||||||
OXYAN_HEADER_OPTIONS = globals().get(
|
OXYAN_HEADER_OPTIONS = globals().get(
|
||||||
@@ -145,13 +121,6 @@ ACTIVE_VERTICAL = "agency"
|
|||||||
# Wagtail content internationalization in admin
|
# Wagtail content internationalization in admin
|
||||||
WAGTAIL_I18N_ENABLED = True
|
WAGTAIL_I18N_ENABLED = True
|
||||||
WAGTAIL_CONTENT_LANGUAGES = LANGUAGES
|
WAGTAIL_CONTENT_LANGUAGES = LANGUAGES
|
||||||
WAGTAILADMIN_BASE_URL = os.environ.get("WAGTAILADMIN_BASE_URL", "http://127.0.0.1:8001")
|
|
||||||
|
|
||||||
# Local dev convenience: allow Django's test client and common loopback hosts.
|
|
||||||
ALLOWED_HOSTS = list(globals().get("ALLOWED_HOSTS", []))
|
|
||||||
for _host in ("localhost", "127.0.0.1", "0.0.0.0", "testserver"):
|
|
||||||
if _host not in ALLOWED_HOSTS:
|
|
||||||
ALLOWED_HOSTS.append(_host)
|
|
||||||
|
|
||||||
CONTENT_GUARD_STRICT = True
|
CONTENT_GUARD_STRICT = True
|
||||||
CONTENT_GUARD_BLOCK_MEDIUM = False
|
CONTENT_GUARD_BLOCK_MEDIUM = False
|
||||||
|
|||||||
35
mandelstudio/templates/carbasa/headers/header.html
Normal file
35
mandelstudio/templates/carbasa/headers/header.html
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
{% load i18n oxyan category_tags ocyan_main ocyanjson %}
|
||||||
|
|
||||||
|
{# Project override: add the language chooser to the Carbasa (non-webshop) header. #}
|
||||||
|
<header>
|
||||||
|
<nav class="navbar navbar-expand-lg navbar-light header-inner">
|
||||||
|
<div class="container">
|
||||||
|
{% include 'partials/brand.html' with big=True %}
|
||||||
|
|
||||||
|
{% block nav %}
|
||||||
|
{% ocyanjson "theme" "menu_depth" 1 as menu_depth %}
|
||||||
|
<div class="collapse navbar-collapse menu-bar page-menu-bar" id="navbarSupportedContent">
|
||||||
|
<div class="brand-wrapper">
|
||||||
|
{% include 'partials/brand.html' with big=True %}
|
||||||
|
</div>
|
||||||
|
<ul class="navbar-nav">
|
||||||
|
{% rootpage_as_category as page_tree_root %}
|
||||||
|
{% category_tree 2 page_tree_root as page_tree_items %}
|
||||||
|
{% include "partials/dropdown.html" with menu_items=page_tree_items limit=2 %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block append_header_block %}
|
||||||
|
{% include "oxyan/partials/language_chooser.html" %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
<a aria-label="Search">zoeken</a>
|
||||||
|
<button class="navbar-toggler collapsed" aria-label="Navbar toggle" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent">
|
||||||
|
<i class="fa fa-bars nav-icon"></i>
|
||||||
|
<i class="fa fa-times nav-icon"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
2
mandelstudio/templates/carbasa/headers/mega.html
Normal file
2
mandelstudio/templates/carbasa/headers/mega.html
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
{% extends "carbasa/headers/header.html" %}
|
||||||
|
|
||||||
@@ -3,7 +3,3 @@
|
|||||||
{% block append_header_block %}
|
{% block append_header_block %}
|
||||||
{% include "oxyan/partials/language_chooser.html" %}
|
{% include "oxyan/partials/language_chooser.html" %}
|
||||||
{% endblock append_header_block %}
|
{% endblock append_header_block %}
|
||||||
|
|
||||||
{% block language_chooser %}
|
|
||||||
{% include "oxyan/partials/language_chooser.html" %}
|
|
||||||
{% endblock language_chooser %}
|
|
||||||
|
|||||||
@@ -3,7 +3,3 @@
|
|||||||
{% block append_header_block %}
|
{% block append_header_block %}
|
||||||
{% include "oxyan/partials/language_chooser.html" %}
|
{% include "oxyan/partials/language_chooser.html" %}
|
||||||
{% endblock append_header_block %}
|
{% endblock append_header_block %}
|
||||||
|
|
||||||
{% block language_chooser %}
|
|
||||||
{% include "oxyan/partials/language_chooser.html" %}
|
|
||||||
{% endblock language_chooser %}
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
<!-- MB OVERRIDE -->
|
||||||
{% load i18n static ocyanjson mandelstudio_i18n %}
|
{% load i18n static ocyanjson mandelstudio_i18n %}
|
||||||
|
|
||||||
{% get_current_language as current_language %}
|
{% get_current_language as current_language %}
|
||||||
|
|||||||
Reference in New Issue
Block a user