1
0
mirror of https://github.com/typemill/typemill.git synced 2025-08-03 04:37:26 +02:00

Version 1.4.6: Optimize Print, add print button, fix text, update cypress tests

This commit is contained in:
trendschau
2021-06-13 15:43:26 +02:00
parent bc5c0734ff
commit 7da5da93f5
17 changed files with 133 additions and 95 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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: { }

View File

@@ -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 ()
{

View File

@@ -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/)
})
})

View File

@@ -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)
})
})
})

View File

@@ -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')
})
})

View File

@@ -62,10 +62,10 @@ class SetupController extends Controller
{
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();

View File

@@ -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%;
}
}

View File

@@ -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

View File

@@ -220,6 +220,13 @@
<symbol id="icon-user" viewBox="0 0 20 28">
<path d="M20 21.859c0 2.281-1.5 4.141-3.328 4.141h-13.344c-1.828 0-3.328-1.859-3.328-4.141 0-4.109 1.016-8.859 5.109-8.859 1.266 1.234 2.984 2 4.891 2s3.625-0.766 4.891-2c4.094 0 5.109 4.75 5.109 8.859zM16 8c0 3.313-2.688 6-6 6s-6-2.688-6-6 2.688-6 6-6 6 2.688 6 6z"></path>
</symbol>
<symbol id="icon-pencil" viewBox="0 0 32 32">
<path d="M27 0c2.761 0 5 2.239 5 5 0 1.126-0.372 2.164-1 3l-2 2-7-7 2-2c0.836-0.628 1.874-1 3-1zM2 23l-2 9 9-2 18.5-18.5-7-7-18.5 18.5zM22.362 11.362l-14 14-1.724-1.724 14-14 1.724 1.724z"></path>
</symbol>
<symbol id="icon-printer" viewBox="0 0 32 32">
<path d="M8 2h16v4h-16v-4z"></path>
<path d="M30 8h-28c-1.1 0-2 0.9-2 2v10c0 1.1 0.9 2 2 2h6v8h16v-8h6c1.1 0 2-0.9 2-2v-10c0-1.1-0.9-2-2-2zM4 14c-1.105 0-2-0.895-2-2s0.895-2 2-2 2 0.895 2 2-0.895 2-2 2zM22 28h-12v-10h12v10z"></path>
</symbol>
</defs>
</svg>
<div class="account fixed pb2 top-0 right-0 left-0">

View File

@@ -34,7 +34,7 @@
<div class="grid-main ph3 ph4-l pv3 lh-copy f4 fw3">
<nav>
<nav id="breadcrumb">
{% include 'partials/breadcrumb.twig' %}
</nav>
@@ -43,7 +43,7 @@
<h1>{{ title }}</h1>
{% if (settings.themes.cyanine.datePosition.top or settings.themes.cyanine.authorPosition.top or settings.themes.cyanine.gitPosition.top) %}
{% if (settings.themes.cyanine.datePosition.top or settings.themes.cyanine.authorPosition.top or settings.themes.cyanine.gitPosition.top or settings.themes.cyanine.printPosition.top) %}
<div class="f5 pv1 flex justify-between">
<div class="byline">
{% if settings.themes.cyanine.datePosition.top %}
@@ -54,7 +54,10 @@
{% endif %}
</div>
{% if settings.themes.cyanine.gitPosition.top %}
<a class="link" title="edit on github" href="{{ settings.themes.cyanine.gitLink }}{{ item.path }}">{{ settings.themes.cyanine.editText }}</a>
<a class="link" title="edit on github" href="{{ settings.themes.cyanine.gitLink }}{{ item.path }}">{% if settings.themes.cyanine.editIcon %}<svg class="icon baseline icon-edit"><use xlink:href="#icon-edit"></use></svg>{% else %}{{ settings.themes.cyanine.editText }}{% endif %}</a>
{% endif %}
{% if settings.themes.cyanine.printPosition.top %}
<a class="link" title="open printer dialogue" href="#" onclick="if (window.print) {window.print();}">{% if settings.themes.cyanine.printIcon %}<svg class="icon baseline icon-printer"><use xlink:href="#icon-printer"></use></svg>{% else %}{{ settings.themes.cyanine.printText }}{% endif %}</a>
{% endif %}
</div>
{% endif %}
@@ -62,7 +65,7 @@
{{ content }}
{% if (settings.themes.cyanine.datePosition.bottom or settings.themes.cyanine.authorPosition.bottom or settings.themes.cyanine.gitPosition.bottom) %}
{% if (settings.themes.cyanine.datePosition.bottom or settings.themes.cyanine.authorPosition.bottom or settings.themes.cyanine.gitPosition.bottom or settings.themes.cyanine.printPosition.bottom) %}
<div class="f5 pv1 flex justify-between">
<div class="byline">
{% if settings.themes.cyanine.datePosition.bottom %}
@@ -72,9 +75,12 @@
<adress class="pr2">{{ settings.themes.cyanine.authorIntro }} {{ metatabs.meta.author|default(settings.author) }}</adress>
{% endif %}
</div>
{% if settings.themes.cyanine.gitPosition.bottom %}
<a class="link" title="edit on github" href="{{ settings.themes.cyanine.gitLink }}{{ item.path }}">{{ settings.themes.cyanine.editText }}</a>
{% endif %}
{% if settings.themes.cyanine.gitPosition.bottom %}
<a class="link" title="edit on github" href="{{ settings.themes.cyanine.gitLink }}{{ item.path }}">{% if settings.themes.cyanine.editIcon %}<svg class="icon baseline icon-edit"><use xlink:href="#icon-edit"></use></svg>{% else %}{{ settings.themes.cyanine.editText }}{% endif %}</a>
{% endif %}
{% if settings.themes.cyanine.printPosition.bottom %}
<a class="link" title="open printer dialogue" href="#" onclick="if (window.print) {window.print();}">{% if settings.themes.cyanine.printIcon %}<svg class="icon baseline icon-printer"><use xlink:href="#icon-printer"></use></svg>{% else %}{{ settings.themes.cyanine.printText }}{% endif %}</a>
{% endif %}
</div>
{% endif %}
@@ -84,7 +90,7 @@
{% if item.prevItem or item.nextItem %}
<div class="f5 pv5 flex justify-between {{ settings.themes.cyanine.fontnavi|default('tm-sans-serif') }}">
<div id="bottompager" class="f5 pv5 flex justify-between {{ settings.themes.cyanine.fontnavi|default('tm-sans-serif') }}">
{% if item.prevItem %}
<a class="navigation link pv2 ph3 ba dim" href="{{ item.prevItem.urlRel }}">&lsaquo;&nbsp; {{ item.prevItem.name }}</a>
{% endif %}