Skip to content

Commit

Permalink
Merge pull request #27 from bcgov/bcds-take-1
Browse files Browse the repository at this point in the history
Integrate aspects of the BCDS Design Tokens system
  • Loading branch information
dawnbcgov authored Feb 14, 2025
2 parents 9c57ea4 + e6d4894 commit 8fdac7c
Show file tree
Hide file tree
Showing 45 changed files with 6,602 additions and 153 deletions.
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.py]
indent_size = 4
4 changes: 3 additions & 1 deletion .github/workflows/merge.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Merge to main

on:
schedule:
- cron: "25 6 * * *" # 6:25 am UTC every day
workflow_dispatch:
push:
branches:
Expand Down Expand Up @@ -31,4 +33,4 @@ jobs:
target: gh-pages
path: frontend
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ frontend/_site/
.RData
.Ruserdata
.Rproj.user
.idea
.idea
Binary file added doc/Contribution Flow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 56 additions & 0 deletions doc/RELEASING_AN_ADVISORY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Releasing and Updating Advisories

## Creating an Advisory

### Process Overview

1. This repository, `nr-epd-aq-statements` comprises a Quarto application that will collate and render documents in
Markdown format, producing a complete website with navigation and several automatically-generated lists (for example,
current Smoky Skies Bulletins, and historical advisories).
2. The resulting website is published on [Github pages](https://bcgov.github.io/nr-epd-aq-statements/). It is a static
website, and must be rebuilt from scratch each time content changes. It must also be rebuilt to recompute lists (for
example, those that rely on dates, like the
list of active bulletins). It should ideally be rebuilt daily to remain current.
3. To contribute a new Smoky Skies Bulletin or Advisory, use the companion Shiny application. This application will
produce three output files when run. Those three files should be submitted to this repository in the form of a
pull-request.
4. When the pull-request is merged, the site will begin to rebuild. You can view the status of the build process
in [Github Actions](https://github.com/bcgov/nr-epd-aq-statements/actions). Once the action completes, the new
content will be available on the public [Github pages](https://bcgov.github.io/nr-epd-aq-statements/) site
immediately.

<img src="Contribution Flow.png" alt='Contribution Workflow'/>

### Pull Request Details

- The pull request should be created against the `main` branch. This can be accomplished by either checking out the
repository locally and making changes with the `git` command line or desktop tools, or via Github's web interface
using the [upload tool](https://github.com/bcgov/nr-epd-aq-statements/upload/main).
- Regardless of the method for creating the pull request, it should include three files:
- `map.html`
- dated markdown file (eg `2025-02-06_Smoky-Skies_Issue.md`)
- corresponding PDF file (eg `2025-02-06_Smoky-Skies_Issue.pdf`)
- The files should be contributed to the project in the directory `frontend/statements/YYYY-MM/DD`. Separating the files
in this way ensures that `map.html` is not overwritten (since each statement has a corresponding map file and its name
is not easily changed).
- If more than one statement is created on a given day, consider creating them in further subfolders with a meaninful
name, such as the region or the hour of issue.

## Updating or Removing an Advisory

### Updating an existing Advisory

To update an existing advisory, follow the same steps as above to regenerate the advisory and create a pull request that
**overwrites** the files you wish to edit. After the pull request is merged and the site rebuilt, the content will be
updated.

You may also create a pull request manually with the Github website if you wish to manually update specific wording
within a statement, advisory, or bulletin. Be aware that you can only edit the generated `html` content this way, and
that corresponding `pdf`s are passed through unmodified (so if you need to change a PDF too, you must make the change by
editing the template in the Shiny app before exporting it),

### Removing an Advisory

To remove an advisory, create a pull request against the main branch that deletes the three files (markdown, pdf,
and `map.html`). When the site is rebuilt, the content will be removed and will not be accessible via any listings or
even directly by the URL.
23 changes: 23 additions & 0 deletions doc/UPDATING_STATIC_CONTENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Updating Static Content

## Content

There are four pages that provide base content for the static site. They are:

- `index.qmd` - the home page
- `measuring.qmd` - 'Measuring air quality' document
- `shortcode_demos.qmd` (provided as an example)
- `statements.qmd` - A dynamic list of historic statements. Contents are generated automatically based on the contents
of the preamble ([Quarto Custom Listings](https://quarto.org/docs/websites/website-listings-custom.html))

These four documents are written in QMD format and can be edited via Github Pull Request against the `main` branch.

You can add or remove content as required to edit the static content of the site. Create, edit, or delete files with
a `.qmd` extension in the `frontend` directory. Any file whose name starts with an underscore `_` will be ignored by
Quarto during the rendering step.

## Navigation

You may wish to add, remove, or reorder the contents of the site navigation top bar or sidebar. They will not be updated
automatically if you add or delete static content files. These elements are defined in the
file `_extensions/bcds/_extension.yaml` under the key `contributes.project.website`.
9 changes: 9 additions & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/.quarto/

/env/

_recent_statements.yaml
_ssb.yaml

# for local testing
Caddyfile
23 changes: 23 additions & 0 deletions frontend/Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
auto_https off
}
:3000

root * _site
file_server

log {
level WARN
}
encode gzip

route {
header /* Cache-Control max-age=3
}

route {
try_files {path} /index.html
header /index.html {
Cache-Control max-age=0,no-cache,no-store,must-revalidate
}
}
26 changes: 26 additions & 0 deletions frontend/_aqs_listing.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
```{=html}
<% if (items.length > 0) { %>
<table>
<thead>
<tr>
<td>Title</td>
<td>Date</td>
<td>Location</td>
<td>Categories</td>
</tr>
</thead>
<tbody>
<% for (const item of items) { %>
<tr>
<td><a href="<%- item.path %>"><%= item.title %></a></td>
<td><%= item.date %></td>
<td><%= item.location %></td>
<td><%= item.categories %></td>
</tr>
<% } %>
</tbody>
</table>
<% } else { %>
<em>There are currently no air quality advisories in effect.</em>
<% } %>
```
126 changes: 126 additions & 0 deletions frontend/_extensions/bcds/_extension.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
title: bcds
author: Robert Johnstone
version: 1.0.0
quarto-required: ">=1.6.0"
contributes:
shortcodes:
- bcds.lua
project:
project:
output-dir: _site
type: website
resources:
- "assets"
format: bcds-html
website:
page-footer:
border: false
center: |
<footer class='bcds-footer'>
<div class='bcds-footer--acknowledgement'>
<div class='bcds-footer--acknowledgement-text'><p>The B.C. Public Service acknowledges the territories of First
Nations around B.C. and is grateful to carry out our work on
these lands. We acknowledge the rights, interests, priorities,
and concerns of all Indigenous Peoples — First Nations, Métis,
and Inuit — respecting and acknowledging their distinct
cultures, histories, rights, laws, and governments.</p></div>
</div>
<div class='bcds-footer--container'>
<div class='bcds-footer--container-content'>
<div class='bcds-footer--logo-links horizontal'>
<div class='bcds-footer--logo'>
<img class='navbar-brand-logo' src='/_extensions/bcds/assets/BCID_H_rgb_pos.svg'/>
<p>We can help in over 220 languages and through other accessible options.<!-- -->
<a href='https://www2.gov.bc.ca/gov/content?id=6A77C17D0CCB48F897F8598CCC019111'>Call, email or text
us</a>, or<!-- --> <a
href='https://www2.gov.bc.ca/gov/content?id=FBC4210F6BC047A5884198F543C97D53'
>find a service centre</a></p></div>
<figure class='bcds-footer--links'>
<figcaption class='bcds-footer--links-title'>More Info</figcaption>
<ul>
<li><a href='https://www2.gov.bc.ca/gov/content/home'>Home</a></li>
<li><a href='https://www2.gov.bc.ca/gov/content?id=3C4F47288DFB454987435AB5EFEFBB7F'>About gov.bc.ca</a>
</li>
<li><a href='https://www2.gov.bc.ca/gov/content?id=79F93E018712422FBC8E674A67A70535'>Disclaimer</a></li>
<li><a href='https://www2.gov.bc.ca/gov/content?id=9E890E16955E4FF4BF3B0E07B4722932'>Privacy</a></li>
<li><a href='https://www2.gov.bc.ca/gov/content?id=E08E79740F9C41B9B0C484685CC5E412'>Accessibility</a>
</li>
<li><a href='https://www2.gov.bc.ca/gov/content?id=1AAACC9C65754E4D89A118B875E0FBDA'>Copyright</a></li>
<li><a href='https://www2.gov.bc.ca/gov/content?id=6A77C17D0CCB48F897F8598CCC019111'>Contact us</a></li>
</ul>
</figure>
</div>
<hr/>
<p class='bcds-footer--copyright'>© 2025 Government of British Columbia.</p></div>
</div>
</footer>
resources:
- "*.html"
- "*.pdf"
title: "Air quality advisories"
navbar:
logo: /_extensions/bcds/assets/BCID_H_rgb_pos.svg
right:
- text: Issued advisories
href: index.qmd
- text: Historical advisories
href: statements.qmd
sidebar:
style: "docked"
alignment: left
border: false
collapse-level: 3
contents:
- text: Air Quality Data
- section: Active advisories
contents: statements
- section: Air Quality Data
href: https://www2.gov.bc.ca/gov/content/environment/air-land-water/air/air-quality
contents:
- text: Air advisories
href: index.qmd
- text: Historical advisories
href: statements.qmd
- text: BCDS Shortcode Demos
href: shortcode_demos.qmd
- text: Air Quality Subscription Service
href: https://www2.gov.bc.ca/gov/content/environment/air-land-water/air/air-quality/air-advisories/air-quality-subscription-service
- text: "Air Quality Health Index"
href: https://www2.gov.bc.ca/gov/content/environment/air-land-water/air/air-quality/aqhi
- text: "Air Quality Health Index widget"
href: https://www2.gov.bc.ca/gov/content/environment/air-land-water/air/air-quality/aghi-widget
- text: "Latest air quality data"
href: https://www2.gov.bc.ca/gov/content/environment/air-land-water/air/air-quality/current-air-quality-data
- text: "How we measure"
href: https://www2.gov.bc.ca/gov/content/environment/air-land-water/air/air-quality/measuring
formats:
html:
toc: false
include-before-body:
text: |
<script>
function BCDSCollapseAll() {
const elements = document.getElementsByClassName('bcds-disclosure');
for (let i=0; i<elements.length; i++) {
elements.item(i).removeAttribute('open');
}
}
function BCDSExpandAll() {
const elements = document.getElementsByClassName('bcds-disclosure');
for (let i=0; i<elements.length; i++) {
elements.item(i).setAttribute('open', true);
}
}
</script>
theme:
- minimal
- variables.scss
- bcds.scss
- bcds-footer.scss
- bcds-callouts.scss
- bcds-inline-alert.scss
- bcds-cards.scss
- bcds-accordion.scss


Loading

0 comments on commit 8fdac7c

Please sign in to comment.