Moved devtools out of core into a plugin

This commit is contained in:
Andy Miller
2016-04-19 10:34:29 -06:00
parent 99f8ee2c81
commit 672b37359a
39 changed files with 0 additions and 1063 deletions

View File

@@ -41,8 +41,5 @@ $app->addCommands(array(
new \Grav\Console\Cli\ClearCacheCommand(),
new \Grav\Console\Cli\BackupCommand(),
new \Grav\Console\Cli\NewProjectCommand(),
new \Grav\Console\Cli\NewUserCommand(),
new \Grav\Console\Cli\DevTools\NewPluginCommand(),
new \Grav\Console\Cli\DevTools\NewThemeCommand(),
));
$app->run();

View File

@@ -1,192 +0,0 @@
<?php
namespace Grav\Console\Cli\DevTools;
use Grav\Common\Grav;
use Grav\Common\Data;
use Grav\Common\Filesystem\Folder;
use Grav\Common\GPM\GPM;
use Grav\Common\Inflector;
use Grav\Common\Twig\Twig;
use Grav\Common\Utils;
use RocketTheme\Toolbox\File\File;
use Grav\Console\ConsoleCommand;
/**
* Class DevToolsCommand
* @package Grav\Console\Cli\
*/
class DevToolsCommand extends ConsoleCommand
{
/**
* @var array
*/
protected $component = [];
/**
* @var Grav
*/
protected $grav;
/**
* @var Inflector
*/
protected $inflector;
/**
* @var Locator
*/
protected $locator;
/**
* @var Twig
*/
protected $twig;
protected $data;
/**
* @var gpm
*/
protected $gpm;
/**
* Initializes the basic requirements for the developer tools
*/
protected function init()
{
$autoload = require_once GRAV_ROOT . '/vendor/autoload.php';
if (!function_exists('curl_version')) {
exit('FATAL: DEVTOOLS requires PHP Curl module to be installed');
}
$this->grav = Grav::instance(array('loader' => $autoload));
$this->grav['config']->init();
$this->grav['uri']->init();
$this->grav['streams'];
$this->inflector = $this->grav['inflector'];
$this->locator = $this->grav['locator'];
$this->twig = new Twig($this->grav);
$this->gpm = new GPM(true);
//Add `theme://` to prevent fail
$this->locator->addPath('theme', '', []);
}
/**
* Copies the component type and renames accordingly
*/
protected function createComponent()
{
$name = $this->component['name'];
$folderName = strtolower($this->inflector->hyphenize($name));
$type = $this->component['type'];
$template = $this->component['template'];
$templateFolder = __DIR__ . '/components/' . $type . DS . $template;
$componentFolder = $this->locator->findResource($type . 's://') . DS . $folderName;
//Copy All files to component folder
try {
Folder::copy($templateFolder, $componentFolder);
} catch (\Exception $e) {
$this->output->writeln("<red>" . $e->getMessage() . "</red>");
return false;
}
//Add Twig vars and templates then initialize
$this->twig->twig_vars['component'] = $this->component;
$this->twig->twig_paths[] = $templateFolder;
$this->twig->init();
//Get all templates of component then process each with twig and save
$templates = Folder::all($componentFolder);
try {
foreach($templates as $templateFile) {
if (Utils::endsWith($templateFile, '.twig') && !Utils::endsWith($templateFile, '.html.twig')) {
$content = $this->twig->processTemplate($templateFile);
$file = File::instance($componentFolder . DS . str_replace('.twig', '', $templateFile));
$file->content($content);
$file->save();
//Delete twig template
$file = File::instance($componentFolder . DS . $templateFile);
$file->delete();
}
}
} catch (\Exception $e) {
$this->output->writeln("<red>" . $e->getMessage() . "</red>");
$this->output->writeln("Rolling back...");
Folder::delete($componentFolder);
$this->output->writeln($type . "creation failed!");
return false;
}
rename($componentFolder . DS . $type . '.php', $componentFolder . DS . $this->inflector->hyphenize($name) . '.php');
rename($componentFolder . DS . $type . '.yaml', $componentFolder . DS . $this->inflector->hyphenize($name) . '.yaml');
$this->output->writeln('');
$this->output->writeln('<green>SUCCESS</green> ' . $type . ' <magenta>' . $name . '</magenta> -> Created Successfully');
$this->output->writeln('');
$this->output->writeln('Path: <cyan>' . $componentFolder . '</cyan>');
$this->output->writeln('');
}
/**
* Iterate through all options and validate
*/
protected function validateOptions()
{
foreach (array_filter($this->options) as $type => $value) {
$this->validate($type, $value);
}
}
/**
* @param $type
* @param $value
* @param string $extra
*
* @return mixed
*/
protected function validate($type, $value, $extra = '')
{
switch ($type) {
case 'name':
//Check If name
if ($value == null || trim($value) == '') {
throw new \RuntimeException('Name cannot be empty');
}
if (false != $this->gpm->findPackage($value)) {
throw new \RuntimeException('Package name exists in GPM');
}
break;
case 'description':
if($value == null || trim($value) == '') {
throw new \RuntimeException('Description cannot be empty');
}
break;
case 'developer':
if ($value === null || trim($value) == '') {
throw new \RuntimeException('Developer\'s Name cannot be empty');
}
break;
case 'email':
if (!preg_match('/^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/', $value)) {
throw new \RuntimeException('Not a valid email address');
}
break;
}
return $value;
}
}

