Grav updates

This commit is contained in:
Matias Griese
2015-04-18 11:29:50 +03:00
parent 2328c189d0
commit 14132e62bb
58 changed files with 87 additions and 78 deletions
+19 -16
View File
@@ -87,29 +87,32 @@ elif [ -f $GIT_TARGET/wp-config.php ]; then
)
elif [ -f $GIT_TARGET/system/config/system.yaml ]; then
PLATFORM=Grav
mkdir "$GIT_TARGET/user/gantry5"
sources=(
'platforms/grav/gantryadmin'
# Admin plugin
'platforms/grav/gantry5'
'platforms/common'
# Libraries
'src'
'vendor'
'themes/gantry/grav'
'themes/gantry/common'
'src'
'vendor'
# Assets
'assets'
'engines'
# Themes
'themes/hydrogen/grav'
'themes/hydrogen/common'
)
targets=(
'user/plugins/gantryadmin'
'user/plugins/gantryadmin/common'
'user/plugins/gantryadmin/src'
'user/plugins/gantryadmin/vendor'
# Admin plugin
'user/plugins/gantry5'
'user/plugins/gantry5/common'
# Libraries
'user/plugins/gantry5/src'
# Assets
'user/gantry5/assets'
'user/gantry5/engines'
# Themes
'user/themes/hydrogen'
'user/themes/hydrogen/common'
'user/themes/hydrogen/src'
'user/themes/hydrogen/vendor'
'user/themes/hydrogen-demo'
'user/themes/hydrogen-demo/common'
'user/themes/hydrogen-demo/src'
'user/themes/hydrogen-demo/vendor'
)
elif [ -f $GIT_TARGET/mage ]; then
PLATFORM=Magento
View File
+4
View File
@@ -0,0 +1,4 @@
grav-plugin-gantry5
===================
Gantry 5 Plugin
+1
View File
@@ -0,0 +1 @@
5.0.0-beta.2
@@ -1,6 +1,6 @@
name: Gantry Template Administration
name: Gantry 5 Template Framework
version: 1.0.0
description: Enables Gantry template administration.
description: Allows Gantry 5 templates to run.
validation: strict
form:
@@ -1,6 +1,7 @@
<?php
namespace Grav\Plugin;
use Composer\Autoload\ClassLoader;
use Gantry\Framework\Base\ThemeTrait;
use Grav\Common\Page\Page;
use Grav\Common\Plugin;
@@ -8,7 +9,7 @@ use Grav\Common\Themes;
use Grav\Common\Twig;
use RocketTheme\Toolbox\ResourceLocator\UniformResourceLocator;
class GantryAdminPlugin extends Plugin
class Gantry5Plugin extends Plugin
{
protected $base;
protected $template;
@@ -19,10 +20,20 @@ class GantryAdminPlugin extends Plugin
public static function getSubscribedEvents()
{
return [
'onPluginsInitialized' => ['detectAdmin', 900]
'onPluginsInitialized' => [
['initialize', 1000],
['detectAdmin', 900]
]
];
}
public function initialize()
{
/** @var ClassLoader $loader */
$loader = $this->grav['loader'];
$loader->addClassMap(['Gantry5\\Loader' => __DIR__ . '/src/Loader.php']);
}
/**
* Initialize administration plugin if admin path matches.
*
@@ -43,18 +54,18 @@ class GantryAdminPlugin extends Plugin
$base = rtrim($this->grav['base_url'], '/');
$results = explode('/', $admin->route, 3);
$theme = array_shift($results);
$this->template = array_shift($results) ?: 'overview';
$this->template = array_shift($results) ?: 'about';
$this->route = array_shift($results);
$this->base = "{$base}{$admin->base}/{$admin->location}/{$theme}";
$this->config->set('system.pages.theme', $theme);
$this->enable([
'onThemeInitialized' => ['detectTheme', 0],
'onThemeInitialized' => ['runAdmin', 0],
]);
}
public function detectTheme()
public function runAdmin()
{
$theme = $this->grav['theme'];
if (!($theme instanceof \Gantry\Framework\Theme)) {
@@ -65,13 +76,7 @@ class GantryAdminPlugin extends Plugin
$gantry['base_url'] = $this->base;
$gantry['routes'] = [
'1' => '/%s',
'overview' => '',
'settings' => '/settings',
'pages' => '/pages_index',
'pages/edit' => '/pages_edit',
'pages/create' => '/pages_create',
'assignments' => '/assignments',
'updates' => '/updates',
'about' => ''
];
$this->grav['gantry'] = $gantry;
@@ -81,7 +86,6 @@ class GantryAdminPlugin extends Plugin
'onTwigInitialized' => ['onTwigInitialized', 900],
'onTwigSiteVariables' => ['onTwigSiteVariables', 900]
]);
}
/**
@@ -91,7 +95,7 @@ class GantryAdminPlugin extends Plugin
{
// Create admin page.
$page = new Page;
$page->init(new \SplFileInfo(__DIR__ . "/pages/gantry.md"));
$page->init(new \SplFileInfo(__DIR__ . "/pages/gantry5.md"));
$page->slug($this->template);
$this->grav['page'] = $page;
}
@@ -107,8 +111,8 @@ class GantryAdminPlugin extends Plugin
/** @var UniformResourceLocator $locator */
$locator = $this->grav['locator'];
$locator->addPath('gantry-admin', '', ['user/plugins/gantryadmin', 'user/plugins/gantryadmin/common']);
$locator->addPath('gantry-admin', 'assets', ['user/plugins/gantryadmin/common']);
$locator->addPath('gantry-admin', '', ['user/plugins/gantry5', 'user/plugins/gantry5/common']);
$locator->addPath('gantry-admin', 'assets', ['user/plugins/gantry5/common']);
$loader = $twig->loader();
$loader->setPaths($locator->findResources('gantry-admin://templates'), 'gantry-admin');
@@ -122,7 +126,7 @@ class GantryAdminPlugin extends Plugin
/** @var Twig $twig */
$twig = $this->grav['twig'];
$twig->template = "@gantry-admin/{$this->template}.html.twig";
$twig->template = "@gantry-admin/pages/{$this->template}.html.twig";
$twig->twig_vars['location'] = $this->template;
$twig->twig_vars['gantry_url'] = $this->base;
+2
View File
@@ -0,0 +1,2 @@
enabled: true
route: '/admin/gantry5'
@@ -1,12 +1,12 @@
{
"project":"grav-plugin-gantryadmin",
"project":"grav-plugin-gantry5",
"platforms":{
"grav":{
"nodes":{
"plugin":[
{
"source":"/",
"destination":"/user/plugins/gantryadmin"
"destination":"/user/plugins/gantry5"
}
]
}
@@ -1,5 +1,5 @@
---
title: Gantry Admin
title: Gantry Templates
access:
admin.themes: true
-4
View File
@@ -1,4 +0,0 @@
grav-plugin-gantryadmin
=======================
Gantry Admin Plugin
-1
View File
@@ -1 +0,0 @@
1.0.0
@@ -1,2 +0,0 @@
enabled: true
route: '/admin/gantry'
@@ -136,8 +136,15 @@ abstract class Platform
return [];
}
abstract public function settings();
abstract public function settings_key();
public function settings()
{
return null;
}
public function settings_key()
{
return $this->settings_key;
}
public function listModules()
{
+20 -1
View File
@@ -65,6 +65,25 @@ class Platform extends BasePlatform
public function getMediaPaths()
{
return ['' => ['user://']];
return ['' => ['user://gantry5']];
}
public function getEnginesPaths()
{
if (is_link('user://gantry5/engines')) {
// Development environment.
return ['' => ["user://gantry5/engines/{$this->name}", 'user://gantry5/engines/common']];
}
return ['' => ['user://gantry5/engines']];
}
public function getAssetsPaths()
{
if (is_link('user://gantry5/assets')) {
// Development environment.
return ['' => ['gantry-theme://', "user://gantry5/assets/{$this->name}", 'user://gantry5/assets/common']];
}
return ['' => ['gantry-theme://', 'user://gantry5/assets']];
}
}
@@ -175,11 +175,6 @@ class Platform extends BasePlatform
return \JRoute::_('index.php?option=com_config&view=component&component=com_gantry5', false);
}
public function settings_key()
{
return $this->settings_key;
}
public function update()
{
return \JRoute::_('index.php?option=com_installer&view=update', false);
+1 -1
View File
@@ -1,5 +1,5 @@
name: Hydrogen
version: 1.0
version: "5.0.0-beta.2"
author: RocketTheme
url: http://www.rockettheme.com
email: support@rockettheme.com
+5 -9
View File
@@ -4,17 +4,13 @@ namespace Gantry\Framework;
/** @var $locator */
/** @var $path */
// Attempt to locate Gantry Framework if it hasn't already been loaded.
if (!class_exists('Gantry')) {
$bootstrap = $locator('theme://src/bootstrap.php');
if (!$bootstrap) {
throw new \LogicException('Gantry Framework not found!');
}
// Load Gantry Framework.
require_once $bootstrap;
if (!class_exists('\Gantry5\Loader')) {
throw new \LogicException('Please install Gantry 5 Framework plugin!');
}
// Setup Gantry 5 Framework or throw exception.
\Gantry5\Loader::setup();
// Get Gantry instance.
$gantry = Gantry::instance();
-15
View File
@@ -1,15 +0,0 @@
#!/bin/bash
SASS_PATH=../common/scss:../../../engines/nucleus/scss
#====================================================================
if [ ! -d scss ]; then
mkdir scss
fi
if [ ! -d css-compiled ]; then
mkdir css-compiled
fi
export SASS_PATH
scss --sourcemap=auto --unix-newlines --watch scss:css-compiled