fix: Don't insert form CSS/JS when no form

This commit is contained in:
James Graham
2020-06-24 13:40:02 +01:00
parent 62d7a1e48c
commit 9a84f77ec4

View File

@@ -1,8 +1,8 @@
<!DOCTYPE html> <!DOCTYPE html>
{% load bootstrap4 %} {% load bootstrap4 %}
{% if 'use_i18n'|bootstrap_setting %} {% if 'use_i18n'|bootstrap_setting %}
{% load i18n %} {% load i18n %}
{% get_current_language as LANGUAGE_CODE %} {% get_current_language as LANGUAGE_CODE %}
{% endif %} {% endif %}
<html lang="{{ LANGUAGE_CODE|default:'en_us' }}"> <html lang="{{ LANGUAGE_CODE|default:'en_us' }}">
@@ -25,8 +25,7 @@
crossorigin="anonymous" /> crossorigin="anonymous" />
{% load staticfiles %} {% load staticfiles %}
<link rel="stylesheet" <link rel="stylesheet" href="{% static 'css/global.css' %}">
href="{% static 'css/global.css' %}">
{% if 'javascript_in_head'|bootstrap_setting %} {% if 'javascript_in_head'|bootstrap_setting %}
{% if 'include_jquery'|bootstrap_setting %} {% if 'include_jquery'|bootstrap_setting %}
@@ -38,14 +37,16 @@
{% bootstrap_javascript %} {% bootstrap_javascript %}
{% endif %} {% endif %}
{% if form %}
{{ form.media.css }} {{ form.media.css }}
{% endif %}
{% block extra_head %}{% endblock %} {% block extra_head %}{% endblock %}
</head> </head>
<body> <body>
<div class="content" style="display: flex; flex-direction: column"> <div class="content" style="display: flex; flex-direction: column">
{% block navbar %} {% block navbar %}
<nav class="navbar navbar-expand-lg navbar-dark bg-dark"> <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container"> <div class="container">
@@ -138,7 +139,8 @@
{% if request.user.is_authenticated and not request.user.has_person %} {% if request.user.is_authenticated and not request.user.has_person %}
<div class="alert alert-info rounded-0" role="alert"> <div class="alert alert-info rounded-0" role="alert">
<p class="text-center mb-0"> <p class="text-center mb-0">
Your profile is currently blank. Please fill in your details so you can be part of the network. Your profile is currently blank.
Please fill in your details so you can be part of the network.
<a class="btn btn-success" <a class="btn btn-success"
href="{% url 'people:person.create' %}?user">Profile</a> href="{% url 'people:person.create' %}?user">Profile</a>
@@ -158,15 +160,15 @@
<div class="container"> <div class="container">
{% block after_content %}{% endblock %} {% block after_content %}{% endblock %}
</div> </div>
</div> </div>
<footer class="footer bg-light"> <footer class="footer bg-light">
<div class="container"> <div class="container">
<span class="text-muted">{{ settings.PROJECT_LONG_NAME }}</span> <span class="text-muted">{{ settings.PROJECT_LONG_NAME }}</span>
</div> </div>
</footer> </footer>
{% if not 'javascript_in_head'|bootstrap_setting %} {% if not 'javascript_in_head'|bootstrap_setting %}
{% if 'include_jquery'|bootstrap_setting %} {% if 'include_jquery'|bootstrap_setting %}
{# jQuery JavaScript if it is in body #} {# jQuery JavaScript if it is in body #}
{% bootstrap_jquery jquery='include_jquery'|bootstrap_setting %} {% bootstrap_jquery jquery='include_jquery'|bootstrap_setting %}
@@ -174,11 +176,13 @@
{# Bootstrap JavaScript if it is in body #} {# Bootstrap JavaScript if it is in body #}
{% bootstrap_javascript %} {% bootstrap_javascript %}
{% endif %} {% endif %}
{{ form.media.js }} {% if form %}
{{ form.media.js }}
{% endif %}
{% block extra_script %}{% endblock %} {% block extra_script %}{% endblock %}
</body> </body>
</html> </html>