Skip to content

Commit

Permalink
Squashed merge of task/GH-310-breadcrumbs at commit 13276af
Browse files Browse the repository at this point in the history
  • Loading branch information
wesleyboar committed Aug 13, 2021
1 parent 4322513 commit b9a1a93
Show file tree
Hide file tree
Showing 10 changed files with 143 additions and 8 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,28 @@ To support multiple instances of the CMS on one machine (i.e. local development)
docker-compose -f docker-compose.custom.yml …
```
### (Optional) Migrate Website from Older Version
Some websites need static resources to supplement their migration.
1. __If__ you did not [create your project by cloning `example-cms`](#custom-resources), __then__:
1. Copy `templates/fullwidth.html` from `taccsite_custom/example-cms/` to `taccsite_custom/name-of-project/`.
2. Copy `static/.../css/src/migrate.v1_v2.css` from `taccsite_custom/example-cms/` to `taccsite_custom/name-of-project/`.
2. Update `taccsite_custom/name-of-project/templates/fullwidth.html` to load migration assets e.g.:
- Change
```html
<!-- To style old CMS content on new CMS -->
<!-- <link rel="stylesheet" href="{% static 'example-cms/css/build/migrate.v1_v2.css' %}"> -->
```
- To
```html
<!-- To style old CMS content on new CMS -->
<link rel="stylesheet" href="{% static 'name-of-project/css/build/migrate.v1_v2.css' %}">
```
## Run the CMS
### Prerequisites
Expand Down
15 changes: 12 additions & 3 deletions taccsite_cms/static/site_cms/css/src/_imports/trumps/README.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
Trumps
Trump styles exist to overwrite other styles. They are added as necessary. Examples use cases are third-party styles, styles used only by JavaScript, modules that are not meant to extended as desired.
Trump styles exist to overwrite other styles. They are added as necessary. Examples use cases are third-party styles, styles used only by JavaScript, modules that are not meant to be extended.
Reference:
Expand All @@ -25,15 +25,24 @@ Styleguide Trumps
/*
Scopes
Scope styles are overrides and styles that are scoped to a specific area. These are meant to be used sparingly. Examples of scopes are styles for third-party markup, WYSIWIG editor tags, form elements, components with a forced relationship.
Scope styles are overrides and styles that are scoped to a specific area. These are meant to be used sparingly. Examples of scopes are styles for:
- third-party markup, e.g.:
- social media widget
- external authentication form
- internal Bootstrap-dependent markup
- enforcing internal markup (e.g. breadcrumbs, form elements, document pages)
- WYSIWIG editor tags (e.g. CMS WYSIWIG content entry)
- coupled components (i.e. components interwoven in unique situations), e.g.:
- Frontera homepage before all styling used plugins
- article previews within an article list
Reference:
- [BEM with Namespaces: Scope Namespaces](https://csswizardry.com/2015/03/more-transparent-ui-code-with-namespaces/#scope-namespaces-s-)
Guidelines:
- Scopes are pretty rare, evaluate before creating.
- Scopes should be rare; evaluate before creating.
- A consistent way to author these in nested inside `.s-* {}`.
Rules:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
Breadcrumbs
A list of links and to ancestor navigation (pages or sections that are a parent, grandparent, et cetera of the current page or section).
Notice: A scope class is used to enforce appropriate semantic HTML.
Markup:
<!-- major navigation -->
<nav class="s-breadcrumbs">
<ol>
<li><a href="/"><span>Home</span></a></li>
<li><a href="/"><span>Science</span></a></li>
<li><span>Publications</span></li>
</ol>
</nav>
<!-- minor navigation -->
<ol class="s-breadcrumbs">
<li><a href="/"><span>Home</span></a></li>
<li><a href="/"><span>Science</span></a></li>
<li><span>Publications</span></li>
</ol>
Styleguide Trumps.Scopes.Breadcrumbs
*/
@import url("_imports/tools/x-truncate.css");





/* Base i.e. Container */

nav.s-breadcrumbs {
padding-top: 15px;

font-size: var(--global-font-size--x-small);

text-transform: uppercase;
}



/* Elements i.e. Content */

nav.s-breadcrumbs ol {
list-style: none;
}

ol.s-breadcrumbs li,
.s-breadcrumbs ol li {
display: inline-block;
}

ol.s-breadcrumbs li + li::before,
.s-breadcrumbs ol li + li::before {
content: ' > ';
}

.s-breadcrumbs ol li:last-child span {
font-weight: var(--bold);
}
3 changes: 2 additions & 1 deletion taccsite_cms/static/site_cms/css/src/site.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
/* SETTINGS */
/* Shared with Portal */
@import url("_imports/settings/border.css");
@import url("_imports/settings/color.css");
/* Unique to CMS */
@import url("_imports/settings/color.css");
@import url("_imports/settings/props.max-width.css");
@import url("_imports/settings/props.space.css");
@import url("_imports/settings/font.css");
Expand Down Expand Up @@ -41,6 +41,7 @@

/* TRUMPS */
@import url("_imports/trumps/s-article-list.css");
@import url("_imports/trumps/s-breadcrumbs.css");
@import url("_imports/trumps/s-footer.css");
@import url("_imports/trumps/s-blockquote.css");
@import url("_imports/trumps/u-empty.css");
Binary file modified taccsite_cms/static/site_cms/img/org_logos/tacc-white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions taccsite_cms/templates/fullwidth.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
{% endblock assets_custom %}

{% block content %}
{% include "nav_cms_breadcrumbs.html" %}
{% placeholder "content" %}
{% endblock content %}

Expand Down
24 changes: 24 additions & 0 deletions taccsite_cms/templates/menu/breadcrumb.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{# SEE: https://github.com/django-cms/django-cms/blob/release/3.6.x/menus/templates/menu/breadcrumb.html #}
{% for ance in ancestors %}

{# To support structured data, item* attributes are used #}
{# SEE: https://confluence.tacc.utexas.edu/x/5yMFDg #}
<li itemscope itemprop="itemListElement"
itemtype="https://schema.org/ListItem">

{% if not forloop.last %}

<a href="{{ ance.get_absolute_url }}" itemprop="item">
<span itemprop="name">{{ ance.get_menu_title }}</span>
</a>

{% else %}

<span itemprop="name">{{ ance.get_menu_title }}</span>

{% endif %}

<meta itemprop="position" content="{{ forloop.counter }}" />
</li>

{% endfor %}
16 changes: 16 additions & 0 deletions taccsite_cms/templates/nav_cms_breadcrumbs.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{# @var className #}
{% load menu_tags %}

<nav class="s-breadcrumbs {{className}}">

{# To support structured data, item* attributes are used #}
{# SEE: https://confluence.tacc.utexas.edu/x/5yMFDg #}
<ol itemscope itemtype="https://schema.org/BreadcrumbList">

{# To include pages marked to not show in menu, attributes are added #}
{# SEE: https://docs.django-cms.org/en/release-3.6.x/reference/navigation.html#show-breadcrumb #}
{% show_breadcrumb 0 "menu/breadcrumb.html" 0 %}

</ol>

</nav>
6 changes: 3 additions & 3 deletions taccsite_cms/templates/snippets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ _This directory can alleviate danger #1 of [Why a Snippet Is Dangerous](#why-a-s

1. The Core CMS __must not__ use any snippets __for production__. _They __should only__ be for testing._
2. A CMS project __should not__ use any snippets. _They __may only__ be temporarily._
3. A CMS project snippet __must__ be saved into its respective snippets directory, `/code/taccsite_custom/name-of-project/static`.
3. A CMS project snippet __must__ be saved into its respective snippets directory, `/code/taccsite_custom/name-of-project/templates/snippets`.
4. Any snippet file __must__ be kept up to date with its snippet.[^1]

[^1]: For now, maintain snippet source code via internal team process.
Expand All @@ -21,9 +21,9 @@ It allows an authorized CMS user to create a snippet of front-end web code (e.g.

## Why a Snippet Is Dangerous

1. The code is dependent on the (unsynced) database, because it is not under:
1. (Unless saved) The code is dependent on the (unsynced) database, because it is not under:
- source/version control
2. The code is independent of any other code control:
2. The code may be authored independent of any other code control:
- security
- dependency management
- style guide
Expand Down
2 changes: 1 addition & 1 deletion taccsite_custom
Submodule taccsite_custom updated 25 files
+8 −0 _shared/__init__.md
+0 −0 _shared/__init__.py
+15 −0 _shared/static/css/src/README.md
+38 −0 _shared/static/css/src/_migrations/README.md
+6 −6 _shared/static/css/src/_migrations/v1_v2/angular-material.1.1.8.css
+26 −10 _shared/static/css/src/_migrations/v1_v2/bootstrap.3.3.7.css
+29 −0 _shared/static/css/src/_migrations/v1_v2/main.portal.css
+5 −0 _shared/static/css/src/migrate.v1_v2.css
+1 −0 a2cps-cms/snippets/gh-245-markup-single-paragraph-whitespace.html
+114 −0 a2cps-cms/static/a2cps-cms/css/src/_migrations/v1_v2/a2cps.css
+4 −0 a2cps-cms/static/a2cps-cms/css/src/migrate.v1_v2.css
+4 −1 a2cps-cms/templates/fullwidth.html
+3 −0 example-cms/static/example-cms/css/src/migrate.v1_v2.css
+4 −0 example-cms/templates/fullwidth.html
+8 −0 frontera-cms/secrets.py
+0 −16 frontera-cms/static/frontera-cms/css/archive/main.portal.css
+0 −7 frontera-cms/static/frontera-cms/css/src/_imports/components/tacc.c-footer.css
+10 −4 frontera-cms/static/frontera-cms/css/src/_migrations/v1_v2/frontera.css
+5 −0 frontera-cms/static/frontera-cms/css/src/migrate.v1_v2.css
+1 −1 frontera-cms/static/frontera-cms/css/src/site.css
+5 −0 frontera-cms/static/frontera-cms/img/org_logos/tacc-white.md
+ frontera-cms/static/frontera-cms/img/org_logos/tacc-white.png
+7 −7 frontera-cms/templates/fullwidth.html
+3 −0 neuronex-cms/static/neuronex-cms/css/src/migrate.v1_v2.css
+4 −0 neuronex-cms/templates/fullwidth.html

0 comments on commit b9a1a93

Please sign in to comment.