Skip to content

Commit

Permalink
Merge branch 'task/GH-101-header-redesign' into task/GH-101-header-re…
Browse files Browse the repository at this point in the history
…design--mobile-nav-layout-2
  • Loading branch information
wesleyboar committed Sep 2, 2021
2 parents bc09ec8 + 6401683 commit 3a5c088
Show file tree
Hide file tree
Showing 8 changed files with 104 additions and 18 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"description": "The core CMS codebase for all new and updated TACC CMS sites.",
"scripts": {
"build": "npm run build:css",
"build:css": "node postcss.js",
"build:css": "npm run settings && node postcss.js",
"watch": "npm-watch",
"settings": "python3 taccsite_cms/settings_to_json.py"
},
Expand Down
49 changes: 49 additions & 0 deletions taccsite_cms/contrib/bootstrap4_djangocms_link/cms_plugins.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# To support generic Link plugin without uninstalling Bootstrap4's
# FAQ: Bootstrap Link plugin has features not desirable within TACC plugins
# FAQ: We must not break sites that already use Bootstrap Link plugin
try:
# CAVEAT: Solution must be more than that for `bootstrap4_djangocms_picture`
# SEE: https://github.com/django-cms/djangocms-bootstrap4/pull/138
import copy

from django.utils.translation import gettext_lazy as _

from cms.plugin_pool import plugin_pool

from djangocms_link.cms_plugins import LinkPlugin
from djangocms_bootstrap4.contrib.bootstrap4_link.cms_plugins import Bootstrap4LinkPlugin

# To unlink Bootstrap's plugin fieldsets from Generic's
# SEE: https://github.com/django-cms/djangocms-bootstrap4/blob/2.0.0/djangocms_bootstrap4/contrib/bootstrap4_link/cms_plugins.py#L44
Bootstrap4LinkPlugin.fieldsets = copy.deepcopy(Bootstrap4LinkPlugin.fieldsets)

# To restore generic Link plugin fieldsets to state before Bootstrap's
# SEE: https://github.com/django-cms/djangocms-link/blob/3.0.0/djangocms_link/cms_plugins.py#L19-L24
# SEE: https://github.com/django-cms/djangocms-bootstrap4/blob/2.0.0/djangocms_bootstrap4/contrib/bootstrap4_link/cms_plugins.py#L38-L42
LinkPlugin.fieldsets[0] = (
None, {
'fields': (
'name',
('external_link', 'internal_link'),
)
}
)

# To signal to users that plugin is not desirable
Bootstrap4LinkPlugin.name = _('⚠️ Link / Button')
Bootstrap4LinkPlugin.fieldsets.insert(0, (
None, {
'description': _('⚠️ This plugin is <strong>deprecated</strong>. Please use "Generic" > "Link" plugin instead.<br /><small>If the "Generic" > "Link" plugin is inadequate, please inform the CMS development team.</small>'),
'fields': ()
}
))

# To re-register generic Link plugin
# SEE: https://github.com/django-cms/djangocms-bootstrap4/blob/master/djangocms_bootstrap4/contrib/bootstrap4_link/cms_plugins.py#L81
plugin_pool.register_plugin(LinkPlugin)

# To avoid server crash if Boostrap plugin is not registered
# CAVEAT: If import statement fails for reason other than Bootstrap presence,
# then that failure, and the failure of this plugin, is silent
except ImportError:
pass
29 changes: 29 additions & 0 deletions taccsite_cms/contrib/bootstrap4_djangocms_picture/cms_plugins.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# To support generic Image plugin without uninstalling Bootstrap's
# FAQ: Bootstrap Image plugin has features not desirable in TACC plugins
# FAQ: We must not break sites that already use Bootstrap Image plugin
try:
from django.utils.translation import gettext_lazy as _

from cms.plugin_pool import plugin_pool

from djangocms_picture.cms_plugins import PicturePlugin
from djangocms_bootstrap4.contrib.bootstrap4_picture.cms_plugins import Bootstrap4PicturePlugin

# To signal to users that plugin is not desirable
Bootstrap4PicturePlugin.name = _('⚠️ Picture / Image')
Bootstrap4PicturePlugin.fieldsets.insert(0, (
None, {
'description': _('⚠️ This plugin is <strong>deprecated</strong>. Please use "Generic" > "Image" plugin instead.<br /><small>If the "Generic" > "Image" plugin is inadequate, please inform the CMS development team.</small>'),
'fields': ()
}
))

# To re-register generic Picture plugin
# SEE: https://github.com/django-cms/djangocms-bootstrap4/blob/master/djangocms_bootstrap4/contrib/bootstrap4_picture/cms_plugins.py#L54
plugin_pool.register_plugin(PicturePlugin)

# To avoid server crash if Boostrap plugin is not registered
# CAVEAT: If import statement fails for reason other than Bootstrap presence,
# then that failure, and the failure of this plugin, is silent
except ImportError:
pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.2.16 on 2021-08-24 13:03

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('taccsite_data_list', '0001_initial'),
]

operations = [
migrations.AlterField(
model_name='taccsitedatalistitem',
name='key',
field=models.CharField(blank=True, help_text='A label for the data value.', max_length=50, verbose_name='Label'),
),
]
2 changes: 1 addition & 1 deletion taccsite_cms/default_secrets.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
# For standard pages (has Container and Breadcrumbs)
('standard.html', 'Standard'),
# For content that spans full window width (no Container nor Breadcrumbs)
('fullwidth.html', 'Fullwidth'),
('fullwidth.html', 'Full Width'),

# Any project that needs per-project styles must have a custom template
# FAQ: This is a tedious solution until a cleaner solution is devised
Expand Down
5 changes: 4 additions & 1 deletion taccsite_cms/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,14 @@ def getsecrets():
# SEE: https://stackoverflow.com/a/37150997
'test_without_migrations',
'taccsite_cms',
# Restore djangocms plugins that bootstrap4 hides
'taccsite_cms.contrib.bootstrap4_djangocms_link',
'taccsite_cms.contrib.bootstrap4_djangocms_picture',
# TODO: Extract TACC CMS UI components into pip-installable plugins
# FAQ: The djangocms_bootstrap4 library can serve as an example
'taccsite_cms.contrib.taccsite_sample',
'taccsite_cms.contrib.taccsite_system_monitor',
'taccsite_cms.contrib.taccsite_data_list',
'taccsite_cms.contrib.taccsite_data_list'
]

# Convert list of paths to list of dotted module names
Expand Down
15 changes: 1 addition & 14 deletions taccsite_cms/templates/fullwidth.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,7 @@

{% block title %}{% page_attribute "page_title" %}{% endblock title %}

{% block assets_custom %}
{{ block.super }}

<script>
console.info('Core `fullwidth.html` loads no custom assets');
</script>
{% endblock assets_custom %}

{# To remove container and breadcrumbs #}
{% block content %}
{% placeholder "content" %}
{% endblock content %}

{% block assets_custom_delayed %}
<script>
console.info('Core `fullwidth.html` loads no (delayed) custom assets');
</script>
{% endblock assets_custom_delayed %}

0 comments on commit 3a5c088

Please sign in to comment.