View File

@@ -1,129 +0,0 @@
<?php
namespace Grav\Console\Cli\DevTools;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Helper\Helper;
use Symfony\Component\Console\Question\ChoiceQuestion;
use Symfony\Component\Console\Question\Question;
/**
* Class NewPluginCommand
* @package Grav\Console\Cli\DevTools
*/
class NewPluginCommand extends DevToolsCommand
{
/**
* @var array
*/
protected $options = [];
/**
*
*/
protected function configure()
{
$this
->setName('new-plugin')
->setAliases(['newplugin'])
->addOption(
'name',
'pn',
InputOption::VALUE_OPTIONAL,
'The name of your new Grav plugin'
)
->addOption(
'description',
'd',
InputOption::VALUE_OPTIONAL,
'A description of your new Grav plugin'
)
->addOption(
'developer',
'dv',
InputOption::VALUE_OPTIONAL,
'The name/username of the developer'
)
->addOption(
'email',
'e',
InputOption::VALUE_OPTIONAL,
'The developer\'s email'
)
->setDescription('Creates a new Grav plugin with the basic required files')
->setHelp('The <info>new-plugin</info> command creates a new Grav instance and performs the creation of a plugin.');
}
/**
* @return int|null|void
*/
protected function serve()
{
$this->init();
/**
* @var array DevToolsCommand $component
*/
$this->component['type'] = 'plugin';
$this->component['template'] = 'blank';
$this->component['version'] = '0.1.0'; // @todo add optional non prompting version argument
$this->options = [
'name' => $this->input->getOption('name'),
'description' => $this->input->getOption('description'),
'author' => [
'name' => $this->input->getOption('developer'),
'email' => $this->input->getOption('email')
]
];
$this->validateOptions();
$this->component = array_replace($this->component, $this->options);
$helper = $this->getHelper('question');
if (!$this->options['name']) {
$question = new Question('Enter <yellow>Plugin Name</yellow>: ');
$question->setValidator(function ($value) {
return $this->validate('name', $value);
});
$this->component['name'] = $helper->ask($this->input, $this->output, $question);
}
if (!$this->options['description']) {
$question = new Question('Enter <yellow>Plugin Description</yellow>: ');
$question->setValidator(function ($value) {
return $this->validate('description', $value);
});
$this->component['description'] = $helper->ask($this->input, $this->output, $question);
}
if (!$this->options['author']['name']) {
$question = new Question('Enter <yellow>Developer Name</yellow>: ');
$question->setValidator(function ($value) {
return $this->validate('developer', $value);
});
$this->component['author']['name'] = $helper->ask($this->input, $this->output, $question);
}
if (!$this->options['author']['email']) {
$question = new Question('Enter <yellow>Developer Email</yellow>: ');
$question->setValidator(function ($value) {
return $this->validate('email', $value);
});
$this->component['author']['email'] = $helper->ask($this->input, $this->output, $question);
}
$this->component['template'] = 'blank';
$this->createComponent();
}
}

View File

