diff --git a/.github/worklows/cypress.yml b/.github/worklows/cypress.yml new file mode 100644 index 00000000..1f7e7400 --- /dev/null +++ b/.github/worklows/cypress.yml @@ -0,0 +1,30 @@ +name: Cypress Tests + +on: [push, pull_request] + +jobs: + cypress-run: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: '16' + + - name: Install dependencies + run: npm install + + - name: Start Jekyll server + run: | + gem install bundler jekyll + bundle install + nohup bundle exec jekyll serve --host 0.0.0.0 & + + - name: Wait for Jekyll to start + run: npx wait-on http://localhost:4000 + + - name: Run Cypress tests + run: npx cypress run \ No newline at end of file diff --git a/.gitignore b/.gitignore index 40da2e53..502e7352 100644 --- a/.gitignore +++ b/.gitignore @@ -33,8 +33,12 @@ Temporary Items #IDE .vscode/ +node_modules/ +*.py # Jekyll .jekyll-cache _site -vendor \ No newline at end of file +vendor +Gemifile +Gemfile.lock diff --git a/Gemfile b/Gemfile index d08d3e6f..7b8ffa59 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,3 @@ -# frozen_string_literal: true - source "https://rubygems.org" -gem "jekyll-seo-tag" -gem "jekyll-remote-theme", github: "benbalter/jekyll-remote-theme", branch: "master" \ No newline at end of file +gem "jekyll-remote-theme", github: "benbalter/jekyll-remote-theme", branch: "master" diff --git a/Gemfile.lock b/Gemfile.lock index 2854124b..7ff76c7d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -12,75 +12,77 @@ GIT GEM remote: https://rubygems.org/ specs: - addressable (2.8.0) - public_suffix (>= 2.0.2, < 5.0) + addressable (2.8.6) + public_suffix (>= 2.0.2, < 6.0) + bigdecimal (3.1.8) colorator (1.1.0) - concurrent-ruby (1.1.10) + concurrent-ruby (1.3.1) em-websocket (0.5.3) eventmachine (>= 0.12.9) http_parser.rb (~> 0) eventmachine (1.2.7) - ffi (1.15.5) + ffi (1.17.0-arm64-darwin) forwardable-extended (2.6.0) + google-protobuf (4.27.0-arm64-darwin) + bigdecimal + rake (>= 13) http_parser.rb (0.8.0) - i18n (1.10.0) + i18n (1.14.5) concurrent-ruby (~> 1.0) - jekyll (4.2.2) + jekyll (4.3.3) addressable (~> 2.4) colorator (~> 1.0) em-websocket (~> 0.5) i18n (~> 1.0) - jekyll-sass-converter (~> 2.0) + jekyll-sass-converter (>= 2.0, < 4.0) jekyll-watch (~> 2.0) - kramdown (~> 2.3) + kramdown (~> 2.3, >= 2.3.1) kramdown-parser-gfm (~> 1.0) liquid (~> 4.0) - mercenary (~> 0.4.0) + mercenary (>= 0.3.6, < 0.5) pathutil (~> 0.9) - rouge (~> 3.0) + rouge (>= 3.0, < 5.0) safe_yaml (~> 1.0) - terminal-table (~> 2.0) - jekyll-sass-converter (2.2.0) - sassc (> 2.0.1, < 3.0) - jekyll-seo-tag (2.8.0) - jekyll (>= 3.8, < 5.0) + terminal-table (>= 1.8, < 4.0) + webrick (~> 1.7) + jekyll-sass-converter (3.0.0) + sass-embedded (~> 1.54) jekyll-watch (2.2.1) listen (~> 3.0) - kramdown (2.3.2) + kramdown (2.4.0) rexml kramdown-parser-gfm (1.1.0) kramdown (~> 2.0) - liquid (4.0.3) - listen (3.7.1) + liquid (4.0.4) + listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) mercenary (0.4.0) pathutil (0.16.2) forwardable-extended (~> 2.6) - public_suffix (4.0.6) - rb-fsevent (0.11.1) - rb-inotify (0.10.1) + public_suffix (5.0.5) + rake (13.2.1) + rb-fsevent (0.11.2) + rb-inotify (0.11.1) ffi (~> 1.0) rexml (3.2.8) strscan (>= 3.0.9) - rouge (3.28.0) + rouge (4.2.1) rubyzip (2.3.2) safe_yaml (1.0.5) - sassc (2.4.0) - ffi (~> 1.9) + sass-embedded (1.77.4-arm64-darwin) + google-protobuf (>= 3.25, < 5.0) strscan (3.1.0) - terminal-table (2.0.0) - unicode-display_width (~> 1.1, >= 1.1.1) - unicode-display_width (1.8.0) + terminal-table (3.0.2) + unicode-display_width (>= 1.1.1, < 3) + unicode-display_width (2.5.0) + webrick (1.8.1) PLATFORMS - universal-darwin-20 - universal-darwin-21 - x86_64-linux + arm64-darwin-22 DEPENDENCIES jekyll-remote-theme! - jekyll-seo-tag BUNDLED WITH - 2.3.9 + 2.4.13 diff --git a/_data/locales/client.json b/_data/locales/client.json new file mode 100644 index 00000000..d49e3629 --- /dev/null +++ b/_data/locales/client.json @@ -0,0 +1,27 @@ +{ + "name": { + "en": "Digital Transformation Office", + "fr": "Bureau de la transformation numérique" + }, + "email": "cds.dto-btn.snc@servicecanada.gc.ca", + "phoneForTel": "555-123-4567", + "phoneFormatted": "(555) 123-4567", + "address": { + "lineOne": "First Address Line", + "lineTwo": "Second Address Line", + "city": "Denver", + "state": "CO", + "zip": "80206", + "mapLink": "https://goo.gl/maps/UAQn4vuGDiwv7DV39" + }, + "social": { + "facebook": "https://www.facebook.com/", + "twitter": "https://twitter.com/", + "instagram": "https://www.instagram.com/", + "youtube": "https://www.youtube.com/" + }, + "domain": { + "en": "https://blog.canada.ca", + "fr": "https://blogue.canada.ca" + } +} \ No newline at end of file diff --git a/_includes/resources-inc/footer.html b/_includes/resources-inc/footer.html index baa24023..8461defe 100644 --- a/_includes/resources-inc/footer.html +++ b/_includes/resources-inc/footer.html @@ -3,9 +3,20 @@ {%- if page.script.first -%} {%- for js in page.script -%} - + {%- endfor -%} {%- elsif page.script -%} - + {%- endif -%} -{% if site.analytics.adobe %}{% include /providers/adobefooter.html %}{% endif %} \ No newline at end of file +{% if site.analytics.adobe %}{% include /providers/adobefooter.html %}{% endif %} + \ No newline at end of file diff --git a/_includes/resources-inc/head.html b/_includes/resources-inc/head.html new file mode 100644 index 00000000..dbb48fb9 --- /dev/null +++ b/_includes/resources-inc/head.html @@ -0,0 +1,17 @@ + + + +{%- if page.css.first -%} + {%- for sheet in page.css -%} + {%- if sheet.first -%} + + {%- elsif sheet -%} + + {%- endif -%} + {%- endfor -%} +{%- elsif page.css -%} + +{%- endif -%} + \ No newline at end of file diff --git a/_layouts/core.html b/_layouts/core.html index 733eb196..2b906573 100644 --- a/_layouts/core.html +++ b/_layouts/core.html @@ -8,16 +8,16 @@ {%- endcapture -%} - - + + {% include license.html %} -{{ page-title }} | {{ site.title[ page.language ] }} - + {{ page-title }} | {{ site.title[ page.language ] }} + {% include metadata.html %} {% include resources-inc/head.html %} {% include analytics.html %} - - + + {%- if page.archived -%} {% include headers-includes/archive.html %} {%- endif -%} @@ -26,5 +26,5 @@ {{ content }} {% include footers/footer.html %} {% include resources-inc/footer.html %} - + \ No newline at end of file diff --git a/cypress.json b/cypress.json new file mode 100644 index 00000000..2c8313bf --- /dev/null +++ b/cypress.json @@ -0,0 +1,4 @@ +{ + "baseUrl": "http://localhost:4000", + "watchForFileChanges": false +} \ No newline at end of file diff --git a/cypress/integration/cms_spec.js b/cypress/integration/cms_spec.js new file mode 100644 index 00000000..25e4724b --- /dev/null +++ b/cypress/integration/cms_spec.js @@ -0,0 +1,26 @@ +describe('DecapCMS Integration', () => { + it('should load the CMS login page', () => { + cy.visit('/admin'); + cy.contains('Login').should('be.visible'); + }); + + it('should allow a user to log in', () => { + cy.visit('/admin'); + cy.get('input[name="email"]').type('david.elisma@cds-snc.ca'); + cy.get('input[name="password"]').type('your-password'); + cy.get('button[type="submit"]').click(); + cy.contains('Collections').should('be.visible'); + }); + + it('should allow creating a new post', () => { + cy.visit('/admin'); + cy.get('input[name="email"]').type('david.elisma@cds-snc.ca'); + cy.get('input[name="password"]').type('your-password'); + cy.get('button[type="submit"]').click(); + cy.contains('New Post').click(); + cy.get('input[name="title"]').type('My New Post'); + cy.get('textarea[name="body"]').type('This is the content of my new post.'); + cy.contains('Save').click(); + cy.contains('Saved').should('be.visible'); + }); + }); \ No newline at end of file diff --git a/en/admin/config.yml b/en/admin/config.yml new file mode 100644 index 00000000..477a7b5d --- /dev/null +++ b/en/admin/config.yml @@ -0,0 +1,123 @@ +backend: + name: git-gateway + branch: content # Branch to update (optional; defaults to master) +# This line should *not* be indented +media_folder: "en/images/thumbs" # Media files will be stored in the repo under images/uploads +public_folder: "/en/images/thumbs" + +collections: + # SETTINGS CONFIG + - label: Settings + name: settings + delete: false + editor: + preview: false + files: + - label: Website Settings + name: website_settings + file: _data/client.json + description: Allows a client to update their own contact information, through the default client.json file + fields: + - label: Business Name + name: name + widget: string + summary: Used in browser tab and sharing links + - label: English + name: en + widget: string + - label: French + name: fr + widget: string + + - label: Email + name: email + widget: string + summary: Main email for customers to contact you + + - label: Unformatted Telephone + name: phoneForTel + widget: string + summary: Used for clickable links to phone. Enter in format xxx-xxx-xxxx + + - label: Formatted Telephone + name: phoneFormatted + widget: string + summary: Used for display on website. Enter in your preferred format + + - label: Address + name: address + widget: object + collapsed: true + fields: + - label: Address Line One + name: lineOne + widget: string + + - label: Address Line Two + name: lineTwo + widget: string + + - label: City + name: city + widget: string + + - label: State + name: state + widget: string + + - label: Zip Code + name: zip + widget: string + + - label: Google Maps Link + name: mapLink + widget: string + summary: Provide a Google Maps share link to guide visitors to your physical locations + + - label: Social Media + name: social + widget: object + collapsed: true + fields: + - label: Facebook + name: facebook + widget: string + + - label: Twitter + name: twitter + widget: string + + - label: Instagram + name: instagram + widget: string + + - label: Youtube + name: youtube + widget: string + # BLOG CONFIG + - name: "blog" # Used in routes, e.g., /admin/collections/blog + label: "Blog" # Used in the UI + folder: "en/_posts" # The path to the folder where the documents are stored + create: true # Allow users to create new documents in this collection + slug: "{{year}}/{{month}}/{{day}}/{{slug}}" # Filename template, e.g., YYYY/MM/DD/title.md + identifier_field: slug + fields: # The fields for each document, usually in front matter + - { label: "Alternate language page url", name: "altLangPage", widget: "string" } + - { label: "Title", name: "title", widget: "string" } + - { label: "Publish Date", name: "date", widget: "datetime" } + - { label: "Description", name: "description", widget: "string" } + - { label: "Thumbnail image", name: "thumbnail", widget: "image" } + - { label: "Body", name: "body", widget: "markdown" } + # PAGE CONFIG + - name: "pages" + label: "Pages" + folder: "en/pages" + create: true + slug: "{{slug}}" + fields: + - { label: "Layout", name: "layout", widget: "string" } + - { label: "Body", name: "body", widget: "markdown" } + +logo_url: https://wet-boew.github.io/themes-dist/GCWeb/GCWeb/assets/sig-blk-en.svg +publish_mode: editorial_workflow +site_url: https://blog.canada.ca \ No newline at end of file diff --git a/en/admin/index.html b/en/admin/index.html new file mode 100644 index 00000000..171620a9 --- /dev/null +++ b/en/admin/index.html @@ -0,0 +1,14 @@ + + + + + + + Canada.ca Design System Content Manager + + + + + + + \ No newline at end of file diff --git a/netlify.toml b/netlify.toml new file mode 100644 index 00000000..a87d0645 --- /dev/null +++ b/netlify.toml @@ -0,0 +1,4 @@ +[[redirects]] + from = "/admin" + to = "/admin/" + status = 200 \ No newline at end of file