From 0aad6ac2d64cb8a6434aa55ce0b551585a5dfe86 Mon Sep 17 00:00:00 2001 From: Wesley B <62723358+wesleyboar@users.noreply.github.com> Date: Thu, 12 Sep 2024 19:14:30 -0500 Subject: [PATCH 1/2] feat: CMD-97 isolate breadcrumbs from content (#870) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor: CMD-97 breadcrumbs for news via 1 template * idea: TUP-706 4.a.i change RSS feed render ⚠️ NOT WORKING! Fails with: > NoReverseMatch at /feed/ > '' is not a registered namespace * refactor: TUP-706 rename and document blog block * feat: TUP-706 render page with only (*_)content * fix: TUP-706 disable failed djangocms_blog_c… url * idea!: TUP-706 render blog base via custom app Fails, because it renders nothing. * feat!: TUP-706 render remote url content Load `/blog/remote`. BREAKING CHANGE: Changed `/blog` to `/blog/local` * chore: TUP-706 move an import higher in file * feat: TUP-706 render remote url via setting * fix: TUP-706 render blog customizations * fix: TUP-706 render feed ⚠️ ⚠️ Does NOT render feed items. * docs: TUP-706 describe each URL's problem * docs: TUP-706 describe each URL goal and status * feat: TUP-706 A.1+3.c remote markup via template * feat: TUP-706 A.1.a. support BLOG_MULTISITE * fix: TUP-706 A.1.a. cannot login to site 2 * Revert "fix: TUP-706 A.1.a. cannot login to site 2" This reverts commit 6bece398c8d86beeee6b7852f5889cad6eb55480. This did not fix anything. `SESSION_COOKIE_SECURE=False` is still required locally. * docs: TUP-706 feed status (ineffectual) * docs: tup-706 urls for local and remote * feat(poc): TUP-706 get news from remote url Messy but functional! * chore: remove test print statements from feeds * core: clean up views * core: clean up views more * refactor: switch order of methods in view class * feat: TUP-706 edit links via get_client_markup() * fix: TUP-706 broken links - ✓ fix links to articles - ✓ fix pagination links * chore: remove tup-706 work / isolate CMD-97 work * feat: tup-706 isolate breadcrumbs from news * chore: taccsite_custom PR merged * fix: fullwidth template failed for news * fix: taccsite_custom changes to match * chore: taccsite_custom PR merged * style: remove new line, reduce diff --- taccsite_cms/templates/base.html | 21 ++++++++++++------- .../templates/djangocms_blog/base.html | 12 +++++++++-- .../templates/djangocms_blog/post_detail.html | 8 ------- .../templates/djangocms_blog/post_list.html | 7 ------- taccsite_cms/templates/fullwidth.html | 5 ++++- taccsite_custom | 2 +- 6 files changed, 29 insertions(+), 26 deletions(-) diff --git a/taccsite_cms/templates/base.html b/taccsite_cms/templates/base.html index 161a10bb7..e8fea82a3 100755 --- a/taccsite_cms/templates/base.html +++ b/taccsite_cms/templates/base.html @@ -70,15 +70,22 @@
{% block content %} - {# To allow extra Container in page structure by hiding extra padding #} + {# To hide extra space that a nested/redundant Container would add #} - - {# To wrap breadcrumbs in Container without relying on CMS editor #} -
- {% include "nav_cms_breadcrumbs.html" %} - {% placeholder "content" %} + {# To wrap content in Container without relying on CMS editor #} +
+ {% block breadcrumbs %} + {% include "nav_cms_breadcrumbs.html" %} + {% endblock breadcrumbs %} + + {% block cms_content %} + {% placeholder "content" %} + {% endblock cms_content %} + + {# To isolate content editor cannot change layout of (e.g. Blog) #} + {% block app_content %}{% endblock app_content %}
{% endblock content %} diff --git a/taccsite_cms/templates/djangocms_blog/base.html b/taccsite_cms/templates/djangocms_blog/base.html index 4e4688fb7..3ed1dc497 100644 --- a/taccsite_cms/templates/djangocms_blog/base.html +++ b/taccsite_cms/templates/djangocms_blog/base.html @@ -13,7 +13,13 @@ {% endif %} {% endblock meta %} -{% block content %} +{# TACC (to not let editor add content to every blog page): #} +{% block cms_content %}{% endblock cms_content %} +{# /TACC #} + +{# TACC (to not let blog usurp `{% block "content" %}`): #} +{% block app_content %} +{# /TACC #} {% if settings.TACC_CORE_STYLES_VERSION == 0 %} @@ -33,4 +39,6 @@ {% block content_blog %}{% endblock %}
-{% endblock content %} +{# TACC (to not let blog usurp `{% block "content" %}`): #} +{% endblock app_content %} +{# /TACC #} diff --git a/taccsite_cms/templates/djangocms_blog/post_detail.html b/taccsite_cms/templates/djangocms_blog/post_detail.html index 28929a86f..87add62d3 100644 --- a/taccsite_cms/templates/djangocms_blog/post_detail.html +++ b/taccsite_cms/templates/djangocms_blog/post_detail.html @@ -3,12 +3,7 @@ {% load i18n easy_thumbnails_tags cms_tags blog_post_use_custom_media blog_post_is_show_abstract %} {% block content_blog %}{% spaceless %} -{# TACC (wrap and add breadcrumbs): #} -
-{% include "nav_cms_breadcrumbs.html" %} - -{# /TACC #} {# TACC (define whether this is a special post): #} {% blog_post_use_custom_media post settings.PORTAL_BLOG_CUSTOM_MEDIA_POST_CATEGORY as use_custom_media %} {% blog_post_is_show_abstract post settings.PORTAL_BLOG_SHOW_ABSTRACT_TAG as is_show_abstract_post %} @@ -88,9 +83,6 @@

{% render_model post "subtitle" %}

{% endif %} {# TACC (end wrap and end spaceless-ness later than source): #} - -
{% endspaceless %} - {# /TACC #} {% endblock content_blog %} diff --git a/taccsite_cms/templates/djangocms_blog/post_list.html b/taccsite_cms/templates/djangocms_blog/post_list.html index 921ec7cb5..1d7aa3010 100644 --- a/taccsite_cms/templates/djangocms_blog/post_list.html +++ b/taccsite_cms/templates/djangocms_blog/post_list.html @@ -5,10 +5,6 @@ {% block canonical_url %}{% endblock canonical_url %} {% block content_blog %} -{# TACC (wrap list in container w/ breadcrumbs to mimic other page layouts): #} -
-{% include "nav_cms_breadcrumbs.html" %} -{# /TACC #}
{% block blog_title %} @@ -82,8 +78,5 @@

{% endif %}

-{# TACC (wrap list in container w/ breadcrumbs to mimic other page layouts): #} -
-{# /TACC #} {% endblock %} {% endspaceless %} diff --git a/taccsite_cms/templates/fullwidth.html b/taccsite_cms/templates/fullwidth.html index 9d9155095..57d83af0e 100755 --- a/taccsite_cms/templates/fullwidth.html +++ b/taccsite_cms/templates/fullwidth.html @@ -5,5 +5,8 @@ {# To remove container and breadcrumbs #} {% block content %} -{% placeholder "content" %} + {% block cms_content %} + {% placeholder "content" %} + {% endblock cms_content %} + {% block app_content %}{% endblock app_content %} {% endblock content %} diff --git a/taccsite_custom b/taccsite_custom index e55bfc8c9..e8081e68c 160000 --- a/taccsite_custom +++ b/taccsite_custom @@ -1 +1 @@ -Subproject commit e55bfc8c91ccc7520fd38633a1bdf6dc4b7d18cb +Subproject commit e8081e68c77006aeb1f219c320b6c4a62f25f9d1 From 8490e4ca089e3d4c04f42d49de1619dd284cb87e Mon Sep 17 00:00:00 2001 From: Wesley B <62723358+wesleyboar@users.noreply.github.com> Date: Fri, 13 Sep 2024 15:43:41 -0500 Subject: [PATCH 2/2] feat: tup 706 be able to serve blog markup raw (#871) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor: CMD-97 breadcrumbs for news via 1 template * idea: TUP-706 4.a.i change RSS feed render ⚠️ NOT WORKING! Fails with: > NoReverseMatch at /feed/ > '' is not a registered namespace * refactor: TUP-706 rename and document blog block * feat: TUP-706 render page with only (*_)content * fix: TUP-706 disable failed djangocms_blog_c… url * idea!: TUP-706 render blog base via custom app Fails, because it renders nothing. * feat!: TUP-706 render remote url content Load `/blog/remote`. BREAKING CHANGE: Changed `/blog` to `/blog/local` * chore: TUP-706 move an import higher in file * feat: TUP-706 render remote url via setting * fix: TUP-706 render blog customizations * fix: TUP-706 render feed ⚠️ ⚠️ Does NOT render feed items. * docs: TUP-706 describe each URL's problem * docs: TUP-706 describe each URL goal and status * feat: TUP-706 A.1+3.c remote markup via template * feat: TUP-706 A.1.a. support BLOG_MULTISITE * fix: TUP-706 A.1.a. cannot login to site 2 * Revert "fix: TUP-706 A.1.a. cannot login to site 2" This reverts commit 6bece398c8d86beeee6b7852f5889cad6eb55480. This did not fix anything. `SESSION_COOKIE_SECURE=False` is still required locally. * docs: TUP-706 feed status (ineffectual) * docs: tup-706 urls for local and remote * feat(poc): TUP-706 get news from remote url Messy but functional! * chore: remove test print statements from feeds * core: clean up views * core: clean up views more * refactor: switch order of methods in view class * feat: TUP-706 edit links via get_client_markup() * fix: TUP-706 broken links - ✓ fix links to articles - ✓ fix pagination links * feat: isolate breadcrumbs from content and news * chore: remove unnecessary app This app is fom a different branch. * chore: remove unnecessary middleware This middleware is fom a different branch. * fix: do not load missing app and middleware * fix: remove unnecessary setting This setting is from another branch. * fix: use correct name for app_content * style: new line * fix: raw template logic outdated * fix: bad merge resolution * fix: bad merge resolution * docs: how to serve raw content --- taccsite_cms/settings_custom.example.py | 4 ++++ taccsite_cms/templates/raw.html | 10 ++++++++++ 2 files changed, 14 insertions(+) create mode 100755 taccsite_cms/templates/raw.html diff --git a/taccsite_cms/settings_custom.example.py b/taccsite_cms/settings_custom.example.py index 5ad8ff017..e347a3447 100644 --- a/taccsite_cms/settings_custom.example.py +++ b/taccsite_cms/settings_custom.example.py @@ -40,6 +40,10 @@ ('guides/data_transfer.html', 'Guide: Data Transfer'), ('guides/data_transfer.globus.html', 'Guide: Globus Data Transfer'), ('guides/portal_technology.html', 'Guide: Portal Technology Stack'), + + # WARNING: Not intuitive to unset, so only enable as needed e.g. + # - serve Blog such that it can be injected into another CMS + # ('raw.html', 'Raw'), ) ######################## diff --git a/taccsite_cms/templates/raw.html b/taccsite_cms/templates/raw.html new file mode 100755 index 000000000..f4df3983f --- /dev/null +++ b/taccsite_cms/templates/raw.html @@ -0,0 +1,10 @@ +{# To reduce output to only content #} +{% load cms_tags %} + +{# To remove container and breadcrumbs #} +{% block content %} + {% block cms_content %} + {% placeholder "content" %} + {% endblock cms_content %} + {% block app_content %}{% endblock app_content %} +{% endblock content %}