Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-191: Theme (for ProTX Light Header & TACC Blue Header) #192

Merged
merged 63 commits into from
Sep 22, 2021

Conversation

wesleyboar
Copy link
Member

@wesleyboar wesleyboar commented Apr 14, 2021

Status

  • 2021-04-27: No rush to do, because ProTX runs on an image with it.
  • 2021-05-12: Need to do, so env variables are available for Header Redesign → FP-1458 #101.
  • 2021-09-03: [ same status | improved "To Do" list ]
  • 2021-09-21: Begin update to use new CMS settings setup.

To Do

Done
Footnotes
1. Use Old Theme Management Code
  • Distinguish theme via .env file value. 396c018 changes this to use secrets.py.
2. Use New Theme Management Code
3. TACC/ProTX Out of Date
  1. ProTX Portal is from TACC/proTX.
  2. https://pprd.protx.tacc.utexas.edu/core/markup/nav returns 404
  3. CMS expects markup from /core/markup/nav via https://github.com/TACC/Core-CMS/blob/main/taccsite_cms/templates/nav_portal.html#L16
  4. Portal should load template nav_portal.raw.html via https://github.com/TACC/Core-Portal/blob/main/server/portal/urls.py#L52
  5. https://github.com/TACC/protx/tree/main/server/portal/templates/includes is missing nav_portal.raw.html (added 5 months ago at 64e93ef)
4. Merged by Tester out of Urgency

Screenshots not updated, but code was deployed and testable.

The ProTX (Pre-Prod) use case—which I allowed to delay updated screenshots—had an issue that was related to Portal code, not CMS code. Tester did not need updated screenshots.

5. Research Tasks

Overview

  1. Support a light navbar for dark logo via:
  2. Use CSS color variables in header and footer.
  3. Fix related bugs and comments.

Issues

Changes

  • document solution
  • use new env() variables* to apply theme
  • allow Node to read Python settings
(complete changelog)
  • Doc: Explain .env file via new .env.sample.
  • Minor: Git Ignore settings.json.
  • Doc: Mention new .env.sample in README.
  • New: Support native* built-time variables a.k.a. env() variables*.
  • New: Auto-run settings_to_json.py before npm run build.
  • Minor: Add Python utility script to hide python print statements.
  • New: Add _THEME to secrets/settings.
  • New: New Python script to export select secrets/settings to JSON.
  • New: Apply theme via env() variables* and dark logo.
  • Minor: Fix relevant search bar Bootstrap form control style bug.
  • New: Improve comment in site.header.css.
  • Doc: Explain document assets needed by Portal and Doc.
* Are these .env variables a widely-supported web standard?
  • Usage, yes. It has already been supported in all modern browsers.
  • Assignment, no. We use a polyfill postcss-env-function (via postcss-preset-env).

Testing

Last recorded deploys:

Test that these _THEME values do not crash and result in the expected header theme:

  • no entry — default (dark header) theme
  • no value — default (dark header) theme
  • has-dark-logo — new light header theme
  • default — default (dark header) theme
  • bob — unable to build CSS
Detailed Walkthrough

No Theme — Default

  1. Do not add THEME to secrets.py.
  2. (if testing locally) Run npm run build.
  3. See no errors.
  4. Load CMS to watch it build "default theme" (imperceptible style change).
    • This tests THEME is not required.
    • This tests the "default" THEME as a fallback.
    • This tests env() variables.
    • This tests minor style changes.

Empty Theme i.e. Default

  1. Do add THEME setting with None value.
  2. (if testing locally) Run npm run build.
  3. See no errors.
  4. Restart CMS and load page to see same "default theme".
    • This tests THEME may be empty.
    • This tests the "default" THEME as a fallback.
    • This tests env() variables.
    • This tests minor style changes.

has-dark-logo Theme

  1. Now change THEME setting to has-dark-logo.
  2. (if testing locally) Run npm run build.
  3. See no errors.
  4. Reload CMS page to see light (for ProTX) header.

