Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions taccsite_cms/settings/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,8 @@ def gettext(s): return s
########################

PORTAL_IS_TACC_CORE_PORTAL = True
PORTAL_HOSTS_NAV = True
PORTAL_LOADS_NAV = True
PORTAL_HAS_LOGIN = True
PORTAL_HAS_SEARCH = True
PORTAL_LOGIN_PATH = '/login'
Expand Down Expand Up @@ -728,6 +730,8 @@ def get_subdirs_as_module_names(path):
'PORTAL_LOGO',
'PORTAL_FAVICON',
'PORTAL_IS_TACC_CORE_PORTAL',
'PORTAL_HOSTS_NAV',
'PORTAL_LOADS_NAV',
'PORTAL_HAS_LOGIN',
'PORTAL_LOGIN_PATH',
'PORTAL_HAS_SEARCH',
Expand Down
2 changes: 2 additions & 0 deletions taccsite_cms/settings/settings_local.example.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,6 @@
# To disable the Core-Portal integration
# IMPORTANT: Do not disable by default, because [Core-Portal clones this file](https://github.com/TACC/Core-Portal/pull/1034)
# PORTAL_IS_TACC_CORE_PORTAL = False
# PORTAL_HOSTS_NAV = False
# PORTAL_LOADS_NAV = False
# PORTAL_HAS_LOGIN = False
9 changes: 6 additions & 3 deletions taccsite_cms/templates/nav_portal.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@

</ul>

{% if settings.PORTAL_IS_TACC_CORE_PORTAL %}
<script type="module">
{% if settings.PORTAL_IS_TACC_CORE_PORTAL or settings.PORTAL_HOSTS_NAV %}
<script type="module" id="portal-nav-loader">
import * as importHTML from '/static/site_cms/js/modules/importHTML.js';

const container = document.getElementById('portal-nav');

await importHTML.insertFromURL('/core/markup/nav', container);

</script>
{% endif %}
{% if settings.PORTAL_IS_TACC_CORE_PORTAL %}
<script type="module" id="bootstrap-toggle-compatibility">
/* Make (Portal) Bootstrap 5 toggle compatible with (CMS) Bootstrap 4 */
[ ...container.querySelectorAll('[data-bs-toggle]')].forEach(toggle => {
const portalUsesBootstrap5Toggle = (
Expand Down
4 changes: 2 additions & 2 deletions taccsite_cms/templates/nav_portal.raw.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<!-- FAQ: This template mimics Portal's `nav_portal.raw.html`
so CMS can render similar "Login" button for different portal -->

{% if settings.PORTAL_IS_TACC_CORE_PORTAL %}
<!-- TACC/Core-Portal should overwrite this content -->
{% if settings.PORTAL_IS_TACC_CORE_PORTAL or settings.PORTAL_HOSTS_NAV %}
<!-- Portal should overwrite this content -->
{% else %}
<li class="nav-item">
<a class="nav-link" href="{{ settings.PORTAL_LOGIN_PATH }}">
Expand Down
10 changes: 8 additions & 2 deletions taccsite_cms/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@
url(r'^', include('djangocms_forms.urls')),
]

if getattr(settings, 'PORTAL_IS_TACC_CORE_PORTAL', True):
if (
getattr(settings, 'PORTAL_IS_TACC_CORE_PORTAL', True) or
getattr(settings, 'PORTAL_LOADS_NAV', False)
):
urlpatterns += [
# To allow direct access to markup for Portal to render
url(r'^cms/nav/search/markup/$', TemplateView.as_view(template_name='nav_search.raw.html'), name='search_bar_markup'),
Expand All @@ -49,7 +52,10 @@
except ModuleNotFoundError:
pass

if getattr(settings, 'PORTAL_IS_TACC_CORE_PORTAL', True):
if (
getattr(settings, 'PORTAL_IS_TACC_CORE_PORTAL', True) or
getattr(settings, 'PORTAL_HOSTS_NAV', False)
):
urlpatterns += [
# To provide markup if TACC/Core-Portal is missing
url(r'^core/markup/nav/$', TemplateView.as_view(template_name='nav_portal.raw.html'), name='portal_nav_markup'),
Expand Down