Skip to content

Commit

Permalink
Quick: Add tup-cms dir
Browse files Browse the repository at this point in the history
  • Loading branch information
wesleyboar committed May 7, 2021
1 parent 9a7ed6d commit 1fbdfb7
Show file tree
Hide file tree
Showing 9 changed files with 255 additions and 0 deletions.
Empty file added tup-cms/__init__.py
Empty file.
55 changes: 55 additions & 0 deletions tup-cms/secrets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# TACC CMS Per-Site Resources - Configuration

# In a project-specific configuration file like this, edit existing configuration values from `cms-site-template:/taccsite_cms/default_secrets.py` that must change to suit this project.

# Until this custom configuration is automatically applied, to use it one must copy the content of it and append it to `cms-site-template:/taccsite_cms/secrets.py`

# TUP CONFIGURATION

########################
# DJANGO CMS SETTINGS
########################

_CMS_TEMPLATES = (
('tup-cms/templates/fullwidth.html', 'Fullwidth')
)

########################
# GOOGLE ANALYTICS
########################

_GOOGLE_ANALYTICS_PROPERTY_ID = "UA-96034853-2"
_GOOGLE_ANALYTICS_PRELOAD = True

########################
# BRANDING & LOGOS
########################

# …

########################
# BRANDING.

_BRANDING = [_TACC_BRANDING, _UTEXAS_BRANDING]

########################
# LOGOS.

_PORTAL_LOGO = [
"tup",
"tup-cms/img/org_logos/tacc-logo.svg",
"",
"/",
"_self",
"TACC Logo",
"anonymous",
"True"
]

_LOGO = _PORTAL_LOGO

########################
# PORTAL
########################

_PORTAL = False
43 changes: 43 additions & 0 deletions tup-cms/snippets/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# TACC CMS Per-Site Resources - Example - Snippets

All snippet code specific to this project __must__ be placed in this directory. This allows us to version and source control snippet code. Failure to do so will result in snippet code loss upon data loss from database.

_This directory can alleviate danger #1 of [Why a Snippet Is Dangerous](#why-a-snippet-is-dangerous)._

## Important

1. The Core CMS __must not__ use any snippets. _They would be inaccessible to projects._
2. A CMS project __should not__ use any snippets. _They __may only__ be temporarily._

## Usage

In a CMS project:

1. Any snippet __must__ also be saved into this directory in its own file.
2. Any snippet file __must__ be kept up to date.[^1]

[^1]: For now, maintain snippet source code via internal team process.

## What a Snippet Is

A snippet is a __dangerous__ feature from the plugin [`djangocms-snippet`](https://github.com/divio/djangocms-snippet) which is installed in the CMS.

It allows an authorized CMS user to create a snippet of front-end web code (e.g. CSS, HTML, JS) in the database for use anywhere on the website.

## Why a Snippet Is Dangerous

1. 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:
- security
- dependency management
- style guide
- organization
- linting

## Why a Snippet Is Allowed

1. Support time-sensitive changes to the CMS.[^2]
2. Support ad-hoc changes by designer who codes.[^2]

[^2] This is permitted with the expectation that the snippet code is soon appropriately integrated into the repository.
20 changes: 20 additions & 0 deletions tup-cms/static/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# TACC CMS Per-Site Resources - Example - Static Files

All static files specific to this CMS project __must__ be placed here _within_ a directory whose name matches _the parent directory of this directory_. Failure to do so will make them unavailable via [Core CMS][core-cms-repo].

See [Core `static/README.md`](/taccsite_cms/static/README.md).


[core-cms-repo]: https://gitlab.tacc.utexas.edu/wma-cms/cms-site-template


## Clarification

Where `cms-project-a` and `cms-project-b` are unique CMS projects with custom resources:

- `cms-site-resources:/cms-project-a/static/cms-project-a/…`
- `cms-site-resources:/cms-project-b/static/cms-project-b/…`

The redundancy is intentional. The high-level instance isolates per-project resources. The low-level instance [namespaces the custom static files and templates][djangocms-custom-resources].

[djangocms-custom-resources]: https://docs.djangoproject.com/en/2.2/intro/tutorial06/#customize-your-app-s-look-and-feel
5 changes: 5 additions & 0 deletions tup-cms/static/tup-cms/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# TACC CMS Per-Site Resources - Example - Static Files (Namespaced)

The directory structure here __should__ mirror that of `/taccsite_cms/static/site_cms` in the [Core CMS][core-cms-repo]. This simplifies the effort of developing and maintaining multiple custom websites.

[core-cms-repo]: https://gitlab.tacc.utexas.edu/wma-cms/cms-site-template
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/* ELEMENTS: Main Root & Sectioning Root */

body {
/* FAQ: This color change merely illustrates that custom styles are working */
/* background-color: yellow; */
}
22 changes: 22 additions & 0 deletions tup-cms/static/tup-cms/css/src/site.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* DO NOT ADD STYLES HERE; ONLY IMPORT OTHER STYLESHEETS */

/* Organize via ITCSS */
/* SEE: https://confluence.tacc.utexas.edu/x/IAA9Cw */

/* SETTINGS */
/* … */

/* GENERICS */
/* … */

/* ELEMENTS */
@import url("_imports/elements/html-elements.css");

/* OBJECTS */
/* … */

/* COMPONENTS */
/* … */

/* TRUMPS */
/* … */
86 changes: 86 additions & 0 deletions tup-cms/static/tup-cms/img/org_logos/tacc-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions tup-cms/templates/fullwidth.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{% extends "base.html" %}
{% load cms_tags staticfiles %}

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

{% block assets_font %}
{{ block.super }}
{% endblock assets_font %}

{% block content %}
{% placeholder "content" %}
{% endblock content %}

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

<link rel="stylesheet" href="{% static 'tup-cms/css/build/site.css' %}">
{% endblock assets_custom %}

0 comments on commit 1fbdfb7

Please sign in to comment.