@@ -1,145 +0,0 @@
<?php
namespace Grav\Console\Cli\DevTools;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Helper\Helper;
use Symfony\Component\Console\Question\ChoiceQuestion;
use Symfony\Component\Console\Question\Question;
/**
* Class NewThemeCommand
* @package Grav\Console\Cli\DevTools
*/
class NewThemeCommand extends DevToolsCommand
{
/**
* @var array
*/
protected $options = [];
/**
*
*/
protected function configure()
{
$this
->setName('new-theme')
->setAliases(['newtheme'])
->addOption(
'name',
'pn',
InputOption::VALUE_OPTIONAL,
'The name of your new Grav theme'
)
->addOption(
'description',
'd',
InputOption::VALUE_OPTIONAL,
'A description of your new Grav theme'
)
->addOption(
'developer',
'dv',
InputOption::VALUE_OPTIONAL,
'The name/username of the developer'
)
->addOption(
'email',
'e',
InputOption::VALUE_OPTIONAL,
'The developer\'s email'
)
->setDescription('Creates a new Grav theme with the basic required files')
->setHelp('The <info>new-theme</info> command creates a new Grav instance and performs the creation of a theme.');
}
/**
* @return int|null|void
*/
protected function serve()
{
$this->init();
/**
* @var array DevToolsCommand $component
*/
$this->component['type'] = 'theme';
$this->component['template'] = 'blank';
$this->component['version'] = '0.1.0'; // @todo add optional non prompting version argument
$this->options = [
'name' => $this->input->getOption('name'),
'description' => $this->input->getOption('description'),
'author' => [
'name' => $this->input->getOption('developer'),
'email' => $this->input->getOption('email')
]
];
$this->validateOptions();
$this->component = array_replace($this->component, $this->options);
$helper = $this->getHelper('question');
if (!$this->options['name']) {
$question = new Question('Enter <yellow>Theme Name</yellow>: ');
$question->setValidator(function ($value) {
return $this->validate('name', $value);
});
$this->component['name'] = $helper->ask($this->input, $this->output, $question);
}
if (!$this->options['description']) {
$question = new Question('Enter <yellow>Theme Description</yellow>: ');
$question->setValidator(function ($value) {
return $this->validate('description', $value);
});
$this->component['description'] = $helper->ask($this->input, $this->output, $question);
}
if (!$this->options['author']['name']) {
$question = new Question('Enter <yellow>Developer Name</yellow>: ');
$question->setValidator(function ($value) {
return $this->validate('developer', $value);
});
$this->component['author']['name'] = $helper->ask($this->input, $this->output, $question);
}
if (!$this->options['author']['email']) {
$question = new Question('Enter <yellow>Developer Email</yellow>: ');
$question->setValidator(function ($value) {
return $this->validate('email', $value);
});
$this->component['author']['email'] = $helper->ask($this->input, $this->output, $question);
}
$question = new ChoiceQuestion(
'Please choose a template type',
array('pure-blank', 'inheritence')
);
$this->component['template'] = $helper->ask($this->input, $this->output, $question);
if ($this->component['template'] == 'inheritence') {
$themes = $this->gpm->getInstalledThemes();
$installedThemes = [];
foreach($themes as $key => $theme) {
array_push($installedThemes, $key);
}
$question = new ChoiceQuestion(
'Please choose a theme to extend: ',
$installedThemes
);
$this->component['extends'] = $helper->ask($this->input, $this->output, $question);
}
$this->createComponent();
}
}

View File

