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

feat: Add CMS settings #161

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/worklows/cypress.yml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ Temporary Items

#IDE
.vscode/
node_modules/
*.py

# Jekyll
.jekyll-cache
_site
vendor
vendor
Gemifile
Gemfile.lock
5 changes: 1 addition & 4 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -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"
gem "jekyll-remote-theme", github: "benbalter/jekyll-remote-theme", branch: "master"
66 changes: 34 additions & 32 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
27 changes: 27 additions & 0 deletions _data/locales/client.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": {
"en": "Digital Transformation Office",
"fr": "Bureau de la transformation numérique"
},
"email": "[email protected]",
"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"
}
}
17 changes: 14 additions & 3 deletions _includes/resources-inc/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,20 @@
<script src="{{ setting-resourcesBasePathTheme }}/js/theme{{ setting-minifiedSuffix }}.js"></script>
{%- if page.script.first -%}
{%- for js in page.script -%}
<script src="{{ js }}"></script>
<script src="{{ js }}"></script>
{%- endfor -%}
{%- elsif page.script -%}
<script src="{{ page.script }}"></script>
<script src="{{ page.script }}"></script>
{%- endif -%}
{% if site.analytics.adobe %}{% include /providers/adobefooter.html %}{% endif %}
{% if site.analytics.adobe %}{% include /providers/adobefooter.html %}{% endif %}
<script>
if (window.netlifyIdentity) {
window.netlifyIdentity.on("init", (user) => {
if (!user) {
window.netlifyIdentity.on("login", () => {
document.location.href = "/admin/";
});
}
});
}
</script>
17 changes: 17 additions & 0 deletions _includes/resources-inc/head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<link href="{{ setting-resourcesBasePathTheme }}/assets/favicon.ico" rel="icon" type="image/x-icon" />
<link rel="stylesheet" href="{{ setting-resourcesBasePathTheme }}/css/theme{{ setting-minifiedSuffix }}.css" />
<noscript>
<link rel="stylesheet" href="{{ setting-resourcesBasePathWetboew }}/css/noscript{{ setting-minifiedSuffix }}.css" />
</noscript>
{%- if page.css.first -%}
{%- for sheet in page.css -%}
{%- if sheet.first -%}
<link rel="stylesheet" href="{{ sheet.href }}" integrity="{{ sheet.integrity }}" crossorigin="anonymous" />
{%- elsif sheet -%}
<link rel="stylesheet" href="{{ sheet }}" />
{%- endif -%}
{%- endfor -%}
{%- elsif page.css -%}
<link rel="stylesheet" href="{{ page.css }}" />
{%- endif -%}
<script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script>
14 changes: 7 additions & 7 deletions _layouts/core.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
{%- endcapture -%}
<!DOCTYPE html>
<html class="no-js" lang="{{ page.language | default: 'en' }}" dir="{{ i18nText-langDir | default: 'ltr' }}">
<head>
<meta charset="utf-8">
<head>
<meta charset="utf-8">
{% include license.html %}
<title>{{ page-title }} | {{ site.title[ page.language ] }}</title>
<meta content="width=device-width, initial-scale=1" name="viewport">
<title>{{ page-title }} | {{ site.title[ page.language ] }}</title>
<meta content="width=device-width, initial-scale=1" name="viewport">
{% include metadata.html %}
{% include resources-inc/head.html %}
{% include analytics.html %}
</head>
<body {% if page.pageclass %}class="{{ page.pageclass }}" {% endif %}vocab="http://schema.org/" typeof="WebPage">
</head>
<body {% if page.pageclass %}class="{{ page.pageclass }}" {% endif %}vocab="http://schema.org/" typeof="WebPage">
{%- if page.archived -%}
{% include headers-includes/archive.html %}
{%- endif -%}
Expand All @@ -26,5 +26,5 @@
{{ content }}
{% include footers/footer.html %}
{% include resources-inc/footer.html %}
</body>
</body>
</html>
4 changes: 4 additions & 0 deletions cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"baseUrl": "http://localhost:4000",
"watchForFileChanges": false
}
26 changes: 26 additions & 0 deletions cypress/integration/cms_spec.js
Original file line number Diff line number Diff line change
@@ -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('[email protected]');
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('[email protected]');
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');
});
});
Loading