diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..064581371d --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,37 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/ruby +{ + "name": "Ruby", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/ruby:1-3.2-bullseye", + "features": { + "ghcr.io/devcontainers/features/python:1": { + "installTools": true, + "version": "3.11" + } + }, + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // not used as we are using --network=host, see below + // "forwardPorts": [ + // // Jekyll Server + // 4000, + // // Live Reload Server + // 35729 + // ], + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "bundle install --path=vendor/bundle", + + // allow the container to talk to ports on the host + "runArgs": [ "--network=host" ] + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/.github/ISSUE_TEMPLATE/bug_template.md b/.github/ISSUE_TEMPLATE/bug_template.md new file mode 100644 index 0000000000..9aa3ee6a12 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_template.md @@ -0,0 +1,40 @@ +--- +name: Bug Report +about: Report a Bug +title: '' +labels: bug +assignees: '' + +--- + + + +### Summary + + + +### Steps to reproduce + + + +### What is the current *bug* behavior? + + + +### What is the expected *correct* behavior? + + + +### Relevant logs and/or screenshots + + + +### Possible fixes + + diff --git a/.github/ISSUE_TEMPLATE/general_template.md b/.github/ISSUE_TEMPLATE/general_template.md new file mode 100644 index 0000000000..f6b1446ead --- /dev/null +++ b/.github/ISSUE_TEMPLATE/general_template.md @@ -0,0 +1,27 @@ +--- +name: General Issue +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + + + +### Problem + + + +### Background Info + + + +### Proposed Solution + + diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000000..ab29a7e00f --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,25 @@ +### What does this PR do? + + + +### Background info + + + +### How can this be tested (manually and/or automated test)? + + +#### Provide manual tests steps if applicable + + +#### Provide steps for running automated tests if applicable + +### Which issue(s) is/are related to this PR? + + +This PR is/are related to issue(s) + + +close diff --git a/.github/workflows/BuildNDeployDev.yml b/.github/workflows/BuildNDeployDev.yml index a02237ec9c..e497f632cf 100644 --- a/.github/workflows/BuildNDeployDev.yml +++ b/.github/workflows/BuildNDeployDev.yml @@ -1,44 +1,24 @@ -# This workflow will checkout the contents of the `development` branch of this repo, remove all files in the current S3 bucket, and push the contents -# to the bucket. Once the contents of the S3 bucket has been updated, a call will be made to invalidate the cache in the CloudFront distribution. -# The CloudFront distribution is configured to pull the contents from the S3 bucket once an `invalidation` request is sent. -name: Build and Deploy Development Static Site +name: Build and Deploy Development Static Site Dev # run this workflow when a push has been made. if a push has been made to the development branch it will deploy the site to the hosting environment on: # run this workflow when a push has been made to `development` branch push: - branches: - - development + branches-ignore: + - production repository_dispatch: # Listen for repository dispatch event from open-sdg-data-starter workflow types: [dev_triggered_from_open-sdg-data-starter] jobs: - deploy: - runs-on: ubuntu-20.04 - environment: - name: development - url: https://${{ vars.SITE_DOMAIN_NAME }} - steps: - ########################################################################################################### - # This is the CI portion - ########################################################################################################### + build: + runs-on: ubuntu-22.04 + steps: - name: Checkout repo - uses: actions/checkout@v2 - with: - ref: development + uses: actions/checkout@v4 - name: Setup Ruby - uses: actions/setup-ruby@v1 + uses: ruby/setup-ruby@v1 with: - ruby-version: '2.6' # Version range or exact version of a Ruby version to use, using semvers version range syntax. - - - - name: Cache and Install Gem files - uses: actions/cache@v3 - with: - path: vendor/bundle - key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: | - ${{ runner.os }}-gems- + ruby-version: '3.2' # Version range or exact version of a Ruby version to use, using semvers version range syntax. - name: Install Ruby dependencies run: bundle check --path=vendor/bundle || bundle install --path=vendor/bundle @@ -47,38 +27,48 @@ jobs: run: bundle exec jekyll build --config _config.yml - name: Test the HTML # test our rendered html files - run: bash scripts/test/html_proofer.sh - - ########################################################################################################### - # This is the CD portion - ########################################################################################################### - - #- uses: actions/checkout@v1 # checks out the code in the repository - - name: Setup Python - uses: actions/setup-python@v4 # sets up python in our environment + run: bash scripts/test/html_proofer_staging.sh + + - name: Zip site artifact # only zip the site if the push was made to the development branch + if: ${{ github.ref == 'refs/heads/development' }} + run: zip -r _site.zip _site + + - name: Upload site artifact # only upload the zip if the push was made to the development branch + if: ${{ github.ref == 'refs/heads/development' }} + uses: actions/upload-artifact@v4 with: - python-version: '3.x' # install python version 3.x, default architecture is x64 - - + name: site-deployment-dev + path: _site.zip + retention-days: 1 # delete the artifact after 1 day + + deploy: + runs-on: ubuntu-22.04 + needs: [build] + if: (github.ref == 'refs/heads/development') + environment: + name: development + url: https://${{ vars.SITE_DOMAIN_NAME }} + steps: - name: Install AWS CLI run: pip3 install awscli --upgrade --user # install the cli with upgrade to any requirements and into the subdir of the user - - + - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1-node16 # use the official GitHub Action from AWS to setup credentials + uses: aws-actions/configure-aws-credentials@v4 # use the official GitHub Action from AWS to setup credentials with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + role-to-assume: ${{ secrets.ROLE_ARN }} aws-region: ${{ secrets.AWS_REGION }} mask-aws-account-id: true + + - name: Fetch site artifact + uses: actions/download-artifact@v4 + with: + name: site-deployment-dev + + - name: Unzip site artifact + run: unzip _site.zip - - name: Push Contents to S3 # push the current working directory to the S3 bucket run: aws s3 sync _site/ s3://${{ secrets.S3_BUCKET_NAME }} --exclude ".git/*" --exclude ".github/*" --delete # have the bucket have the same content in the repo & exclude the git related directories. - - name: Invalidate CloudFront Cache # Invalidate the CloudFront Distribution Cache to get contents from the S3 bucket - run: aws cloudfront create-invalidation --distribution-id ${{ secrets.CDN_DISTRIBUTION_ID }} --paths "/*" - - - + run: aws cloudfront create-invalidation --distribution-id "$CDN_DISTRIBUTION_ID" --paths "/*" diff --git a/.github/workflows/BuildNDeployProd.yml b/.github/workflows/BuildNDeployProd.yml index 98f4548197..bf69a03cfc 100644 --- a/.github/workflows/BuildNDeployProd.yml +++ b/.github/workflows/BuildNDeployProd.yml @@ -1,8 +1,5 @@ -# This workflow will checkout the contents of the `production` branch of this repo, remove all files in the current S3 bucket, and push the contents -# to the bucket. Once the contents of the S3 bucket has been updated, a call will be made to invalidate the cache in the CloudFront distribution. -# The CloudFront distribution is configured to pull the contents from the S3 bucket once an `invalidation` request is sent. -name: Build and Deploy Production Static Site +name: Build and Deploy Production Static Site Prod # run this workflow when a push has been made to production branch on: # run this workflow when a push has been made to `Jekyll-Alf` branch push: @@ -13,7 +10,7 @@ on: # run this workflow when a push has been made to `Jekyll-Alf` branch jobs: deploy: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 environment: name: production url: https://${{ vars.SITE_DOMAIN_NAME }} @@ -22,22 +19,14 @@ jobs: # This is the CI portion ########################################################################################################### - name: Checkout repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: production - name: Setup Ruby uses: actions/setup-ruby@v1 with: - ruby-version: '2.6' # Version range or exact version of a Ruby version to use, using semvers version range syntax. - - - name: Cache and Install Gem files - uses: actions/cache@v3 - with: - path: vendor/bundle - key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: | - ${{ runner.os }}-gems- + ruby-version: '3.2' # Version range or exact version of a Ruby version to use, using semvers version range syntax. - name: Install Ruby dependencies run: bundle check --path=vendor/bundle || bundle install --path=vendor/bundle @@ -46,37 +35,24 @@ jobs: run: bundle exec jekyll build --config _config.yml,_config_prod.yml - name: Test the HTML # test our rendered html files - run: bash scripts/test/html_proofer.sh + run: bash scripts/test/html_proofer_prod.sh ########################################################################################################### # This is the CD portion ########################################################################################################### - - #- uses: actions/checkout@v1 # checks out the code in the repository - - name: Setup Python - uses: actions/setup-python@v4 # sets up python in our environment - with: - python-version: '3.x' # install python version 3.x, default architecture is x64 - - + - name: Install AWS CLI run: pip3 install awscli --upgrade --user # install the cli with upgrade to any requirements and into the subdir of the user - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1-node16 # use the official GitHub Action from AWS to setup credentials + uses: aws-actions/configure-aws-credentials@v4 # use the official GitHub Action from AWS to setup credentials with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + role-to-assume: ${{ secrets.ROLE_ARN }} aws-region: ${{ secrets.AWS_REGION }} mask-aws-account-id: true - - name: Push Contents to S3 # push the current working directory to the S3 bucket run: aws s3 sync _site/ s3://${{ secrets.S3_BUCKET_NAME }} --exclude ".git/*" --exclude ".github/*" --delete # have the bucket have the same content in the repo & exclude the git related directories. - name: Invalidate CloudFront Cache # Invalidate the CloudFront Distribution Cache to get contents from the S3 bucket - run: aws cloudfront create-invalidation --distribution-id ${{ secrets.CDN_DISTRIBUTION_ID }} --paths "/*" - - - + run: aws cloudfront create-invalidation --distribution-id "$CDN_DISTRIBUTION_ID" --paths "/*" diff --git a/.gitignore b/.gitignore index 4269acc7a2..900cedb48a 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,8 @@ _site/ .spyproject/ *__pycache__/ *.Rproj -Gemfile.lock deploy_key* deploy_key*.pub *.keybase +vendor/ +_test/ diff --git a/Gemfile b/Gemfile index d08452dbfe..010051506c 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,9 @@ source "https://rubygems.org" -gem "jekyll", "3.8.4" -gem "html-proofer" +gem "jekyll", "3.9.3" +gem "html-proofer", "3.19.4" gem "jekyll-remote-theme" -gem "jekyll-open-sdg-plugins", "~> 0.0.15" +gem "deep_merge" +gem "jekyll-open-sdg-plugins", "2.3.0" +gem "kramdown-parser-gfm" +gem "webrick" diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000000..78f38e30a9 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,117 @@ +GEM + remote: https://rubygems.org/ + specs: + addressable (2.8.6) + public_suffix (>= 2.0.2, < 6.0) + colorator (1.1.0) + concurrent-ruby (1.2.3) + deep_merge (1.2.2) + ecma-re-validator (0.4.0) + regexp_parser (~> 2.2) + em-websocket (0.5.3) + eventmachine (>= 0.12.9) + http_parser.rb (~> 0) + ethon (0.16.0) + ffi (>= 1.15.0) + eventmachine (1.2.7) + ffi (1.16.3) + forwardable-extended (2.6.0) + hana (1.3.7) + html-proofer (3.19.4) + addressable (~> 2.3) + mercenary (~> 0.3) + nokogiri (~> 1.13) + parallel (~> 1.10) + rainbow (~> 3.0) + typhoeus (~> 1.3) + yell (~> 2.0) + http_parser.rb (0.8.0) + i18n (1.14.4) + concurrent-ruby (~> 1.0) + jekyll (3.9.3) + addressable (~> 2.4) + colorator (~> 1.0) + em-websocket (~> 0.5) + i18n (>= 0.7, < 2) + jekyll-sass-converter (~> 1.0) + jekyll-watch (~> 2.0) + kramdown (>= 1.17, < 3) + liquid (~> 4.0) + mercenary (~> 0.3.3) + pathutil (~> 0.9) + rouge (>= 1.7, < 4) + safe_yaml (~> 1.0) + jekyll-open-sdg-plugins (2.3.0) + deep_merge (~> 1.2) + jekyll (~> 3.0) + json_schemer (~> 0.2) + jekyll-remote-theme (0.4.3) + addressable (~> 2.0) + jekyll (>= 3.5, < 5.0) + jekyll-sass-converter (>= 1.0, <= 3.0.0, != 2.0.0) + rubyzip (>= 1.3.0, < 3.0) + jekyll-sass-converter (1.5.2) + sass (~> 3.4) + jekyll-watch (2.2.1) + listen (~> 3.0) + json_schemer (0.2.25) + ecma-re-validator (~> 0.3) + hana (~> 1.3) + regexp_parser (~> 2.0) + simpleidn (~> 0.2) + uri_template (~> 0.7) + kramdown (2.4.0) + rexml + kramdown-parser-gfm (1.1.0) + kramdown (~> 2.0) + liquid (4.0.4) + listen (3.9.0) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) + mercenary (0.3.6) + nokogiri (1.16.2-x86_64-linux) + racc (~> 1.4) + parallel (1.24.0) + pathutil (0.16.2) + forwardable-extended (~> 2.6) + public_suffix (5.0.4) + racc (1.7.3) + rainbow (3.1.1) + rb-fsevent (0.11.2) + rb-inotify (0.10.1) + ffi (~> 1.0) + regexp_parser (2.9.0) + rexml (3.2.6) + rouge (3.30.0) + rubyzip (2.3.2) + safe_yaml (1.0.5) + sass (3.7.4) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + simpleidn (0.2.1) + unf (~> 0.1.4) + typhoeus (1.4.1) + ethon (>= 0.9.0) + unf (0.1.4) + unf_ext + unf_ext (0.0.9.1) + uri_template (0.7.0) + webrick (1.8.1) + yell (2.2.2) + +PLATFORMS + x86_64-linux + +DEPENDENCIES + deep_merge + html-proofer (= 3.19.4) + jekyll (= 3.9.3) + jekyll-open-sdg-plugins (= 2.3.0) + jekyll-remote-theme + kramdown-parser-gfm + webrick + +BUNDLED WITH + 2.4.19 diff --git a/README.md b/README.md index 0f529f150f..1f973bfb5f 100644 --- a/README.md +++ b/README.md @@ -3,18 +3,43 @@ This is a starter repository to help in implementing the [Open SDG](https://github.com/open-sdg/open-sdg) platform. [See here for documentation](https://open-sdg.readthedocs.io). -### Installing Jekyll Locally +### Testing w/ Jekyll Locally -Installation Instructions for Jekyll: https://jekyllrb.com/docs/ +#### Preparing the SDG Data Site -Configuration Information for Jekyll: https://jekyllrb.com/docs/configuration/options/ +You will need to build the SDG Data site first locally in order to proceed with building and testing the SDG Site Starter first. -### Testing w/ Jekyll Locally +1.) Refer to the commands in https://github.com/CityOfLosAngeles/open-sdg-data-starter to setup your local environment. + +2.) Proceed to navigate to the `_site` in the terminal of VS Code while in the container after building the data site locally and run `python3 -m http.server 9000`. + +3.) The data site is now accessible via `localhost:9000`. -**Test what staging will look like by running the following command:** +4.) In a separate VS Code window have this project opened and navigate to the `_config.yml` file and change `remote_data_prefix:` set to `"http://localhost:9000"`. Remember to revert this change before committing. -`bundle exec jekyll` +5.) Proceed with the steps below after running `bundle check --path=vendor/bundle || bundle install --path=vendor/bundle` to install the necessary dependencies. + +**Test what development will look like by running the following command:** + +`bundle exec jekyll serve --config _config.yml` **Test what production will look like by running the following command:** `bundle exec jekyll serve --config _config.yml,_config_prod.yml` + +For each command listed above, you will be able to access the site locally by visiting `http://127.0.0.1:4000/`. Please be aware that not everything may load due to CORS. You may verify this with ChromeDevTools for example. + +**To build the development site locally and have `_site` directory updated and available:** + +`bundle exec jekyll build --config _config.yml`. Run `./scripts/test/html_proofer_staging.sh` to perform html validation. + +**To build the development site locally and have `_site` directory updated and available:** + +`bundle exec jekyll build --config _config.yml,_config_prod.yml`. Note you may need to change the `remote_data_prefix:` in `_config_prod.yml` appropraitely as you see fit. Run `./scripts/test/html_proofer_prod.sh` to perform html validation. + +### GitHub Actions + +GitHub Actions is used for building, verifying, and deploying the site contents. The production GitHub Actions workflow file, `BuildNDeployProd.yml` is currently +configured to build, verify, and deploy the site to the production environment. The development GitHub Actions workflow file, `BuildNDeployDev.yml` currently is +configured to build and verify the site when git pushes are made to any branch but `production` verifying changes within the branch that was pushed. On git pushes to +the `development` branch, the workflow will proceed to build, verify, and deploy the site to the development environment. diff --git a/_config.yml b/_config.yml index 91afd29afd..e995958f7d 100755 --- a/_config.yml +++ b/_config.yml @@ -20,7 +20,7 @@ environment: staging # Replace MY-GITHUB-ORG and OPEN-SDG-DATA-STARTER as needed. remote_data_prefix: "https://sdgdatabase-dev.itacloudops.org" remote_translations: - - https://open-sdg.github.io/sdg-translations/translations-0.8.1.json + - https://open-sdg.github.io/sdg-translations/translations-2.1.0.json create_indicators: layout: indicator @@ -50,8 +50,16 @@ org_name: CityOfLosAngeles # Build settings markdown: kramdown -# Travis Support -exclude: [vendor, scripts, remotedata] +# Exclude some files/folders. +exclude: + - vendor + - scripts + - remotedata + - Gemfile + - Gemfile.lock + - README + - README.md + - LICENSE # International Support # Eg name: Australia and adjective: Australian @@ -110,7 +118,7 @@ plugins: - jekyll-open-sdg-plugins # Tell the Remote Theme plugin to use the Open SDG platform (Jekyll theme). -remote_theme: open-sdg/open-sdg@0.9.4 +remote_theme: open-sdg/open-sdg@2.3.0 # Apply any custom CSS. custom_css: @@ -150,4 +158,21 @@ frontpage_cards: * [Publication](https://example.com) # Optionally add a button at the bottom of the card. button_label: View more publications - button_link: https://example.com + button_link: https://example.com + +# TODO: Investigate this https://open-sdg.readthedocs.io/en/latest/configuration/#reporting_status +reporting_status: + title: title goes here + description: description goes here + disaggregation_indicator_count_label: indicators in scope + disaggregation_tabs: true + status_types: + - value: notstarted + label: status.exploring_data_sources + hide_on_goal_pages: false + - value: complete + label: status.reported_online + hide_on_goal_pages: true + - value: notapplicable + label: status.not_applicable + hide_on_goal_pages: false diff --git a/_config_prod.yml b/_config_prod.yml index 7918f7f969..79ffe08bee 100755 --- a/_config_prod.yml +++ b/_config_prod.yml @@ -13,6 +13,6 @@ environment: production # Uncomment and configure to point to a different data source for production. remote_data_prefix: https://sdgdatabase.lamayor.org remote_translations: - - https://open-sdg.github.io/sdg-translations/translations-0.8.1.json + - https://open-sdg.github.io/sdg-translations/translations-2.1.0.json analytics: ga_prod: 'UA-98192566-4' diff --git a/_layouts/frontpage.html b/_layouts/frontpage.html index b594faf492..a3a16628b1 100644 --- a/_layouts/frontpage.html +++ b/_layouts/frontpage.html @@ -1,42 +1,47 @@ -{%- include multilingual.html -%} {% include head.html %} {% include header.html %} -
- - {% assign country_name = site.country.name | t %} - {% assign heading_default = t.frontpage.heading | replace: '%name', country_name %} -

{{ site.frontpage_heading | default: heading_default | t }}

- - {% assign instructions_default = t.frontpage.instructions | replace_first: '%before_link', '' | replace_first: '%after_link', '' | replace_first: '%name', country_name %} -

{{ site.frontpage_instructions | default: instructions_default | t }}

- -

The City of Los Angeles is currently exploring data sources for the SDG indicators. To submit data, please email us at {{site.email_contacts.questions}}.

- - {%- assign goals = site.goals | where: 'language', current_language -%} - {% for goal in goals %} - {%- assign goal_number = goal.sdg_goal -%} - {%- assign default_goal = site.data.translations[default_language].global_goals[goal_number] -%} - {%- assign translated_goal = t.global_goals[goal_number] -%} - - {% cycle 'add row' : '
', '', '', '', '', '' %} -
- - {{ translated_goal.short }} - {{ t.general.goal }} {{ goal_number }} - -
- {% cycle 'end row' : '', '', '', '', '', '
' %} - {% endfor %} - {% comment %} - If there were exactly 17 goals, "pad" it with 1 more, to make it come - out more symmetrically. - {% endcomment %} - {% if goals.size == 17 %} -
- The Global Goals for Sustainable Development -
+
+ + {% if site.frontpage_introduction_banner %} +
+

{{ site.frontpage_introduction_banner.title | t }}

+
{{ site.frontpage_introduction_banner.description | t | markdownify }}
+
{% endif %} + + {% if site.frontpage_goals_grid %} +
+ + {% if site.frontpage_goals_grid.title %} +

{{ site.frontpage_goals_grid.title | t }}

+ {% endif %} + + {% if site.frontpage_goals_grid.description %} +
{{ site.frontpage_goals_grid.description | t | markdownify }}
+ {% endif %} + + {% include components/goal-tiles.html %}
-

Did you use the data or indicators available on this platform? Please share your use cases with us at {{site.email_contacts.questions}}.

- {% include components/download-all-metadata.html %} + {% endif %} + + {% if site.frontpage_cards %} +
+ {% for card in site.frontpage_cards %} + {% assign remainder = forloop.index | modulo: 3 %} + + {% if remainder == 1 or forloop.first %} +
+ {% endif %} + + {% include components/card.html card=card %} + + {% if remainder == 0 or forloop.last %} +
+ {% endif %} + + {% endfor %} +
+ {% endif %} +
-{% include footer.html %} +{% include footer.html %} \ No newline at end of file diff --git a/_layouts/goal-by-target.html b/_layouts/goal-by-target.html deleted file mode 100644 index 567c392635..0000000000 --- a/_layouts/goal-by-target.html +++ /dev/null @@ -1,99 +0,0 @@ -{%- include multilingual.html -%} -{%- include goal-variables.html -%} -{% include head.html %} -{% include header.html %} - -
-
-
-
- {{ goal_short }} - {{ t.general.goal }} {{ goal_number }} -
-
-

- {{ goal_title }} -

-

{{ t.localization.targets_localized }}

-
-
-
-
- -
- - {{ content }} - {% include components/breadcrumb.html %} - -
-
-

{{ t.general.targets }}

-
-
-

{{ t.general.indicators }}

-
-
- - {% assign goal_indicators = site.data.meta | where: 'sdg_goal', goal_number | sort: 'indicator_sort_order' | group_by: 'target_id' %} - {% for group in goal_indicators %} - {% assign target_id = group.name %} - {% assign target_id_dashes = target_id | replace: ".", "-" %} - {% assign target_title_key = target_id | append: '-title' %} - {% assign target_title_key_dashes = target_id_dashes | append: '-title' %} - {% assign target_title = t.global_targets[target_title_key_dashes] | default: t.global_targets[target_title_key] %} -
- - - {{ target_id }} - - {{ target_title }} -
-
- {% for indicator in group.items %} - - {% assign status_css = indicator.reporting_status | slugify %} - {% if indicator.reporting_status == 'notapplicable' %} - {% assign status_desc = t.status.not_applicable %} - {% endif %} - {% if indicator.reporting_status == 'notstarted' %} - {% assign status_desc = t.status.exploring_data_sources %} - {% endif %} - {% if indicator.reporting_status == 'inprogress' %} - {% assign status_desc = t.status.statistics_in_progress %} - {% endif %} - {% if indicator.reporting_status == 'complete' %} - {% assign status_desc = t.status.reported_online %} - {% endif %} - {% assign tag_classes = "" | split: "," %} - {% if indicator.tags %} - {% for tag in indicator.tags %} - {% assign tag_slug = "indicator-" | append: tag | slugify %} - {% assign tag_classes = tag_classes | push: tag_slug %} - {% endfor %} - {% endif %} - {% assign tag_classes = tag_classes | join: " " %} - - - {% endfor %} -
- {% endfor %} -
- -{% include footer.html %} diff --git a/_layouts/goal.html b/_layouts/goal.html new file mode 100644 index 0000000000..ffdcbf1383 --- /dev/null +++ b/_layouts/goal.html @@ -0,0 +1,98 @@ +{% include head.html %} +{% include header.html %} + +
+ {% include components/goal/breadcrumbs.html %} + {% if site.create_goals.previous_next_links %} + {% include components/previous-next-links.html previous_label=page.t.goal.previous next_label=page.t.goal.next %} + {% endif %} +
+ +{% include components/goal/header.html %} + +{% assign goal_indicators = page.indicators | where: 'goal_number', page.goal.number | group_by: 'target_number' %} +{% assign show_progress = false %} +{% for group in goal_indicators %} + {% for indicator in group.items %} + {% if indicator.progress_status and indicator.progress_status != '' %} + {% assign show_progress = true %} + {% endif %} + {% endfor %} +{% endfor %} + +
+ + {% include components/goal/goal-content.html content=content %} + +
+
+
+

{{ page.t.general.targets_and_indicators }}

+
+ {% if show_progress %} +
+ +
+ {% endif %} +
+
+ {% for group in goal_indicators %} + {% assign target = group.name | sdg_lookup %} +
+
+

+ {{ page.t.general.target }} {{ target.number }} +

+
+
+ {{ target.name }} +
+ {% if show_progress %} +
+ {% endif %} +
+ {% for indicator in group.items %} + + {% assign tag_classes = "" | split: "," %} + {% if indicator.tags %} + {% for tag in indicator.tags %} + {% assign tag_slug = "indicator-" | append: tag | slugify %} + {% assign tag_classes = tag_classes | push: tag_slug %} + {% endfor %} + {% endif %} + {% assign tag_classes = tag_classes | join: " " %} + {% if indicator.progress_status and indicator.progress_status != '' %} + {% assign indicator_has_progress = true %} + {% endif %} + +
+ +
+

+ {{ page.t.general.indicator }} {{ indicator.number }} +

+
+
+ {% if indicator.placeholder and indicator.placeholder != '' %} + {{ indicator.placeholder }} + {% else %} + {{ indicator.name }} + {% include components/indicator/tags.html tags=indicator.tags reporting_status=true indicator=indicator %} +
+ {% if indicator_has_progress %} +
+ {{ site.progress_status.status_heading | t }} + {% include components/progress/progress-status.html indicator=indicator %} +
+ {% endif %} + {% endif %} +
+ {% endfor %} +
+ {% endfor %} +
+ {% include back-to-top.html %} +
+ + +{% include footer.html %} \ No newline at end of file diff --git a/_layouts/indicator-json.html b/_layouts/indicator-json.html index db47335666..7412be5d2f 100644 --- a/_layouts/indicator-json.html +++ b/_layouts/indicator-json.html @@ -1,30 +1,20 @@ -{%- include multilingual.html -%} [ - {%- assign goals = site.goals | where: 'language', current_language -%} - {%- for goal in goals -%} - {%- assign goal_number = goal.sdg_goal | downcase -%} - {%- assign translated_goal = t.global_goals[goal_number] -%} + {%- assign groups = page.indicators | group_by: 'goal_number' -%} + {%- for group in groups -%} + {% assign goal = group.name | sdg_lookup %} { "goal": { - "id": "{{goal_number}}", - "title": "{{translated_goal.title | strip_newlines | strip | replace: '"', "'"}}", + "id": "{{ goal.number }}", + "title": "{{ goal.name | strip_newlines | strip | replace: '"', "'" }}", "indicators": [ - {%- assign all_meta = site.data.meta -%} - {%- if all_meta[current_language] -%} - {%- assign all_meta = all_meta[current_language] -%} - {%- endif -%} - {%- assign indicators = all_meta | where:'sdg_goal', goal_number -%} - {%- for indicator in indicators -%} - {%- capture indicator_id -%}{{indicator.indicator | slugify}}{%- endcapture -%} - {%- assign meta = all_meta[indicator_id] -%} + {% for indicator in group.items %} { - "id": "{{indicator_id}}", - "title": "{{indicator_id | get_indicator_name | strip_newlines | strip | replace: '"', "'"}}", - "description": "{{meta.national_indicator_description | strip_newlines | strip | replace: '"', "'" }}", - "target": "{{meta.target | strip_newlines | strip | replace: '"', "'" }}", - "keywords": "{{meta.data_keywords}}", - "href": "{{ site.baseurl }}{{ baseurl_folder }}/{{ indicator_id }}", - "status": "{{meta.reporting_status}}" + "id": "{{ indicator.slug }}", + "title": "{{ indicator.name | strip_newlines | strip | replace: '"', "'" }}", + "description": "{{ indicator.national_indicator_description | strip_newlines | strip | replace: '"', "'" }}", + "keywords": "{{ indicator.data_keywords }}", + "href": "{{ indicator.url }}", + "status": "{{ indicator.reporting_status }}" } {%- if forloop.last -%}{%- else -%},{%- endif -%} {%- endfor -%} @@ -33,4 +23,4 @@ } {%- if forloop.last -%}{%- else -%},{%- endif -%} {%- endfor -%} -] +] \ No newline at end of file diff --git a/_layouts/indicator.html b/_layouts/indicator.html index b228e71157..1eba7a46dc 100644 --- a/_layouts/indicator.html +++ b/_layouts/indicator.html @@ -1,227 +1,27 @@ -{%- include multilingual.html -%} -{%- include indicator-variables.html -%} {% include head.html %} {% include header.html %} -{% include components/fields-template.html %} -{% include components/units-template.html %} + +{% include components/indicator/fields-template.html %} +{% include components/indicator/units-template.html %} +{% include components/indicator/series-template.html %} {% include multilingual-js.html key="indicator" %} {% include multilingual-js.html key="data" %} -
-
-
-
- - {{ goal_short }} - {{ t.general.goal }} {{ goal_number }} - -
-
-

- - {{ goal_title }} - -

-

{{ t.general.indicator }} {{ meta.indicator }}: {{ meta.indicator | get_indicator_name }}

-
-
-
+
+ {% include components/indicator/breadcrumbs.html %} + {% if site.create_indicators.previous_next_links %} + {% include components/previous-next-links.html previous_label=page.t.indicator.previous next_label=page.t.indicator.next %} + {% endif %}
- -
- {% include components/breadcrumb.html %} - -
-
- {% include components/indicator-content.html %} -
-
- -
-
-

{{ meta.graph_title | t }}

-
-
- - {% assign sources_list = '' | split: ',' %} - {% for i in (1..12) %} - {% assign src_active = "source_active_" | append: i %} - {% if meta[src_active] == true %} - {% assign src_org = "source_organisation_" | append: i %} - {% assign src_org_translated = meta[src_org] | t %} - {% assign sources_list = sources_list | push: src_org_translated %} - {% endif %} - {% endfor %} - - {% assign uniqSources = sources_list | uniq | join: ", " %} - -
- {% if show_data %} -
-
- -

{{ t.indicator.sub_categories }}

-

{{ t.indicator.series_help }}

-
-

{{ t.indicator.legend_help }}

-
-

-
-
-
-
-
- {% else %} -
- {% endif %} - - {% if show_data %} - {% include components/headline.html %} - {% endif %} - -
- - {% if show_data %} -

-
-
-
+{% include components/indicator/header.html %} +
+ {% include components/indicator/data-notice.html %} + {% include components/indicator/indicator-available.html %} + {% include components/indicator/proxy-banner.html %} + {% include components/indicator/indicator-progress.html %} + {% include components/indicator/indicator-content.html %} + {% include components/indicator/indicator-main.html %} + {% include back-to-top.html %}
-{% include footer.html %} +{% include footer.html %} \ No newline at end of file diff --git a/_layouts/reportingstatus.html b/_layouts/reportingstatus.html index 070f8ee62b..8f36371597 100644 --- a/_layouts/reportingstatus.html +++ b/_layouts/reportingstatus.html @@ -1,96 +1,112 @@ -{% include multilingual.html %} {% include head.html %} {% include header.html %} -
+{% assign reporting_data = site.data.reporting %} +{% if site.data[page.language].reporting %} + {% assign reporting_data = site.data[page.language].reporting %} +{% endif %} - -

{{ t.status.reporting_status }}

+{% assign disagg_data = site.data.disaggregation %} +{% if site.data[page.language].disaggregation %} + {% assign disagg_data = site.data[page.language].disaggregation %} +{% endif %} - {%- assign overall = site.data.reporting.overall -%} -
-
-

- {{ t.status.overall_reporting_status }} {{ overall.totals.total }} - {{ t.general.indicators | downcase }} -

-
-
- {%- for status in overall.statuses -%} -
- {{ status.count }}{{ status.translation_key | t }}{{ status.percentage }}% -
- {%- endfor -%} +{%- assign extra_fields = false -%} +{%- for extra_field in reporting_data.extra_fields -%} + {%- assign extra_fields = true -%} +{%- endfor -%} -
-
-
-
- {%- for status in overall.statuses -%} - {% assign status_count_precise = status.count | times: 1.0 %} - {% assign overall_total_precise = overall.totals.total | times: 1.0 %} - {% assign percentage_precise = status_count_precise | divided_by: overall_total_precise | times: 100 %} - - {%- endfor -%} -
+{% assign show_tabs = false %} +{% if extra_fields %} + {% assign show_tabs = true %} +{% elsif site.reporting_status.disaggregation_tabs and disagg_data %} + {% assign show_tabs = true %} +{% endif %} +
+ {% include components/page/breadcrumbs.html %} +
+
+ + {% include components/reporting-status-introduction.html %} + +
+ {% if show_tabs %} + + {% endif %} + + {% if show_tabs %} +
+
+ {% endif %} + {% include components/reportingstatus/reporting-status-overall.html overall=reporting_data.overall title=page.t.status.overall_reporting_status status_types="reporting_status" %} + {% include components/reportingstatus/reporting-status-by-goal.html goals=reporting_data.goals title=page.t.status.status_by_goal status_types="reporting_status" %} + {% if show_tabs %}
- -
-
- - -

{{ t.status.status_by_goal }}

+ {% endif %} - {%- for goalreport in site.data.reporting.goals -%} - {%- assign goal_number = goalreport.goal | downcase -%} - {%- assign goal_short_key = goal_number | append: '-short' -%} - {%- assign goal_short = t.global_goals[goal_short_key] -%} -
-
- - {{ goal_short }} - {{ t.general.goal }} {{ goal_number }} - + {% if extra_fields %} + {%- for extra_field in reporting_data.extra_fields -%} + {% assign extra_field_name = extra_field[0] %} +
+ {% include components/reportingstatus/reporting-status-overall.html hide_wheel=true overall=reporting_data.overall title=page.t.status.overall_reporting_status status_types="reporting_status" %} + {% include components/reportingstatus/reporting-status-by-field.html extra_field=extra_field title=page.t.status.status_by_field status_types="reporting_status" %}
-
-

- {{ goal_short }} - {{ goalreport.totals.total }} {{ t.general.indicators | downcase }} -

-
-
- {%- for status in goalreport.statuses -%} -
- {{ status.count }}{{ status.translation_key | t }}{{ status.percentage }}% -
- {%- endfor -%} -
-
-
-
- {%- for status in goalreport.statuses -%} - {% assign status_count_precise = status.count | times: 1.0 %} - {% assign goalreport_total_precise = goalreport.totals.total | times: 1.0 %} - {% assign percentage_precise = status_count_precise | divided_by: goalreport_total_precise | times: 100 %} - {%- endfor -%} -
-
-
+ {%- endfor -%} + {% endif %} + + {% if site.reporting_status.disaggregation_tabs and disagg_data %} +
+ {% include components/reportingstatus/reporting-status-overall.html overall=disagg_data.overall title=page.t.status.disaggregation_status_overall status_types="disaggregation_status" indicator_count_label=site.reporting_status.disaggregation_indicator_count_label %} + {% include components/reportingstatus/reporting-status-by-goal.html goals=disagg_data.goals title=page.t.status.status_by_goal status_types="disaggregation_status" indicator_count_label=site.reporting_status.disaggregation_indicator_count_label %}
- -
-
- {%- endfor -%} - + {% if extra_fields %} + {%- for extra_field in disagg_data.extra_fields -%} + {% assign extra_field_name = extra_field[0] %} +
+ {% include components/reportingstatus/reporting-status-overall.html hide_wheel=true overall=disagg_data.overall title=page.t.status.disaggregation_status_overall status_types="disaggregation_status" indicator_count_label=site.reporting_status.disaggregation_indicator_count_label %} + {% include components/reportingstatus/reporting-status-by-field.html extra_field=extra_field title=page.t.status.disaggregation_status_by_field status_types="disaggregation_status" indicator_count_label=site.reporting_status.disaggregation_indicator_count_label %} +
+ {%- endfor -%} + {% endif %} + {% endif %} + + {% if show_tabs %} +
+ {% endif %} +
+ {% include back-to-top.html %}
-{% include footer.html %} +{% include footer.html %} \ No newline at end of file diff --git a/_layouts/search.html b/_layouts/search.html index da13a0efcb..fde6de7434 100644 --- a/_layouts/search.html +++ b/_layouts/search.html @@ -1,40 +1,71 @@ -{%- include multilingual.html -%} {% include head.html %} {% include header.html %} -
-

{{ t.search.search_results_for }} ''

- {% include components/loading.html %} -
-
-
- - + + +
+ {% include components/page/breadcrumbs.html %} +
+
+

{{ page.t.search.search_results_for }} ''

+ {% include search.html id="search-bar-on-page" not_in_menu=true %} + {% include components/loading.html %} +
+
-{% include footer.html %} + +{% if page.language != 'en' %} + + +{% endif %} +{% include footer.html %} \ No newline at end of file diff --git a/_sass/custom.scss b/_sass/custom.scss new file mode 100644 index 0000000000..534ef7a0b6 --- /dev/null +++ b/_sass/custom.scss @@ -0,0 +1 @@ +// Enter any custom Sass in this file. diff --git a/_sass/variables.scss b/_sass/variables.scss new file mode 100644 index 0000000000..58f7577622 --- /dev/null +++ b/_sass/variables.scss @@ -0,0 +1,14 @@ +// Here you can override any of the Sass variables from Open SDG. This is the +// easiest way to change things like colors and dimensions. Below are a few +// examples of variables. For a full list, see this folder: +// https://github.com/open-sdg/open-sdg/tree/master/_sass/variables + +//$goal-colors: #E52B3D #DDA63A #4C9F38 #C42130 #FF3E24 #28BCE1 #FCC30B #A21942 #FD6925 #DD1367 #FD9C27 #BF8B2E #417D46 #0A96D8 #57BE2F #00689C #1F4A6A; +//$goal-banner-backgroundColors: white white white white white white white white white white white white white white white white white; +//$text-color: #333; +//$color-dark: black; +//$color-light: white; +//$backgroundColor: white; +//$link-color: #337ab7; +//$footer-text-color: #000000; +$indicatorContent-horizontalRule-color: transparent; diff --git a/assets/css/README.md b/assets/css/README.md new file mode 100644 index 0000000000..3c4a396438 --- /dev/null +++ b/assets/css/README.md @@ -0,0 +1 @@ +Override any CSS from the Jekyll theme in this folder, or add your own. \ No newline at end of file diff --git a/assets/img/SDG_logo.png b/assets/img/SDG_logo.png index bc3bc1d2e8..bb29fd8a83 100644 Binary files a/assets/img/SDG_logo.png and b/assets/img/SDG_logo.png differ diff --git a/assets/img/favicons/android-chrome-192x192.png b/assets/img/favicons/android-chrome-192x192.png new file mode 100644 index 0000000000..a95b24a069 Binary files /dev/null and b/assets/img/favicons/android-chrome-192x192.png differ diff --git a/assets/img/favicons/android-chrome-512x512.png b/assets/img/favicons/android-chrome-512x512.png new file mode 100644 index 0000000000..aefbf81071 Binary files /dev/null and b/assets/img/favicons/android-chrome-512x512.png differ diff --git a/assets/img/favicons/apple-touch-icon.png b/assets/img/favicons/apple-touch-icon.png new file mode 100644 index 0000000000..843ddf5547 Binary files /dev/null and b/assets/img/favicons/apple-touch-icon.png differ diff --git a/assets/img/favicons/favicon-16x16.png b/assets/img/favicons/favicon-16x16.png new file mode 100644 index 0000000000..ba8189418b Binary files /dev/null and b/assets/img/favicons/favicon-16x16.png differ diff --git a/assets/img/favicons/favicon-32x32.png b/assets/img/favicons/favicon-32x32.png new file mode 100644 index 0000000000..c75aee3485 Binary files /dev/null and b/assets/img/favicons/favicon-32x32.png differ diff --git a/assets/js/README.md b/assets/js/README.md new file mode 100644 index 0000000000..50c9fc8217 --- /dev/null +++ b/assets/js/README.md @@ -0,0 +1 @@ +Override any javascript from the Jekyll theme in this folder, or add your own. diff --git a/assets/js/custom.js b/assets/js/custom.js new file mode 100644 index 0000000000..e00cc5e68e --- /dev/null +++ b/assets/js/custom.js @@ -0,0 +1 @@ +// Add any custom javascript here. diff --git a/scripts/batch/add_language.py b/scripts/batch/add_language.py index 595bfcceab..f3dfac6663 100644 --- a/scripts/batch/add_language.py +++ b/scripts/batch/add_language.py @@ -19,9 +19,9 @@ import sys import os -def add_language(new_language): - # We only care about these three folders. - folders = ['_indicators', '_goals', '_pages'] +def add_language(new_language, language_public): + # We only care about one folder. + folders = ['_pages', '_posts'] for folder in folders: new_folder = os.path.join(folder, new_language) # Abort if folder already exists. @@ -39,29 +39,25 @@ def add_language(new_language): shutil.copyfile(source_file, new_file) # Change the copied files to reflect the new language. for line in fileinput.input(glob.glob(new_folder + '/*'), inplace=True): - # Skip a few unnecessary lines. - if folder == '_goals' and line.startswith('title:'): - continue - if folder == '_goals' and line.startswith('short:'): - continue - if folder == '_goals' and line.startswith(' '): - continue # Look for the permalink line, and add the language. if line.startswith('permalink: /'): - sys.stdout.write(line.replace('permalink: /', 'permalink: /' + new_language + '/')) + sys.stdout.write(line.replace('permalink: /', 'permalink: /' + language_public + '/')) sys.stdout.write('language: ' + new_language + '\n') - else: + elif not line.startswith('language: '): sys.stdout.write(line) def main(): # Abort if there is no parameter provided. if len(sys.argv) < 2: - sys.exit('Provide a 2-letter abbreviation for the new language.') + sys.exit('Provide a 2-letter abbreviation for the new language. Optionally also provide a second alternative abbreviation to use in permalinks.') language = sys.argv[1] - add_language(language) + language_public = language + if len(sys.argv) == 3: + language_public = sys.argv[2] + add_language(language, language_public) print("Don't forget to update the 'languages' list in _config.yml!") # Boilerplace syntax for running the main function. if __name__ == '__main__': - main() + main() \ No newline at end of file diff --git a/scripts/test/html_proofer.sh b/scripts/test/html_proofer_prod.sh old mode 100644 new mode 100755 similarity index 51% rename from scripts/test/html_proofer.sh rename to scripts/test/html_proofer_prod.sh index 22ad425d70..7dc3241a37 --- a/scripts/test/html_proofer.sh +++ b/scripts/test/html_proofer_prod.sh @@ -1,4 +1,4 @@ #!/bin/bash # The following assumes the site is already built at _site. -bundle exec htmlproofer --disable-external ./_site +bundle exec htmlproofer --allow-hash-href --disable-external ./_site \ No newline at end of file diff --git a/scripts/test/html_proofer_staging.sh b/scripts/test/html_proofer_staging.sh new file mode 100755 index 0000000000..5198062826 --- /dev/null +++ b/scripts/test/html_proofer_staging.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +# The following script assumes the site is already built at _site. + +# Figure out the Jekyll baseurl. If this doesn't work for some reason, you can +# just hardcode it, eg: JEKYLL_BASEURL="/my-baseurl" +JEKYLL_BASEURL=/$GITHUB_REPOSITORY_NAME_PART +# We have to create a temporary folder to test in, because html-proofer does not +# like Jekyll's "baseurl", and interprets most links as broken. +mkdir -p ./_test$JEKYLL_BASEURL && +cp -r ./_site/* ./_test$JEKYLL_BASEURL/ && +touch ./_test/index.html && +bundle exec htmlproofer --allow-hash-href --disable-external ./_test && +rm -rf ./_test \ No newline at end of file