Skip to content

Commit

Permalink
Only include Published and Visible Pages in header
Browse files Browse the repository at this point in the history
  • Loading branch information
OleVik committed Dec 27, 2020
1 parent 19b88c7 commit 1e902d6
Show file tree
Hide file tree
Showing 15 changed files with 2,067 additions and 360 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# v2.2.0
## 28-12-2020

1. [](#improved)
* Only include Published and Visible Pages in header
* Tests
2. [](#bugfix)
* CV-template
* Slight padding
* Router

# v2.1.0
## 22-09-2020

Expand Down
2 changes: 1 addition & 1 deletion blueprints.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Scholar
version: 2.1.0
version: 2.2.0
testing: true
description: An academic-focused theme, for publishing papers, articles, books, documentation, your blog, and even your resumé. Features include high accessibility, fast performance, print-friendly styles and more.
icon: book
Expand Down
4 changes: 2 additions & 2 deletions classes/Router/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ public function handlePrint(Page $Page, string $path): void
&& isset($Parent->header()->print['process'])
&& $Parent->header()->print['process'] === true
) {
$this->handleProcessedContent($page, $template);
$this->handleProcessedContent($Page, $template);
} elseif ($collection) {
$page = $this->handleRawContent($page, $collection, $template);
$page = $this->handleRawContent($Page, $collection, $template);
}
} else {
$page = $Parent;
Expand Down
182 changes: 85 additions & 97 deletions components/cv/cv.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,113 +2,101 @@

{% set body_classes = (body_classes|default('cv page')) %}

{% block main %}
{% block article %}
<article typeof="schema:{{ schema_type(page.template) }}">
{% block content %}

{% block header %}
<header role="banner">
{% include 'partials/header.html.twig' with {'page': page, 'navigablePage': navigablePage} %}
</header>
{% endblock %}

<main>
{% block article %}
<article typeof="schema:{{ schema_type(page.template) }}">
{% block content %}

{% if page.header.basics and page.header.basics is not empty %}
{% with {
'basics': page.header.basics
} %}
{{ block('content', 'partials/cv/header.html.twig') }}
{% endwith %}
{% endif %}
{% if page.header.basics and page.header.basics is not empty %}
{% with {
'basics': page.header.basics
} %}
{{ block('content', 'partials/cv/header.html.twig') }}
{% endwith %}
{% endif %}

<div>
{% if page.content is not empty %}
{{ page.content }}
{% elseif page.header.basics.description is not empty %}
{{ page.header.basics.description|markdown }}
{% endif %}
</div>
<div>
{% if page.content is not empty %}
{{ page.content }}
{% elseif page.header.basics.description is not empty %}
{{ page.header.basics.description|markdown }}
{% endif %}
</div>

<section>
{% if page.header.competencies and page.header.competencies is not empty %}
{% with {
'name': 'Competencies',
'listing': page.header.competencies
} %}
{{ block('content', 'partials/cv/listing.html.twig') }}
{% endwith %}
{% endif %}
{% if page.header.work and page.header.work is not empty %}
{% with {
'name': 'Work',
'listing': page.header.work
} %}
{{ block('content', 'partials/cv/listing.html.twig') }}
{% endwith %}
{% endif %}
{% if page.header.volunteer and page.header.volunteer is not empty %}
{% with {
'name': 'Volunteer',
'listing': page.header.volunteer
} %}
{{ block('content', 'partials/cv/listing.html.twig') }}
{% endwith %}
{% endif %}
{% if page.header.education and page.header.education is not empty %}
{% with {
'name': 'Education',
'listing': page.header.education
} %}
{{ block('content', 'partials/cv/listing.html.twig') }}
{% endwith %}
{% endif %}
{% if page.header.awards and page.header.awards is not empty %}
{% with {
'name': 'Awards',
'listing': page.header.awards
} %}
{{ block('content', 'partials/cv/listing.html.twig') }}
{% endwith %}
{% endif %}
{% if page.header.interests and page.header.interests is not empty %}
{% with {
'name': 'Interests',
'listing': page.header.interests
} %}
{{ block('content', 'partials/cv/listing.html.twig') }}
{% endwith %}
{% endif %}
{% if page.header.publications and page.header.publications is not empty %}
{% with {
'name': 'Publications',
'listing': page.header.publications
} %}
{{ block('content', 'partials/cv/listing.html.twig') }}
{% endwith %}
{% endif %}
{% if page.header.languages and page.header.languages is not empty %}
{% with {
'name': 'Languages',
'listing': page.header.languages
} %}
{{ block('content', 'partials/cv/listing.html.twig') }}
{% endwith %}
{% endif %}
</section>
<section>
{% if page.header.competencies and page.header.competencies is not empty %}
{% with {
'name': 'Competencies',
'listing': page.header.competencies
} %}
{{ block('content', 'partials/cv/listing.html.twig') }}
{% endwith %}
{% endif %}
{% if page.header.work and page.header.work is not empty %}
{% with {
'name': 'Work',
'listing': page.header.work
} %}
{{ block('content', 'partials/cv/listing.html.twig') }}
{% endwith %}
{% endif %}
{% if page.header.volunteer and page.header.volunteer is not empty %}
{% with {
'name': 'Volunteer',
'listing': page.header.volunteer
} %}
{{ block('content', 'partials/cv/listing.html.twig') }}
{% endwith %}
{% endif %}
{% if page.header.education and page.header.education is not empty %}
{% with {
'name': 'Education',
'listing': page.header.education
} %}
{{ block('content', 'partials/cv/listing.html.twig') }}
{% endwith %}
{% endif %}
{% if page.header.awards and page.header.awards is not empty %}
{% with {
'name': 'Awards',
'listing': page.header.awards
} %}
{{ block('content', 'partials/cv/listing.html.twig') }}
{% endwith %}
{% endif %}
{% if page.header.interests and page.header.interests is not empty %}
{% with {
'name': 'Interests',
'listing': page.header.interests
} %}
{{ block('content', 'partials/cv/listing.html.twig') }}
{% endwith %}
{% endif %}
{% if page.header.publications and page.header.publications is not empty %}
{% with {
'name': 'Publications',
'listing': page.header.publications
} %}
{{ block('content', 'partials/cv/listing.html.twig') }}
{% endwith %}
{% endif %}
{% if page.header.languages and page.header.languages is not empty %}
{% with {
'name': 'Languages',
'listing': page.header.languages
} %}
{{ block('content', 'partials/cv/listing.html.twig') }}
{% endwith %}
{% endif %}
</section>

{% endblock %}
</article>
{% endblock %}
</main>
</article>
{% endblock %}

{% block footer %}
{% include 'partials/footer.html.twig' %}
{% endblock %}

{% endblock %}

{% block append %}
{% if config.theme.toolbar.navigation and navigablePage.headings is not empty %}
{% include 'partials/drawer.html.twig' with {headings: navigablePage.headings} %}
Expand Down
2 changes: 1 addition & 1 deletion css/theme.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion css/theme.css.map

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions cypress.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
{
"baseUrl": "http://127.0.0.1:8000/",
"baseUrl": "http://localhost:8000/",
"numTestsKeptInMemory": 1000,
"watchForFileChanges": false,
"env": {
"context": {
"exclude": [["#query"], ["label[for=\"query\"]"], [".search-button"]]
"exclude": [
["#query"],
["label[for=\"query\"]"],
[".search-button"],
["nav[aria-checked]"],
["aside[aria-checked]"],
["drawer-menu[aria-checked]"]
]
},
"config": {
"runOnly": ["wcag2a", "section508", "best-practice"],
Expand Down
6 changes: 5 additions & 1 deletion cypress/integration/accessibility/routes.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ for (const [index, route] of Object.entries(Cypress.env("routes"))) {
for (const [name, dynamicRoute] of Object.entries(
Cypress.env("dynamicRoutes")
)) {
var base = "";
if (route !== "/") {
base = route;
}
describe(`${index}: ${name}`, () => {
it(`Visits ${dynamicRoute} (${route})`, function() {
it(`Reaches ${base}${dynamicRoute}`, function() {
if (route == "/") {
if (name == "data") {
cy.request(dynamicRoute);
Expand Down
22 changes: 13 additions & 9 deletions cypress/integration/accessibility/search.spec.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
/// <reference types="Cypress" />

for (const [index, route] of Object.entries(Cypress.env("routes"))) {
var base = "";
if (route !== "/") {
base = route;
}
if (["index", "blog", "docs"].includes(index)) {
describe(`Index-search at ${index} ${route}/search`, () => {
describe(`Index-search at ${index} ${base}/search`, () => {
before(function() {
cy.visit(route);
});
it("Accepts input", function() {
cy.get("#query").type("site");
});
it("Toggles results", function() {
cy.get(".search-results").should('be.visible');
});
it("Accepts input", function() {
cy.get("#query").type("site");
});
it("Toggles results", function() {
cy.get(".search-results").should("be.visible");
});
});
}
describe(`Content-search at ${index} ${route}/search`, () => {
describe(`Content-search at ${index} ${base}/search`, () => {
before(function() {
if (route == "/") {
cy.visit(`/search`);
Expand All @@ -30,7 +34,7 @@ for (const [index, route] of Object.entries(Cypress.env("routes"))) {
cy.get(".search-query #title").type("site");
});
it("Toggles results", function() {
cy.get(".search-results").should('be.visible');
cy.get(".search-results").should("be.visible");
});
});
}
Loading

0 comments on commit 1e902d6

Please sign in to comment.