Skip to content

Commit

Permalink
include in templates
Browse files Browse the repository at this point in the history
  • Loading branch information
gromdimon committed Apr 5, 2023
1 parent e227497 commit 88c3774
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 8 deletions.
3 changes: 2 additions & 1 deletion config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,8 @@ def set_logging(level=None):

# Full path to the custom template includes
PROJECTROLES_TEMPLATE_INCLUDE_PATH = env.str(
'PROJECTROLES_TEMPLATE_INCLUDE_PATH', os.path.join(APPS_DIR, 'templates', 'include')
'PROJECTROLES_TEMPLATE_INCLUDE_PATH',
os.path.join(APPS_DIR, 'templates', 'include'),
)

# Enable or disable project creation if site is in TARGET mode
Expand Down
4 changes: 3 additions & 1 deletion projectroles/templates/projectroles/_footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@

{% get_django_setting 'SITE_TITLE' as site_title %}

Set the content for your footer in include/_footer.html.
Set the content for your footer in include/_footer.html. Or
provide path to your custom footer template in the
PROJECTROLES_TEMPLATE_INCLUDE_PATH setting.
{{ site_title }} v{% site_version %} / SODAR Core v{% core_version %}
5 changes: 3 additions & 2 deletions projectroles/templates/projectroles/_site_titlebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
{% get_django_setting 'PROJECTROLES_ENABLE_SEARCH' as enable_search %}
{% get_django_setting 'PROJECTROLES_KIOSK_MODE' as kiosk_mode %}
{% get_django_setting 'PROJECTROLES_ALLOW_ANONYMOUS' as allow_anon %}
{% get_django_setting 'PROJECTROLES_TEMPLATE_INCLUDE_PATH' as template_include_path %}
{% static_file_exists 'images/logo_navbar.png' as logo_exists %}
{% check_backend 'appalerts_backend' as appalerts_active %}

Expand Down Expand Up @@ -98,9 +99,9 @@
{% endif %}

{# Optional template for additional links #}
{% template_exists 'include/_titlebar_nav.html' as add_links_exist %}
{% template_exists template_include_path|add:'/_titlebar_nav.html' as add_links_exist %}
{% if add_links_exist %}
{% include 'include/_titlebar_nav.html' %}
{% include template_include_path|add:'/_titlebar_nav.html' %}
{% endif %}

{# Help link #}
Expand Down
5 changes: 3 additions & 2 deletions projectroles/templates/projectroles/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

{% block content %}
{% get_django_setting 'PROJECTROLES_KIOSK_MODE' as kiosk_mode %}
{% get_django_setting 'PROJECTROLES_TEMPLATE_INCLUDE_PATH' as template_include_path %}

{# Ensure passing CSRF token to Ajax API views #}
{% csrf_token %}
Expand Down Expand Up @@ -86,10 +87,10 @@
</div>

{# Footer #}
{% template_exists 'include/_footer.html' as footer_exists %}
{% template_exists template_include_path|add:'/_footer.html' as footer_exists %}
<footer class="sodar-footer">
{% if footer_exists %}
{% include 'include/_footer.html' %}
{% include template_include_path|add:'/_footer.html' %}
{% else %}
{% include 'projectroles/_footer.html' %}
{% endif %}
Expand Down
5 changes: 3 additions & 2 deletions projectroles/templates/projectroles/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
{% load projectroles_common_tags %}

{% get_django_setting 'SITE_INSTANCE_TITLE' as site_title %}
{% get_django_setting 'PROJECTROLES_TEMPLATE_INCLUDE_PATH' as template_include_path %}

{% block title %}Login{% endblock title %}

Expand Down Expand Up @@ -60,9 +61,9 @@ <h2 class="sodar-pr-content-title">Login</h2>
</div>

{# Optional template for additional login page HTML #}
{% template_exists 'include/_login_extend.html' as login_extend %}
{% template_exists template_include_path|add:'/_login_extend.html' as login_extend %}
{% if login_extend %}
{% include 'include/_login_extend.html' %}
{% include template_include_path|add:'/_login_extend.html' %}
{% endif %}

</div>
Expand Down
1 change: 1 addition & 0 deletions siteinfo/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
'PROJECTROLES_SEND_EMAIL',
'PROJECTROLES_SIDEBAR_ICON_SIZE',
'PROJECTROLES_SITE_MODE',
'PROJECTROLES_TEMPLATE_INCLUDE_PATH',
'PROJECTROLES_TARGET_CREATE',
'ROOT_DIR',
'SITE_PACKAGE',
Expand Down

0 comments on commit 88c3774

Please sign in to comment.