Skip to content

Commit

Permalink
Lock to 1.6, gracefully fail
Browse files Browse the repository at this point in the history
  • Loading branch information
OleVik committed Feb 20, 2020
1 parent bb239ee commit b564e69
Show file tree
Hide file tree
Showing 6 changed files with 230 additions and 28 deletions.
17 changes: 14 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# v1.0.3
## 20-02-2020

1. [](#new)
* Lock version to Grav 1.6.* until 1.7 stabilizes
* Silently fail on Flex
2. [](#bugfix)
* Gracefully fail lookups for Blueprints
* Fallback to Page titles if no menu-property is set
* Temporarily revert Blueprint-helpers

# v1.0.2
## 28-12-2019
## 28-12-2019

1. [](#improved)
* Test-coverage
Expand All @@ -9,7 +20,7 @@
* Article Search-field

# v1.0.1
## 27-12-2019
## 27-12-2019

1. [](#improved)
* Next- and previous-linking
Expand All @@ -20,7 +31,7 @@
* Advanced Search link in Docs

# v1.0.0
## 25-12-2019
## 25-12-2019

1. [](#new)
* Initial public release
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,17 @@ This theme started as a clone of Paul Hibbitt's [Learn2 with Git Sync](https://g
## [Development](https://github.com/OleVik/grav-theme-scholar/blob/master/DEVELOPMENT.md)

## [Contributing](https://github.com/OleVik/grav-theme-scholar/blob/master/CONTRIBUTING.md)

## TODO

- [ ] Smaller type for related Pages
- [ ] Drop for Blog (or make dependant on Related?)
- [ ] Visible on mobile
- [ ] Enable header across the board
- [ ] Optional through toolbar.enabled
- [ ] Margin- and sidenotes across the board
- [ ] Theme.css adaptation
- [ ] Generalize chaper.html.twig and listing.html.twig
- [ ] Chapter: Hide all if content
- [ ] Listing: Show all always
- [ ] Extension: Filter content with FlexSearch
213 changes: 190 additions & 23 deletions blueprints.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Scholar
version: 1.0.2
version: 1.0.3
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
author:
Expand All @@ -12,13 +12,13 @@ bugs: https://github.com/OleVik/grav-theme-scholar/issues
readme: https://github.com/OleVik/grav-theme-scholar/blob/develop/README.md
license: MIT
dependencies:
- { name: grav, version: ">=1.7" }
- { name: error, version: ">=1.6.2" }
- { name: swiper, version: ">=1.0.0" }
- { name: problems, version: ">=2.0.3" }
- { name: breadcrumbs, version: ">=1.5.1" }
- { name: shortcode-core, version: ">=4.1.7" }
- { name: static-generator, version: ">=1.0.0" }
- { name: grav, version: "~1.6.21" }
- { name: error }
- { name: swiper }
- { name: problems }
- { name: breadcrumbs }
- { name: shortcode-core }
- { name: static-generator, version: "~1.0.0" }

form:
validation: strict
Expand All @@ -30,24 +30,191 @@ form:
options:
type: tab
title: PLUGIN_ADMIN.OPTIONS
data-fields@:
[
'\Grav\Theme\Scholar::getConfigBlueprintFields',
"user://themes/scholar/blueprints/partials/basic.yaml",
]
fields:
enabled:
type: toggle
label: PLUGIN_ADMIN.PLUGIN_STATUS
options:
1: PLUGIN_ADMIN.ENABLED
0: PLUGIN_ADMIN.DISABLED
validate:
type: bool
style:
type: select
label: THEME_SCHOLAR.ADMIN.STYLE
description: THEME_SCHOLAR.ADMIN.DESCRIPTION.STYLE
data-options@: '\Grav\Theme\Scholar::getStylesBlueprint'
toolbar.breadcrumbs:
type: toggle
label: THEME_SCHOLAR.TOOLBAR.BREADCRUMBS
description: THEME_SCHOLAR.ADMIN.DESCRIPTION.TOOLBAR
options:
1: PLUGIN_ADMIN.ENABLED
0: PLUGIN_ADMIN.DISABLED
validate:
type: bool
toolbar.search:
type: toggle
label: THEME_SCHOLAR.TOOLBAR.SEARCH
description: THEME_SCHOLAR.ADMIN.DESCRIPTION.TOOLBAR
options:
1: PLUGIN_ADMIN.ENABLED
0: PLUGIN_ADMIN.DISABLED
validate:
type: bool
toolbar.navigation:
type: toggle
label: THEME_SCHOLAR.TOOLBAR.NAVIGATION
description: THEME_SCHOLAR.ADMIN.DESCRIPTION.TOOLBAR
options:
1: PLUGIN_ADMIN.ENABLED
0: PLUGIN_ADMIN.DISABLED
validate:
type: bool
css:
type: toggle
label: THEME_SCHOLAR.ADMIN.CSS
options:
1: PLUGIN_ADMIN.ENABLED
0: PLUGIN_ADMIN.DISABLED
validate:
type: bool
js:
type: toggle
label: THEME_SCHOLAR.ADMIN.JS
options:
1: PLUGIN_ADMIN.ENABLED
0: PLUGIN_ADMIN.DISABLED
validate:
type: bool
itemize:
type: toggle
label: THEME_SCHOLAR.ADMIN.ITEMIZE
description: THEME_SCHOLAR.ADMIN.DESCRIPTION.ITEMIZE
options:
1: PLUGIN_ADMIN.ENABLED
0: PLUGIN_ADMIN.DISABLED
validate:
type: bool
linked_data:
type: toggle
label: THEME_SCHOLAR.ADMIN.LINKED_DATA
description: THEME_SCHOLAR.ADMIN.DESCRIPTION.LINKED_DATA
options:
1: PLUGIN_ADMIN.ENABLED
0: PLUGIN_ADMIN.DISABLED
validate:
type: bool
highlighter:
type: toggle
label: THEME_SCHOLAR.ADMIN.HIGHLIGHTER
description: THEME_SCHOLAR.ADMIN.DESCRIPTION.HIGHLIGHTER
options:
1: PLUGIN_ADMIN.ENABLED
0: PLUGIN_ADMIN.DISABLED
validate:
type: bool
flexsearch.enabled:
type: toggle
label: THEME_SCHOLAR.ADMIN.FLEXSEARCH
description: THEME_SCHOLAR.ADMIN.DESCRIPTION.FLEXSEARCH
options:
1: PLUGIN_ADMIN.ENABLED
0: PLUGIN_ADMIN.DISABLED
validate:
type: bool
advanced:
type: tab
title: PLUGIN_ADMIN.ADVANCED
data-fields@:
[
'\Grav\Theme\Scholar::getConfigBlueprintFields',
"user://themes/scholar/blueprints/partials/advanced.yaml",
]
fields:
components:
type: selectize
label: THEME_SCHOLAR.ADMIN.COMPONENTS
description: THEME_SCHOLAR.ADMIN.DESCRIPTION.COMPONENTS
allowEmptyOption: true
merge_items: true
selectize:
create: false
data-options@: '\Grav\Theme\Scholar::getComponentsBlueprint'
validate:
type: commalist
router:
type: toggle
label: THEME_SCHOLAR.ADMIN.API.ROUTER
description: THEME_SCHOLAR.ADMIN.DESCRIPTION.ROUTER
options:
1: PLUGIN_ADMIN.ENABLED
0: PLUGIN_ADMIN.DISABLED
validate:
type: bool
highlighter_theme:
type: select
label: THEME_SCHOLAR.ADMIN.HIGHLIGHTER_THEME
data-options@: '\Grav\Theme\Scholar::getHighlighterThemeBlueprint'
routes.data:
type: text
label: THEME_SCHOLAR.ADMIN.ROUTES.DATA
description: THEME_SCHOLAR.ADMIN.DESCRIPTION.ROUTES.DATA
routes.embed:
type: text
label: THEME_SCHOLAR.ADMIN.ROUTES.EMBED
description: THEME_SCHOLAR.ADMIN.DESCRIPTION.ROUTES.EMBED
routes.search:
type: text
label: THEME_SCHOLAR.ADMIN.ROUTES.SEARCH
description: THEME_SCHOLAR.ADMIN.DESCRIPTION.ROUTES.SEARCH
routes.print:
type: text
label: THEME_SCHOLAR.ADMIN.ROUTES.PRINT
description: THEME_SCHOLAR.ADMIN.DESCRIPTION.ROUTES.PRINT
expert:
type: tab
title: PLUGIN_ADMIN.EXPERT
data-fields@:
[
'\Grav\Theme\Scholar::getConfigBlueprintFields',
"user://themes/scholar/blueprints/partials/expert.yaml",
]
fields:
notice:
type: spacer
title: THEME_SCHOLAR.ADMIN.NOTICE.TITLE
text: THEME_SCHOLAR.ADMIN.NOTICE.EXPERT
underline: true
api.content:
type: select
label: THEME_SCHOLAR.ADMIN.API.CONTENT
description: THEME_SCHOLAR.ADMIN.DESCRIPTION.API.CONTENT
data-options@:
- "\\Grav\\Theme\\Scholar::getClassNames"
- Content
api.linked_data.default:
type: select
label: THEME_SCHOLAR.ADMIN.API.LINKED_DATA.DEFAULT
description: THEME_SCHOLAR.ADMIN.DESCRIPTION.API.LINKED_DATA.DEFAULT
data-options@:
- "\\Grav\\Theme\\Scholar::getClassNames"
- LinkedData
api.linked_data.cv:
type: select
label: THEME_SCHOLAR.ADMIN.API.LINKED_DATA.CV
description: THEME_SCHOLAR.ADMIN.DESCRIPTION.API.LINKED_DATA.CV
data-options@:
- "\\Grav\\Theme\\Scholar::getClassNames"
- LinkedData
api.router:
type: select
label: THEME_SCHOLAR.ADMIN.API.ROUTER
description: THEME_SCHOLAR.ADMIN.DESCRIPTION.API.ROUTER
data-options@:
- "\\Grav\\Theme\\Scholar::getClassNames"
- Router
api.source:
type: select
label: THEME_SCHOLAR.ADMIN.API.SOURCE
description: THEME_SCHOLAR.ADMIN.DESCRIPTION.API.SOURCE
data-options@:
- "\\Grav\\Theme\\Scholar::getClassNames"
- Source
api.taxonomy_map:
type: select
label: THEME_SCHOLAR.ADMIN.API.TAXONOMY_MAP
description: THEME_SCHOLAR.ADMIN.DESCRIPTION.API.TAXONOMY_MAP
data-options@:
- "\\Grav\\Theme\\Scholar::getClassNames"
- TaxonomyMap
6 changes: 6 additions & 0 deletions classes/Utilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ public static function folderFinder(string $folder, array $locations): string
*/
public static function filesFinder(string $directory, array $types): array
{
if (!file_exists($directory)) {
return [];
}
$iterator = new \RecursiveDirectoryIterator(
$directory,
\RecursiveDirectoryIterator::SKIP_DOTS
Expand Down Expand Up @@ -109,6 +112,9 @@ public static function foldersFinder(array $locations): array
{
$return = array();
foreach ($locations as $location) {
if (!file_exists($location)) {
continue;
}
$folders = new \DirectoryIterator($location);
foreach ($folders as $folder) {
if ($folder->isDir() && !$folder->isDot()) {
Expand Down
4 changes: 4 additions & 0 deletions scholar.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ public function onThemeInitialized()
if ($this->config->get('themes.scholar.enabled') != true) {
return;
}
if ($this->config->get('system.pages.type') == "flex") {
return;
}
$this->autoload();
if ($this->config->get('system.debugger.enabled')) {
$this->grav['debugger']->startTimer('scholar', 'Scholar');
Expand Down Expand Up @@ -190,6 +193,7 @@ public static function getComponentsBlueprint(): array
*/
public static function getHighlighterThemeBlueprint(): array
{
include __DIR__ . '/vendor/autoload.php';
$stylesFolders = Utils::arrayMergeRecursiveUnique(
Utilities::filesFinder('theme://css/highlighter', ['css']),
Utilities::filesFinder('user://themes/scholar/css/highlighter', ['css'])
Expand Down
4 changes: 2 additions & 2 deletions templates/partials/header.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
{% block links %}
<nav class="links" role="navigation" aria-label="{{ "THEME_SCHOLAR.LINKS"|t }}" aria-checked="false">
<div>
{% for page in page.collection({ items: {'@root.children': ''}}) if not page.home() and page.header.menu %}
<a href="{{ page.url }}">{{ page.header.menu }}</a>
{% for page in page.collection({ items: {'@root.children': ''}}) if not page.home() %}
<a href="{{ page.url }}">{{ page.header.menu ?? page.title }}</a>
{% endfor %}
</div>
</nav>
Expand Down

0 comments on commit b564e69

Please sign in to comment.