default Theme

  1. Now change THEME setting to default.
  2. (if testing locally) Run npm run build.
  3. See no errors.
  4. Reload CMS page to see dark (default) header.
    • This tests the "default" THEME as a choice.
    • This tests THEME works with known value.
    • This tests env() variables.

Unknown THEME i.e. Failure

  1. Now change THEME setting to bob.
  2. (if testing locally) Run npm run build.
  3. See error(s).
    • This tests the "default" THEME as a choice.
    • This tests THEME fails with unknown value.
    • This tests THEME works with known value.
    • This tests env() variables.

Screenshots

CMS (Might be Out of Date)

Light Navbar For Dark Logo
Light Navbar

Dark Navbar For Most Logos
Dark Navbar

Notes

  1. Does Not Implement New Header Design

    New header design comes via GH-101/FP-1458: Header Redesign #222, which relies on this PR.

- Restore missing line between search bar and portal nav
- (Simplify CSS of line between search bar and portal nav)
- Do not let background show through search bar.
- (This happens now because of a color replacement.)
@wesleyboar wesleyboar linked an issue Apr 14, 2021 that may be closed by this pull request
@wesleyboar wesleyboar requested a review from taoteg April 14, 2021 14:08
@wesleyboar wesleyboar marked this pull request as ready for review April 14, 2021 14:08
@wesleyboar wesleyboar force-pushed the task/GH-191-support-light-navbar-for-dark-logos branch from a2a5834 to cde3be7 Compare April 14, 2021 20:42
@wesleyboar wesleyboar force-pushed the task/GH-191-support-light-navbar-for-dark-logos branch from 67149c2 to a86a5e5 Compare April 15, 2021 17:55
Copy link
Member Author

@wesleyboar wesleyboar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of having CSS's runtime variables (custom properties) use build-time variables to result in baking in the THEME styles. Thus, Portal and User Guide need not load any script nor access any API.

taccsite_cms/api/settings/views.py Outdated Show resolved Hide resolved
@wesleyboar wesleyboar marked this pull request as draft April 16, 2021 19:12
@wesleyboar wesleyboar force-pushed the task/GH-191-support-light-navbar-for-dark-logos branch from 3eb2f32 to c3922e2 Compare April 19, 2021 23:30
@wesleyboar wesleyboar added paused Started but not actively in progress priority ▲ High priority labels Jul 3, 2021
@wesleyboar wesleyboar marked this pull request as draft July 6, 2021 21:37
@wesleyboar
Copy link
Member Author

When I un-pause this PR, I will re-open it.

@wesleyboar wesleyboar closed this Jul 30, 2021
@wesleyboar wesleyboar removed the paused Started but not actively in progress label Sep 3, 2021
@wesleyboar
Copy link
Member Author

Un-pausing. #222 both needs this and should be finished this year.

@wesleyboar wesleyboar reopened this Sep 3, 2021
@wesleyboar wesleyboar changed the title Task/gh 191 support light navbar for dark logos GH-191: Theme (for ProTX Light & TACC Blue Headers) Sep 3, 2021
@wesleyboar wesleyboar changed the title GH-191: Theme (for ProTX Light & TACC Blue Headers) GH-191: Theme (for ProTX Light Header & TACC Blue Header) Sep 3, 2021
Copy link
Member Author

@wesleyboar wesleyboar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notes for Reviewers

@wesleyboar wesleyboar marked this pull request as ready for review September 21, 2021 21:24
Copy link
Collaborator

@taoteg taoteg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Built and ran locally using this branch and all worked as expected.

@taoteg taoteg merged commit 589f1fb into main Sep 22, 2021
@wesleyboar wesleyboar deleted the task/GH-191-support-light-navbar-for-dark-logos branch September 23, 2021 01:12
@wesleyboar wesleyboar linked an issue Oct 18, 2021 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority ▲ High priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Colored Header (TACC Blue Header) Themes via Settings (Light Header Navbar)
2 participants