diff --git a/_readme-cms/_templates/README.md b/_readme-cms/_templates/README.md index 70b33603..035ef078 100644 --- a/_readme-cms/_templates/README.md +++ b/_readme-cms/_templates/README.md @@ -1,32 +1,19 @@ # TACC CMS Project - Example - Templates -Templates specific to this project __must__ be in this directory. -Otherwise, they will be unavailable to [Core CMS] loading this project. +You may overwrite Core CMS templates and 3rd-party apps/plugin templates. -The directory structure here __should__ mirror [Core CMS]: - [`/taccsite_cms/templates`][core-tpl-dir] +## Page Templates -This consistency lets us override templates in Django fashion. +To make new templates available as page templates for CMS editors, replace or add to `CMS_TEMPLATES` setting. -[Core CMS]: https://github.com/TACC/Core-CMS -[core-tpl-dir]: https://github.com/TACC/Core-CMS/blob/main/taccsite_cms/static/site_cms - -## How to Write Template Path - -Where `name-of-project` is a CMS projects with custom templates: - -- `/name-of-project/templates/___.html` +## Overwrite Core -### How to Overwrite Core Templates - -1. Create a template of the same name here. -2. Reference the template (where needed) with the correct path. - -⚠️ A project __must not__ overwrite the Core CMS `base.html`. +1. Create a template of the same name as the [Core CMS template][core-tpl-dir] to overwrite. +2. Replace or extend the content of the overwritten template. ## Overwrite Apps or Plugins -You may overwrite apps [like Core][core-overwrite-doc]. -But you msut do so relative to this directory. +Follow [Core CMS instructions][core-tpl-doc], but within _this_ directory instead. -[core-overwrite-doc]: https://github.com/TACC/Core-CMS/tree/main/taccsite_cms/templates/README.md#overwrite-apps-or-plugins +[core-tpl-dir]: https://github.com/TACC/Core-CMS/blob/main/taccsite_cms/static/site_cms +[core-tpl-doc]: https://github.com/TACC/Core-CMS/tree/main/taccsite_cms/templates diff --git a/_readme-cms/settings_custom.py.md b/_readme-cms/settings_custom.py.md index af52446b..07f6bd53 100644 --- a/_readme-cms/settings_custom.py.md +++ b/_readme-cms/settings_custom.py.md @@ -1,6 +1,8 @@ # TACC CMS Project - Example - `settings_custom.py` -Populate a `settings_custom.py` only with settings that overwrite the defaults. +Populate a `settings_custom.py` only with: +- settings that overwrite the defaults +- import attempt of `taccsite_cms.settings_local` - default: [`settings.py`][default] - example: [`settings_custom.example.py`][example] diff --git a/a2cps-cms/settings_custom.py b/a2cps-cms/settings_custom.py index e3e25e0a..24f5c9ad 100644 --- a/a2cps-cms/settings_custom.py +++ b/a2cps-cms/settings_custom.py @@ -2,14 +2,16 @@ # TACC WMA CMS SITE: # *.A2CPS.TACC.UTEXAS.EDU +from taccsite_cms.settings import * ######################## # DJANGO CMS SETTINGS ######################## CMS_TEMPLATES = ( - ('a2cps-cms/templates/standard.html', 'Standard'), - ('a2cps-cms/templates/fullwidth.html', 'Full Width'), + ('standard.html', 'Standard'), + ('fullwidth.html', 'Full Width'), + ('guide.html', 'Guide'), ('guides/getting_started.html', 'Guide: Getting Started'), ('guides/data_transfer.html', 'Guide: Data Transfer'), @@ -17,6 +19,13 @@ ('guides/portal_technology.html', 'Guide: Portal Technology Stack') ) +# Deprecated Templates +# TODO: FP-1645: Remove +CMS_TEMPLATES += [ + ('a2cps-cms/templates/standard.html', 'Standard'), + ('a2cps-cms/templates/fullwidth.html', 'Full Width'), +] + ######################## # TACC: LOGOS ######################## @@ -35,3 +44,12 @@ FAVICON = { "img_file_src": "a2cps-cms/img/org_logos/favicon.ico" } + +######################## +# IMPORT & EXPORT +######################## + +try: + from taccsite_cms.settings_local import * +except ModuleNotFoundError: + pass diff --git a/a2cps-cms/templates/README.md b/a2cps-cms/templates/README.md new file mode 100644 index 00000000..cbae904d --- /dev/null +++ b/a2cps-cms/templates/README.md @@ -0,0 +1,8 @@ +# TACC CMS Project - * - Templates + +The root-level Core override templates are deprecated. + +For standard Core override templates, see: + +- `./taccsite_custom/*` +- `../settings_custom.py` diff --git a/a2cps-cms/templates/assets_custom.html b/a2cps-cms/templates/assets_custom.html deleted file mode 100644 index 41b66bd2..00000000 --- a/a2cps-cms/templates/assets_custom.html +++ /dev/null @@ -1,4 +0,0 @@ -{% load static %} - - - diff --git a/a2cps-cms/templates/fullwidth.html b/a2cps-cms/templates/fullwidth.html index c0f92047..a38b994b 100644 --- a/a2cps-cms/templates/fullwidth.html +++ b/a2cps-cms/templates/fullwidth.html @@ -1,8 +1,3 @@ {% extends "fullwidth.html" %} -{% load cms_tags %} -{% block assets_custom %} - {{ block.super }} - - {% include "./assets_custom.html" %} -{% endblock assets_custom %} +{# DEPRECATED TEMPLATE #} diff --git a/a2cps-cms/templates/standard.html b/a2cps-cms/templates/standard.html index f1cf9e22..07162210 100644 --- a/a2cps-cms/templates/standard.html +++ b/a2cps-cms/templates/standard.html @@ -1,8 +1,3 @@ {% extends "standard.html" %} -{% load cms_tags %} -{% block assets_custom %} - {{ block.super }} - - {% include "./assets_custom.html" %} -{% endblock assets_custom %} +{# DEPRECATED TEMPLATE #} diff --git a/a2cps-cms/templates/taccsite_cms/assets_custom.html b/a2cps-cms/templates/taccsite_cms/assets_custom.html new file mode 100644 index 00000000..68d24f08 --- /dev/null +++ b/a2cps-cms/templates/taccsite_cms/assets_custom.html @@ -0,0 +1,9 @@ +{% extends "assets_custom.html" %} +{% load cms_tags static %} + +{% block assets %} + {{ block.super }} + + + +{% endblock assets %} diff --git a/apcd-cms/settings_custom.py b/apcd-cms/settings_custom.py index 50175f4f..d677fde5 100644 --- a/apcd-cms/settings_custom.py +++ b/apcd-cms/settings_custom.py @@ -2,6 +2,7 @@ # TACC WMA CMS SITE: # *.APCD.TACC.UTEXAS.EDU +from taccsite_cms.settings import * ######################## # DJANGO CMS SETTINGS @@ -35,3 +36,12 @@ FAVICON = { "img_file_src": "apcd-cms/img/org_logos/favicon.ico" } + +######################## +# IMPORT & EXPORT +######################## + +try: + from taccsite_cms.settings_local import * +except ModuleNotFoundError: + pass diff --git a/brainmap-cms/settings_custom.py b/brainmap-cms/settings_custom.py index 0c01bbf6..949231f3 100644 --- a/brainmap-cms/settings_custom.py +++ b/brainmap-cms/settings_custom.py @@ -2,6 +2,8 @@ # TACC WMA CMS SITE: # *.BRAINMAP.TACC.UTEXAS.EDU +from taccsite_cms.settings import * + ######################## # DJANGO CMS SETTINGS ######################## @@ -87,3 +89,12 @@ FAVICON = { "img_file_src": "brainmap-cms/img/org_logos/favicon.ico" } + +######################## +# IMPORT & EXPORT +######################## + +try: + from taccsite_cms.settings_local import * +except ModuleNotFoundError: + pass diff --git a/ecep-cms/settings_custom.py b/ecep-cms/settings_custom.py index 04a0e155..3fa84dce 100644 --- a/ecep-cms/settings_custom.py +++ b/ecep-cms/settings_custom.py @@ -2,8 +2,7 @@ # TACC WMA CMS SITE: # *.ECEP.TACC.UTEXAS.EDU -# FAQ: Some _VARIABLES are duplicated from settings.py (but prefixed with "_") -# because current infrastructure lacks ability to reference default values +from taccsite_cms.settings import * ######################## # DJANGO CMS SETTINGS @@ -92,10 +91,7 @@ # NEWS / BLOG ######################## -from taccsite_cms.settings import INSTALLED_APPS - -tacc_app_index = INSTALLED_APPS.index('taccsite_cms') -INSTALLED_APPS[tacc_app_index:tacc_app_index] = [ +INSTALLED_APPS += [ # 'filer', # already in Core # 'easy_thumbnails', # already in Core 'parler', @@ -137,4 +133,13 @@ # CLIENT BUILD SETTINGS ######################## -ROOT_URLCONF = 'taccsite_custom.ecep-cms.urls' +ROOT_URLCONF = TACC_CUSTOM_ROOT + '.ecep-cms.urls' + +######################## +# IMPORT & EXPORT +######################## + +try: + from taccsite_cms.settings_local import * +except ModuleNotFoundError: + pass diff --git a/example-cms/settings_custom.py b/example-cms/settings_custom.py index c33d6255..e5ed9eec 100644 --- a/example-cms/settings_custom.py +++ b/example-cms/settings_custom.py @@ -2,6 +2,8 @@ # TACC WMA CMS SITE: # *.PROJECT_DOMAIN.TACC.UTEXAS.EDU +from taccsite_cms.settings import * + ######################## # DJANGO CMS SETTINGS ######################## @@ -61,3 +63,12 @@ # Should a user be able to see link to Portal? (default value: True) # INCLUDES_CORE_PORTAL = False # True to show login link, False to hide login link + +######################## +# IMPORT & EXPORT +######################## + +try: + from taccsite_cms.settings_local import * +except ModuleNotFoundError: + pass diff --git a/frontera-cms/settings_custom.py b/frontera-cms/settings_custom.py index 9d052346..4c52ae13 100644 --- a/frontera-cms/settings_custom.py +++ b/frontera-cms/settings_custom.py @@ -2,17 +2,17 @@ # TACC WMA CMS SITE: # *.FRONTERA-PORTAL.TACC.UTEXAS.EDU -# FAQ: Some _VARIABLES are duplicated from settings.py (but prefixed with "_") -# because current infrastructure lacks ability to reference default values +from taccsite_cms.settings import * ######################## # DJANGO CMS SETTINGS ######################## CMS_TEMPLATES = ( - ('frontera-cms/templates/standard.html', 'Standard'), - ('frontera-cms/templates/fullwidth.html', 'Full Width'), - ('frontera-cms/templates/home.html', 'Homepage'), + ('standard.html', 'Standard'), + ('fullwidth.html', 'Full Width'), + + ('home.html', 'Homepage'), ('guide.html', 'Guide'), ('guides/getting_started.html', 'Guide: Getting Started'), @@ -21,6 +21,14 @@ ('guides/portal_technology.html', 'Guide: Portal Technology Stack') ) +# Deprecated Templates +# TODO: FP-1645: Remove +CMS_TEMPLATES += ( + ('frontera-cms/templates/standard.html', 'DEPRECATED Standard'), + ('frontera-cms/templates/fullwidth.html', 'DEPRECATED Full Width'), + ('frontera-cms/templates/home.html', 'DEPRECATED Homepage'), +) + ######################## # TACC: BRANDING ######################## @@ -78,3 +86,12 @@ FAVICON = { "img_file_src": "frontera-cms/img/org_logos/favicon.ico" } + +######################## +# IMPORT & EXPORT +######################## + +try: + from taccsite_cms.settings_local import * +except ModuleNotFoundError: + pass diff --git a/frontera-cms/templates/README.md b/frontera-cms/templates/README.md new file mode 100644 index 00000000..cbae904d --- /dev/null +++ b/frontera-cms/templates/README.md @@ -0,0 +1,8 @@ +# TACC CMS Project - * - Templates + +The root-level Core override templates are deprecated. + +For standard Core override templates, see: + +- `./taccsite_custom/*` +- `../settings_custom.py` diff --git a/frontera-cms/templates/assets_custom.html b/frontera-cms/templates/assets_custom.html index f442c233..34c91a07 100644 --- a/frontera-cms/templates/assets_custom.html +++ b/frontera-cms/templates/assets_custom.html @@ -1,3 +1,5 @@ {% load static %} +{# DEPRECATED TEMPLATE #} + diff --git a/frontera-cms/templates/fullwidth.html b/frontera-cms/templates/fullwidth.html index 1fa0c518..bef0d371 100644 --- a/frontera-cms/templates/fullwidth.html +++ b/frontera-cms/templates/fullwidth.html @@ -1,6 +1,8 @@ {% extends "fullwidth.html" %} {% load cms_tags static %} +{# DEPRECATED TEMPLATE #} + {% block assets_custom %} {{ block.super }} diff --git a/frontera-cms/templates/home.html b/frontera-cms/templates/home.html index 3910d395..93a5b766 100644 --- a/frontera-cms/templates/home.html +++ b/frontera-cms/templates/home.html @@ -2,9 +2,7 @@ {% load cms_tags static %} {% block assets_custom %} - {{ block.super }} - - {% include "./assets_custom.html" %} + {% include "./taccsite_cms/assets_custom.html" %}