From 7da5da93f5f738c4cee80e44d945e05e4327080d Mon Sep 17 00:00:00 2001 From: trendschau Date: Sun, 13 Jun 2021 15:43:26 +0200 Subject: [PATCH] Version 1.4.6: Optimize Print, add print button, fix text, update cypress tests --- content/01-cyanine-theme/00-footer.yaml | 15 ------ .../{03-landingpage.md => 00-landingpage.md} | 0 ...rs-and-fonts.md => 01-colors-and-fonts.md} | 0 .../01-cyanine-theme/01-content-elements.yaml | 13 ----- .../01-cyanine-theme/02-colors-and-fonts.yaml | 13 ----- .../{00-footer.md => 02-footer.md} | 0 ...ent-elements.md => 03-content-elements.md} | 0 content/01-cyanine-theme/03-landingpage.yaml | 13 ----- cypress/test01-system-setup.spec.js | 21 +++++++- cypress/test02-initial-frontend.spec.js | 21 ++++---- cypress/test05-blox-editor.spec.js | 6 +-- cypress/test99-login.spec.js | 18 +------ system/Controllers/SetupController.php | 4 +- themes/cyanine/css/style.css | 49 +++++++++++++++++++ themes/cyanine/cyanine.yaml | 26 ++++++++++ themes/cyanine/layout.twig | 7 +++ themes/cyanine/page.twig | 22 ++++++--- 17 files changed, 133 insertions(+), 95 deletions(-) delete mode 100644 content/01-cyanine-theme/00-footer.yaml rename content/01-cyanine-theme/{03-landingpage.md => 00-landingpage.md} (100%) rename content/01-cyanine-theme/{02-colors-and-fonts.md => 01-colors-and-fonts.md} (100%) delete mode 100644 content/01-cyanine-theme/01-content-elements.yaml delete mode 100644 content/01-cyanine-theme/02-colors-and-fonts.yaml rename content/01-cyanine-theme/{00-footer.md => 02-footer.md} (100%) rename content/01-cyanine-theme/{01-content-elements.md => 03-content-elements.md} (100%) delete mode 100644 content/01-cyanine-theme/03-landingpage.yaml diff --git a/content/01-cyanine-theme/00-footer.yaml b/content/01-cyanine-theme/00-footer.yaml deleted file mode 100644 index 5944c97e..00000000 --- a/content/01-cyanine-theme/00-footer.yaml +++ /dev/null @@ -1,15 +0,0 @@ -meta: - title: '3-Column Footer' - description: 'Cyanine provides a three column footer at the bottom of each page. You can use markdown for each column. Make sure that you use the correct headline-level (we suggest a headline level 3 or level 4 to keep the logical headline hierarchy in the document). You can, of course, also add link-lists or' - heroimage: null - heroimagealt: null - owner: null - author: trendschau - manualdate: '' - modified: '2021-05-18' - created: '2020-06-11' - time: 23-42-27 - navtitle: '' - hide: false - allowedrole: null - alloweduser: null diff --git a/content/01-cyanine-theme/03-landingpage.md b/content/01-cyanine-theme/00-landingpage.md similarity index 100% rename from content/01-cyanine-theme/03-landingpage.md rename to content/01-cyanine-theme/00-landingpage.md diff --git a/content/01-cyanine-theme/02-colors-and-fonts.md b/content/01-cyanine-theme/01-colors-and-fonts.md similarity index 100% rename from content/01-cyanine-theme/02-colors-and-fonts.md rename to content/01-cyanine-theme/01-colors-and-fonts.md diff --git a/content/01-cyanine-theme/01-content-elements.yaml b/content/01-cyanine-theme/01-content-elements.yaml deleted file mode 100644 index baedf479..00000000 --- a/content/01-cyanine-theme/01-content-elements.yaml +++ /dev/null @@ -1,13 +0,0 @@ -meta: - title: 'Content Elements' - description: "There are a lot of other settings for your content area. For example: \n" - heroimage: '' - heroimagealt: null - owner: testauthor - author: trendschau - manualdate: null - modified: '2020-06-14' - created: '2020-06-11' - time: 21-05-02 - navtitle: 'content elements' - hide: false diff --git a/content/01-cyanine-theme/02-colors-and-fonts.yaml b/content/01-cyanine-theme/02-colors-and-fonts.yaml deleted file mode 100644 index ae26f490..00000000 --- a/content/01-cyanine-theme/02-colors-and-fonts.yaml +++ /dev/null @@ -1,13 +0,0 @@ -meta: - title: 'Colors and Fonts' - description: 'First of all cyanine supports individual logos. If you want to use our logo, then please upload it in the system settings. Cyanine will automatically replace the title text with your logo. ' - heroimage: null - heroimagealt: null - owner: null - author: trendschau - manualdate: null - modified: '2020-06-14' - created: '2020-06-11' - time: 20-37-12 - navtitle: 'colors and fonts' - hide: false diff --git a/content/01-cyanine-theme/00-footer.md b/content/01-cyanine-theme/02-footer.md similarity index 100% rename from content/01-cyanine-theme/00-footer.md rename to content/01-cyanine-theme/02-footer.md diff --git a/content/01-cyanine-theme/01-content-elements.md b/content/01-cyanine-theme/03-content-elements.md similarity index 100% rename from content/01-cyanine-theme/01-content-elements.md rename to content/01-cyanine-theme/03-content-elements.md diff --git a/content/01-cyanine-theme/03-landingpage.yaml b/content/01-cyanine-theme/03-landingpage.yaml deleted file mode 100644 index 5ba86794..00000000 --- a/content/01-cyanine-theme/03-landingpage.yaml +++ /dev/null @@ -1,13 +0,0 @@ -meta: - title: 'The Landingpage' - description: "Cyanine provides an optional landingpage with six segments: \nIntro with the content of the home page and an additional link/button.\nInfo with individual markdown content.\nTeaser with two elements. Each element has a headline, a text and a button/link.\nContrast with a headline, text-input and a" - author: trendschau - created: '2020-06-11' - time: 20-05-35 - navtitle: landingpage - modified: '2020-06-11' -seo: - seoimage: '' - seoimagealt: null - Checkbox: null - mycfiel: { } diff --git a/cypress/test01-system-setup.spec.js b/cypress/test01-system-setup.spec.js index 74eb02f6..f0e3fbad 100644 --- a/cypress/test01-system-setup.spec.js +++ b/cypress/test01-system-setup.spec.js @@ -31,6 +31,7 @@ describe('Typemill Setup', function() cy.get('.error').should('contain', 'Length between 5 - 20') }) +/* it('fails without CSRF-token', function () { cy.request({ @@ -45,8 +46,26 @@ describe('Typemill Setup', function() } }) .its('body') - .should('include', 'Failed CSRF check') + .should('include', 'The form has a timeout') }) +*/ + it('fails without CSRF-token', function () + { + cy.visit('/setup') + + // enter correct data + cy.get('input[name="username"]').clear().type('trendschau') + cy.get('input[name="email"]').clear().type('trendschau@gmail.com') + cy.get('input[name="password"]').clear().type('password') + cy.get('#csrf_value').then(elem => { + elem.val('wrongvalue'); + }); + + // submit and get validation errors + cy.get('form').submit() + cy.get('#flash-message').should('contain', 'form has a timeout') + }) + it('submits valid form data and visit welcome and settings page', function () { diff --git a/cypress/test02-initial-frontend.spec.js b/cypress/test02-initial-frontend.spec.js index 89a328b8..3e8e9f89 100644 --- a/cypress/test02-initial-frontend.spec.js +++ b/cypress/test02-initial-frontend.spec.js @@ -10,17 +10,18 @@ describe('Typemill Initial Frontend', function() /* has start and setup button */ cy.get('nav').find('a').should(($a) => { - expect($a).to.have.length(10) + expect($a).to.have.length(11) expect($a[0].href).to.match(/welcome/) - expect($a[1].href).to.match(/welcome\/setup/) - expect($a[2].href).to.match(/welcome\/write-content/) - expect($a[3].href).to.match(/welcome\/get-help/) - expect($a[4].href).to.match(/welcome\/markdown-test/) - expect($a[5].href).to.match(/cyanine-theme/) - expect($a[6].href).to.match(/cyanine-theme\/landingpage/) - expect($a[7].href).to.match(/cyanine-theme\/colors-and-fonts/) - expect($a[8].href).to.match(/cyanine-theme\/footer/) - expect($a[9].href).to.match(/cyanine-theme\/content-elements/) + expect($a[1].href).to.match(/welcome\/setup-your-website/) + expect($a[2].href).to.match(/welcome\/manage-access/) + expect($a[3].href).to.match(/welcome\/write-content/) + expect($a[4].href).to.match(/welcome\/get-help/) + expect($a[5].href).to.match(/welcome\/markdown-test/) + expect($a[6].href).to.match(/cyanine-theme/) + expect($a[7].href).to.match(/cyanine-theme\/landingpage/) + expect($a[8].href).to.match(/cyanine-theme\/colors-and-fonts/) + expect($a[9].href).to.match(/cyanine-theme\/footer/) + expect($a[10].href).to.match(/cyanine-theme\/content-elements/) }) }) diff --git a/cypress/test05-blox-editor.spec.js b/cypress/test05-blox-editor.spec.js index 05879d64..f9d0a65a 100644 --- a/cypress/test05-blox-editor.spec.js +++ b/cypress/test05-blox-editor.spec.js @@ -44,8 +44,8 @@ describe('Blox Editor', function() cy.get('.navi-list') .should('contain', 'Testpage') .eq(2).find('a').should(($a) => { - expect($a).to.have.length(5) - expect($a[4].href).to.include('/welcome\/testpage') + expect($a).to.have.length(6) + expect($a[5].href).to.include('/welcome\/testpage') }) }) @@ -277,7 +277,7 @@ describe('Blox Editor', function() cy.get('.navi-list') .not('contain', 'Testpage') .eq(2).find('a').should(($a) => { - expect($a).to.have.length(4) + expect($a).to.have.length(5) }) }) }) \ No newline at end of file diff --git a/cypress/test99-login.spec.js b/cypress/test99-login.spec.js index 00eb428f..f2dca144 100644 --- a/cypress/test99-login.spec.js +++ b/cypress/test99-login.spec.js @@ -43,22 +43,6 @@ describe('Typemill Login', function() cy.contains('Logout').click() cy.url().should('include', '/tm/login') }) - - it('fails without CSRF-token', function () - { - cy.request({ - method: 'POST', - url: '/tm/login', // baseUrl is prepended to url - form: true, // indicates the body should be form urlencoded and sets Content-Type: application/x-www-form-urlencoded headers - failOnStatusCode: false, - body: { - username: 'trendschau', - password: 'password' - } - }) - .its('body') - .should('include', 'Failed CSRF check') - }) it('blocks after 3 fails', function () { @@ -82,6 +66,6 @@ describe('Typemill Login', function() cy.get('form').submit() cy.get('#flash-message').should('contain', 'Too many bad logins') cy.contains('wait') - cy.contains('Forgot password') + cy.contains('forgot password') }) }) \ No newline at end of file diff --git a/system/Controllers/SetupController.php b/system/Controllers/SetupController.php index 02dafffe..c175c7af 100644 --- a/system/Controllers/SetupController.php +++ b/system/Controllers/SetupController.php @@ -62,10 +62,10 @@ public function create($request, $response, $args) { if($request->isPost()) { - if( $request->getattribute('csrf_result') === false ) + if( ( null !== $request->getattribute('csrf_result') ) OR ( $request->getattribute('csrf_result') === false ) ) { $this->c->flash->addMessage('error', 'The form has a timeout, please try again.'); - return $response->withRedirect($this->c->router->pathFor('setup.welcome')); + return $response->withRedirect($this->c->router->pathFor('setup.show')); } $params = $request->getParams(); diff --git a/themes/cyanine/css/style.css b/themes/cyanine/css/style.css index 804bbd93..13da8e06 100644 --- a/themes/cyanine/css/style.css +++ b/themes/cyanine/css/style.css @@ -509,4 +509,53 @@ button.play-video::after { font-size: inherit; max-height: inherit; } +} + +@media print { + #contentnav, #bottompager{ + display: none; + } + .grid-main{ + margin-top: -10px!important; + padding-top: 0px!important; + } + .logo a[href]:after { + content: "Homepage: " attr(href); + display: block; + margin: 1rem 0; + font-size: 14px; + font-weight: normal; + } + body{ +// padding: 3rem 3rem 3rem 5rem!important; + } + main{ + padding-bottom: 0!important; + } + aside{ + padding-top: 0!important; + padding-bottom: 0!important; + } + main,footer{ + border: 0px!important; + } + footer .ph3 + { + padding-top: 0; + padding-bottom: 0; + } + body, .landingpagecontrast, .account, main, footer, .landingpageintro, .landingpageinfo, .landingpageteaser, .landingpagenavi, .landingpagenews, button.expander, .notice4{ + background: #fff!important; + color: black!important; + } + article a[href]{ + color: black; + text-decoration: underline; + } + article a[href]:after { + content: " (" attr(href) ")"; + } + nav .mw6{ + width: 100%; + } } \ No newline at end of file diff --git a/themes/cyanine/cyanine.yaml b/themes/cyanine/cyanine.yaml index 5e2448c2..7e19910a 100644 --- a/themes/cyanine/cyanine.yaml +++ b/themes/cyanine/cyanine.yaml @@ -258,6 +258,32 @@ forms: label: Text/label for edit link placeholder: edit on github + editIcon: + type: checkbox + label: Icon + checkboxlabel: use an edit-icon instead of text + + fieldsetPrint: + type: fieldset + legend: Print Button + fields: + printPosition: + type: checkboxlist + label: Position of the print-button (top/bottom) + options: + top: Top + bottom: Bottom + + printText: + type: text + label: Text/label for print-button + placeholder: print + + printIcon: + type: checkbox + label: Icon + checkboxlabel: use a print-icon instead of text + fieldsetNavigations: type: fieldset legend: Navigations and Chapters diff --git a/themes/cyanine/layout.twig b/themes/cyanine/layout.twig index 1a7e6350..ec2f0aa9 100644 --- a/themes/cyanine/layout.twig +++ b/themes/cyanine/layout.twig @@ -220,6 +220,13 @@ + + + + + + +
diff --git a/themes/cyanine/page.twig b/themes/cyanine/page.twig index f8d80814..e5964c89 100644 --- a/themes/cyanine/page.twig +++ b/themes/cyanine/page.twig @@ -34,7 +34,7 @@
-