forked from Github-Mirrors/canaille
fix: JAVASCRIPT and HTMX configuration settings were ignored
This commit is contained in:
parent
f3bcdafb23
commit
4037c296cf
4 changed files with 33 additions and 6 deletions
|
@ -1,8 +1,11 @@
|
||||||
Added
|
Added
|
||||||
^^^^^
|
^^^^^
|
||||||
|
|
||||||
- Sign in/out events are logged in :issuer:`177`
|
- Sign in/out events are logged in :issuer:`177`
|
||||||
|
|
||||||
|
Fixed
|
||||||
|
^^^^^
|
||||||
|
- HTMX and JAVASCRIPT configuration settings.
|
||||||
|
|
||||||
[0.0.49] - 2024-04-08
|
[0.0.49] - 2024-04-08
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
{% block style %}{% endblock %}
|
{% block style %}{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body hx-boost="true">
|
<body{% if config["CANAILLE"]["JAVASCRIPT"] and config["CANAILLE"]["HTMX"] %} hx-boost="true"{% endif %}>
|
||||||
{% block menu %}
|
{% block menu %}
|
||||||
{% if user and menu %}
|
{% if user and menu %}
|
||||||
<div class="ui container menu-container">
|
<div class="ui container menu-container">
|
||||||
|
@ -90,11 +90,11 @@
|
||||||
<footer>
|
<footer>
|
||||||
<a href="{{ url_for('core.account.about') }}">{{ _("About Canaille") }}</a>
|
<a href="{{ url_for('core.account.about') }}">{{ _("About Canaille") }}</a>
|
||||||
</footer>
|
</footer>
|
||||||
{% if config.get("JAVASCRIPT", true) %}
|
{% if config["CANAILLE"]["JAVASCRIPT"] %}
|
||||||
{% if not is_boosted %}
|
{% if not is_boosted %}
|
||||||
<script src="{{ url_for("static", filename="jquery/jquery.min.js") }}" defer></script>
|
<script src="{{ url_for("static", filename="jquery/jquery.min.js") }}" defer></script>
|
||||||
<script src="{{ url_for("static", filename="fomanticui/semantic.min.js") }}" defer></script>
|
<script src="{{ url_for("static", filename="fomanticui/semantic.min.js") }}" defer></script>
|
||||||
{% if config.get("HTMX", true) %}
|
{% if config["CANAILLE"]["HTMX"] %}
|
||||||
<script src="{{ url_for("static", filename="htmx/htmx.min.js") }}" defer></script>
|
<script src="{{ url_for("static", filename="htmx/htmx.min.js") }}" defer></script>
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
def test_version(testclient):
|
|
||||||
testclient.get("/about", status=200)
|
|
26
tests/core/test_misc.py
Normal file
26
tests/core/test_misc.py
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
def test_version(testclient):
|
||||||
|
testclient.get("/about", status=200)
|
||||||
|
|
||||||
|
|
||||||
|
def test_javascript(testclient):
|
||||||
|
testclient.app.config["CANAILLE"]["JAVASCRIPT"] = True
|
||||||
|
res = testclient.get("/about", status=200)
|
||||||
|
res.mustcontain("<script>")
|
||||||
|
|
||||||
|
testclient.app.config["CANAILLE"]["JAVASCRIPT"] = False
|
||||||
|
res = testclient.get("/about", status=200)
|
||||||
|
res.mustcontain(no="<script>")
|
||||||
|
|
||||||
|
|
||||||
|
def test_htmx(testclient):
|
||||||
|
testclient.app.config["CANAILLE"]["JAVASCRIPT"] = True
|
||||||
|
testclient.app.config["CANAILLE"]["HTMX"] = True
|
||||||
|
res = testclient.get("/about", status=200)
|
||||||
|
res.mustcontain("htmx.min.js")
|
||||||
|
res.mustcontain("hx-boost")
|
||||||
|
|
||||||
|
testclient.app.config["CANAILLE"]["JAVASCRIPT"] = True
|
||||||
|
testclient.app.config["CANAILLE"]["HTMX"] = False
|
||||||
|
res = testclient.get("/about", status=200)
|
||||||
|
res.mustcontain(no="htmx.min.js")
|
||||||
|
res.mustcontain(no="hx-boost")
|
Loading…
Reference in a new issue