Skip to content

Commit

Permalink
feat: CMD-164 custom styles via setting (#840)
Browse files Browse the repository at this point in the history
* feat: CMD-164 custom styles via setting

* fix: sample PORTAL_STYLES as "TACC: Styles"

* fix: CMD-164 export PORTAL_STYLES

* style: restore lost newline
  • Loading branch information
wesleyboar authored Jul 24, 2024
1 parent 3e70315 commit 36287dc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
9 changes: 8 additions & 1 deletion taccsite_cms/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,15 @@ def gettext(s): return s
# PORTAL_SOCIAL_SHARE_PLATFORMS = ['linkedin', 'instagram', 'facebook', 'bluesky', 'email']

########################
# TACC: CORE STYLES
# TACC: STYLES
########################

PORTAL_STYLES = []
# PORTAL_STYLES = [{
# "is_remote": True,
# "path": "https://cdn.jsdelivr.net/gh/TACC/Core-CMS-Custom@2cdc59f/example_cms/src/apps/example_app/static/example_app/css/example_app.css",
# }]

# Only use integer numbers (not "v1", not "0.11.0"),
# so templates can load based on simple comparisons
TACC_CORE_STYLES_VERSION = 2
Expand Down Expand Up @@ -795,6 +801,7 @@ def get_subdirs_as_module_names(path):
'PORTAL_HAS_LOGIN',
'PORTAL_HAS_SEARCH',
'PORTAL_NAV_WIDTH',
'PORTAL_STYLES',
'PORTAL_BLOG_SHOW_CATEGORIES',
'PORTAL_BLOG_SHOW_TAGS',
'PORTAL_BLOG_CUSTOM_MEDIA_POST_CATEGORY',
Expand Down
9 changes: 9 additions & 0 deletions taccsite_cms/templates/assets_custom.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@



<!-- Custom Site Assets: Styles. -->
{% with settings.PORTAL_STYLES as styles %}
{% for style in styles %}
<link rel="stylesheet" href="{% if style.is_remote %}{{ style.path }}{% else %}{% static style.path %}{% endif %}" />
{% endfor %}
{% endwith %}



{# Do NOT directly load project-specific assets here; see `/taccsite_custom` #}

{# Example #}
Expand Down

0 comments on commit 36287dc

Please sign in to comment.