@@ -1,5 +0,0 @@
# v0.1.0
## {{ "now"|date("m/d/Y") }}
1. [](#new)
* ChangeLog started...

View File

@@ -1,21 +0,0 @@
The MIT License (MIT)
Copyright (c) {{ "now"|date("Y") }} {{ component.author.name }}
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,7 +0,0 @@
# {{ component.name|titleize }} Plugin
The **{{ component.name|titleize }}** Plugin is for [Grav CMS](http://github.com/getgrav/grav). This README.md file should be modified to describe the features, installation, configuration, and general usage of this plugin.
## Description
{{ component.description }}

View File

@@ -1,31 +0,0 @@
name: {{ component.name|titleize }}
version: 0.1.0
description: {{ component.description }}
icon: plug
author:
name: {{ component.author.name }}
email: {{ component.author.email }}
homepage: https://github.com/{{ component.author.name|hyphenize }}/grav-plugin-{{ component.name|hyphenize }}
demo: http://demo.yoursite.com
keywords: grav, plugin, etc
bugs: https://github.com/{{ component.author.name|hyphenize }}/grav-plugin-{{ component.name|hyphenize }}/issues
readme: https://github.com/{{ component.author.name|hyphenize }}/grav-plugin-{{ component.name|hyphenize }}/blob/develop/README.md
license: MIT
form:
validation: strict
fields:
enabled:
type: toggle
label: Plugin status
highlight: 1
default: 0
options:
1: Enabled
0: Disabled
validate:
type: bool
text_var:
type: text
label: Text Variable
help: Text to add to the top of a page

View File

@@ -1,63 +0,0 @@
<?php
namespace Grav\Plugin;
use Grav\Common\Plugin;
use RocketTheme\Toolbox\Event\Event;
/**
* Class {{ component.name|camelize }}Plugin
* @package Grav\Plugin
*/
class {{ component.name|camelize }}Plugin extends Plugin
{
/**
* @return array
*
* The getSubscribedEvents() gives the core a list of events
* that the plugin wants to listen to. The key of each
* array section is the event that the plugin listens to
* and the value (in the form of an array) contains the
* callable (or function) as well as the priority. The
* higher the number the higher the priority.
*/
public static function getSubscribedEvents()
{
return [
'onPluginsInitialized' => ['onPluginsInitialized', 0]
];
}
/**
* Initialize the plugin
*/
public function onPluginsInitialized()
{
// Don't proceed if we are in the admin plugin
if ($this->isAdmin()) {
return;
}
// Enable the main event we are interested in
$this->enable([
'onPageContentRaw' => ['onPageContentRaw', 0]
]);
}
/**
* Do some work for this event, full details of events can be found
* on the learn site: http://learn.getgrav.org/plugins/event-hooks
*
* @param Event $e
*/
public function onPageContentRaw(Event $e)
{
// Get a variable from the plugin configuration
$text = $this->grav['config']->get('plugins.{{ component.name|hyphenize }}.text_var');
// Get the current raw content
$content = $e['page']->getRawContent();
// Prepend the output with the custom text and set back on the page
$e['page']->setRawContent($text . "\n\n" . $content);
}
}

View File

@@ -1,2 +0,0 @@
enabled: true
text_var: Custom Text added by the **{{ component.name|titleize }}** plugin (disable plugin to remove)

View File

@@ -1,5 +0,0 @@
# v0.1.0
## {{ "now"|date("m/d/Y") }}
1. [](#new)
* ChangeLog started...

View File

@@ -1,21 +0,0 @@
The MIT License (MIT)
Copyright (c) {{ "now"|date("Y") }} {{ component.author.name }}
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,7 +0,0 @@
# {{ component.name|titleize }} Plugin
The **{{ component.name|titleize }}** Theme is for [Grav CMS](http://github.com/getgrav/grav). This README.md file should be modified to describe the features, installation, configuration, and general usage of this theme.
## Description
{{ component.description }}

View File

@@ -1,13 +0,0 @@
name: {{ component.name|titleize }}
version: 0.1.0
description: {{ component.description }}
icon: rebel
author:
name: {{ component.author.name }}
email: {{ component.author.email }}
homepage: https://github.com/{{ component.author.name|hyphenize }}/grav-theme-{{ component.name|hyphenize }}
demo: http://demo.yoursite.com
keywords: grav, theme, etc
bugs: https://github.com/{{ component.author.name|hyphenize }}/grav-theme-{{ component.name|hyphenize }}/issues
readme: https://github.com/{{ component.author.name|hyphenize }}/grav-theme-{{ component.name|hyphenize }}/blob/develop/README.md
license: MIT

Binary file not shown.

Before

Width:  |  Height:  |  Size: 370 KiB

View File

@@ -1,9 +0,0 @@
<?php
namespace Grav\Theme;
use Grav\Common\Theme;
class {{ component.name|camelize }}Theme extends Theme
{
// Access plugin events in this class
}

View File

@@ -1,8 +0,0 @@
streams:
schemes:
theme:
type: ReadOnlyStream
prefixes:
'':
- user/themes/{{ component.name|hyphenize }}
- user/themes/{{ component.extends }}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 332 KiB

View File

@@ -1,5 +0,0 @@
# v0.1.0
## {{ "now"|date("m/d/Y") }}
1. [](#new)
* ChangeLog started...

View File

@@ -1,21 +0,0 @@
The MIT License (MIT)
Copyright (c) {{ "now"|date("Y") }} {{ component.author.name }}
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,7 +0,0 @@
# {{ component.name|titleize }} Theme
The **{{ component.name|titleize }}** Theme is for [Grav CMS](http://github.com/getgrav/grav). This README.md file should be modified to describe the features, installation, configuration, and general usage of this theme.
## Description
{{ component.description }}

View File

@@ -1,27 +0,0 @@
name: {{ component.name|titleize }}
version: 0.1.0
description: {{ component.description }}
icon: rebel
author:
name: {{ component.author.name }}
email: {{ component.author.email }}
homepage: https://github.com/{{ component.author.name|hyphenize }}/grav-theme-{{ component.name|hyphenize }}
demo: http://demo.yoursite.com
keywords: grav, theme, etc
bugs: https://github.com/{{ component.author.name|hyphenize }}/grav-theme-{{ component.name|hyphenize }}/issues
readme: https://github.com/{{ component.author.name|hyphenize }}/grav-theme-{{ component.name|hyphenize }}/blob/develop/README.md
license: MIT
form:
validation: loose
fields:
dropdown.enabled:
type: toggle
label: Dropdown in Menu
highlight: 1
default: 1
options:
1: PLUGIN_ADMIN.ENABLED
0: PLUGIN_ADMIN.DISABLED
validate:
type: bool

View File

@@ -1,175 +0,0 @@
/* Core Stuff */
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
body {
font-size: 1rem;
line-height: 1.7;
color: #606d6e;
}
h1,
h2,
h3,
h4,
h5,
h6 {
color: #454B4D;
}
a {
color: #1F8CD6;
text-decoration: none;
}
a:hover {
color: #175E91;
}
pre {
background: #F0F0F0;
margin: 1rem 0;
border-radius: 2px;
}
blockquote {
border-left: 10px solid #eee;
margin: 0;
padding: 0 2rem;
}
/* Utility Classes */
.wrapper {
margin: 0 3rem;
}
.padding {
padding: 3rem 1rem;
}
.left {
float: left;
}
.right {
float: right
}
.text-center {
text-align: center;
}
.text-right {
text-align: right;
}
.text-left {
text-align: left;
}
/* Content Styling */
.header .padding {
padding: 1rem 0;
}
.header {
background-color: #1F8DD6;
color: #eee;
}
.header a {
color: #fff;
}
.header .logo {
font-size: 1.7rem;
text-transform: uppercase;
}
.footer {
background-color: #eee;
}
/* Menu Settings */
.main-nav ul {
text-align: center;
letter-spacing: -1em;
margin: 0;
padding: 0;
}
.main-nav ul li {
display: inline-block;
letter-spacing: normal;
}
.main-nav ul li a {
position: relative;
display: block;
line-height: 45px;
color: #fff;
padding: 0 20px;
white-space: nowrap;
}
.main-nav > ul > li > a {
border-radius: 2px;
}
/*Active dropdown nav item */
.main-nav ul li:hover > a {
background-color: #175E91;
}
/* Selected Dropdown nav item */
.main-nav ul li.selected > a {
background-color: #fff;
color: #175E91;
}
/* Dropdown CSS */
.main-nav ul li {position: relative;}
.main-nav ul li ul {
position: absolute;
background-color: #1F8DD6;
min-width: 100%;
text-align: left;
z-index: 999;
display: none;
}
.main-nav ul li ul li {
display: block;
}
/* Dropdown CSS */
.main-nav ul li ul ul {
left: 100%;
top: 0;
}
/* Active on Hover */
.main-nav li:hover > ul {
display: block;
}
/* Child Indicator */
.main-nav .has-children > a {
padding-right: 30px;
}
.main-nav .has-children > a:after {
font-family: FontAwesome;
content: '\f107';
position: absolute;
display: inline-block;
right: 8px;
top: 0;
}
.main-nav .has-children .has-children > a:after {
content: '\f105';
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 370 KiB

View File

@@ -1,5 +0,0 @@
{% extends 'partials/base.html.twig' %}
{% block content %}
{{ page.content }}
{% endblock %}

View File

@@ -1,8 +0,0 @@
{% extends 'partials/base.html.twig' %}
{% block content %}
<div class="lead text-center">
<h1>Errror!</h1>
{{ page.content }}
</div>
{% endblock %}

View File

@@ -1,68 +0,0 @@
{% set theme_config = attribute(config.themes, config.system.pages.theme) %}
<!DOCTYPE html>
<html lang="{{ grav.language.getActive ?: theme_config.default_lang }}">
<head>
{% block head %}
<meta charset="utf-8" />
<title>{% if header.title %}{{ header.title|e('html') }} | {% endif %}{{ site.title|e('html') }}</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
{% include 'partials/metadata.html.twig' %}
<link rel="icon" type="image/png" href="{{ url('theme://images/logo.png') }}" />
<link rel="canonical" href="{{ page.url(true, true) }}" />
{% block stylesheets %}
{% do assets.addCss('http://yui.yahooapis.com/pure/0.6.0/pure-min.css', 100) %}
{% do assets.addCss('https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css', 99) %}
{% do assets.addCss('theme://css/custom.css', 98) %}
{% endblock %}
{{ assets.css() }}
{% block javascripts %}
{% do assets.addJs('jquery', 100) %}
{% endblock %}
{{ assets.js() }}
{% endblock head%}
</head>
<body id="top" class="{{ page.header.body_classes }}">
{% block header %}
<div class="header">
<div class="wrapper padding">
<a class="logo left" href="{{ base_url == '' ? '/' : base_url }}">
<i class="fa fa-rebel"></i>
{{ config.site.title }}
</a>
{% block header_navigation %}
<nav class="main-nav">
{% include 'partials/navigation.html.twig' %}
</nav>
{% endblock %}
</div>
</div>
{% endblock %}
{% block body %}
<section id="body">
<div class="wrapper padding">
{% block content %}{% endblock %}
</div>
</section>
{% endblock %}
{% block footer %}
<div class="footer text-center">
<div class="wrapper padding">
<p><a href="http://getgrav.org">Grav</a> was <i class="fa fa-code"></i> with <i class="fa fa-heart"></i> by <a href="http://www.rockettheme.com">RocketTheme</a>.</p>
</div>
</div>
{% endblock %}
{% block bottom %}
{{ assets.js('bottom') }}
{% endblock %}
</body>

View File

@@ -1,23 +0,0 @@
<nav class="navbar navbar-default navbar-inverse navbar-static-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Grav</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
{% for page in pages.children %}
{% if page.visible %}
{% set current_page = (page.active or page.activeChild) ? 'active' : '' %}
<li class="{{ current_page }}"><a href="{{ page.url }}">{{ page.menu }}</a></li>
{% endif %}
{% endfor %}
</ul>
</div>
</div>
</nav>

View File

@@ -1,3 +0,0 @@
{% for meta in page.metadata %}
<meta {% if meta.name %}name="{{ meta.name }}" {% endif %}{% if meta.http_equiv %}http-equiv="{{ meta.http_equiv }}" {% endif %}{% if meta.charset %}charset="{{ meta.charset }}" {% endif %}{% if meta.property %}property="{{ meta.property }}" {% endif %}{% if meta.content %}content="{{ meta.content }}" {% endif %}/>
{% endfor %}

View File

@@ -1,48 +0,0 @@
{% macro loop(page) %}
{% for p in page.children.visible %}
{% set current_page = (p.active or p.activeChild) ? 'selected' : '' %}
{% if p.children.visible.count > 0 %}
<li class="has-children {{ current_page }}">
<a href="{{ p.url }}">
{% if p.header.icon %}<i class="fa fa-{{ p.header.icon }}"></i>{% endif %}
{{ p.menu }}
</a>
<ul>
{{ _self.loop(p) }}
</ul>
</li>
{% else %}
<li class="{{ current_page }}">
<a href="{{ p.url }}">
{% if p.header.icon %}<i class="fa fa-{{ p.header.icon }}"></i>{% endif %}
{{ p.menu }}
</a>
</li>
{% endif %}
{% endfor %}
{% endmacro %}
<ul>
{% if theme_config.dropdown.enabled %}
{{ _self.loop(pages) }}
{% else %}
{% for page in pages.children.visible %}
{% set current_page = (page.active or page.activeChild) ? 'selected' : '' %}
<li class="{{ current_page }}">
<a href="{{ page.url }}">
{% if page.header.icon %}<i class="fa fa-{{ page.header.icon }}"></i>{% endif %}
{{ page.menu }}
</a>
</li>
{% endfor %}
{% endif %}
{% for mitem in site.menu %}
<li>
<a href="{{ mitem.url }}">
{% if mitem.icon %}<i class="fa fa-{{ mitem.icon }}"></i>{% endif %}
{{ mitem.text }}
</a>
</li>
{% endfor %}
</ul>

View File

@@ -1,9 +0,0 @@
<?php
namespace Grav\Theme;
use Grav\Common\Theme;
class {{ component.name|camelize }}Theme extends Theme
{
// Access plugin events in this class
}

View File

@@ -1,3 +0,0 @@
enabled: true
dropdown:
enabled: true

Binary file not shown.

Before

Width:  |  Height:  |  Size: 332 KiB