diff --git a/.gitignore b/.gitignore index 0e924e6..8650859 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,4 @@ tests/_output/* composer.lock -tests/_output/* \ No newline at end of file +tests/_output/* diff --git a/composer.json b/composer.json index 7b9ed81..215435b 100644 --- a/composer.json +++ b/composer.json @@ -15,8 +15,11 @@ "Sites\\All\\": "src" } }, + "provide": { + "akademiano/site-all-implementation": "1.0.0" + }, "require": { - "akademiano/application": "^1.0.0-beta.2" + "akademiano/core": "^1.0.0-beta.4" }, "require-dev": { "codeception/codeception": "^2.2.10", @@ -24,7 +27,7 @@ "satooshi/php-coveralls": "^1.0", "mockery/mockery": "^0.9.9" }, - "config": { + "config": { "fxp-asset": { "installer-paths": { "npm-asset-library": "public/assets/vendor", diff --git a/public/index.php b/public/index.php new file mode 100644 index 0000000..8cda1fe --- /dev/null +++ b/public/index.php @@ -0,0 +1,67 @@ +setLoader($loader); + +$app->getDiContainer()->extend('baseConfigLoader', function (\Akademiano\Config\ConfigLoader $configLoader, \Pimple\Container $pimple) { + $configLoader->addConfigDir(ROOT_DIR . "/src/config"); + return $configLoader; +}); + +/*$app->getDiContainer()["baseConfig"] = new \Akademiano\Config\Config( + [ + 'view' => [ + 'adapter' => 'twig', + 'options' => [ + 'cache' => false, + "debug" => true, + ], + "init" => [ + "setLocale" => function ($c) { + setlocale(LC_ALL, 'ru_RU.UTF-8'); + setlocale(LC_NUMERIC, "en_US.UTF-8"); + locale_set_default('ru'); + } + ], + "Acl" => [ + "adapter" => "Akademiano\\Acl\\Model\\Adapter\\RegisteredAdapter", + ], + "modules" => [ + "Akademiano\\Core", + ], + ], + ] +); +*/ + + +/*$app->getDiContainer()["routes"] = [ + "root" => [ + "patterns" => [ + "type" => \Akademiano\Router\RoutePattern::TYPE_FIRST_PREFIX, + "value" => "/", + ], + "action" => ["index", "index"], + ], +];*/ + +$app->run(); diff --git a/src/Controller/IndexController.php b/src/Controller/IndexController.php new file mode 100644 index 0000000..2f9b5d4 --- /dev/null +++ b/src/Controller/IndexController.php @@ -0,0 +1,14 @@ +autoRenderOff(); + } +} diff --git a/src/Site.php b/src/Site.php new file mode 100644 index 0000000..aed7212 --- /dev/null +++ b/src/Site.php @@ -0,0 +1,10 @@ + [ + 'adapter' => 'twig', + 'options' => [ + 'cache' => true, + "debug" => false, + ], + "extensions" => [ + "Twig_Extension_Debug", + "Akademiano\\Twig\\Extensions\\AssetExtension", + "Akademiano\\Twig\\Extensions\\UrlExtension", + "Akademiano\\User\\Twig\\UserExtension", + ], + "filters" => [ + "cropBySpace" => [["\\Aademiano\\Utils\\StringUtils", "cropBySpace"], ['pre_escape' => 'html']], + "urlToTag" => [ + ["\\Aademiano\\Utils\\StringUtils", "urlToTag"], + ['pre_escape' => 'html', 'is_safe' => array('html')] + ], + "nl2p" => [["\\Aademiano\\Utils\\StringUtils", "nl2p"], ['pre_escape' => 'html', 'is_safe' => array('html')]], + "cutStr" => [["\\Aademiano\\Utils\\StringUtils", "cutStr"], ['pre_escape' => 'html', 'is_safe' => array('html')]], + "nl2Array" => [["\\Aademiano\\Utils\\StringUtils", "nl2Array"], []], + "dechex" => [function($id) { + if($id instanceof \Akademiano\Entity\UuidInterface) { + $id = (string) $id->getHex(); + return$id; + } elseif (is_numeric($id)) { + return dechex((int)$id); + } else { + throw new RuntimeException("Culd not convert to hex not numeric or uuid item"); + } + }, []], + "dateIntl" => [["\\Aademiano\\Utils\\Time", "toStrIntl"], []], + "date2Month" => [["\\Aademiano\\Utils\\Time", "calendarMonth"], ['is_safe' => array('html')]], + ], + "urlExtension" => [ + "routeGenerator" => [ + \Akademiano\Config\Config::DYN_CONF => function ($c) { + $router = $c["router"]; + return [$router, "getUrl"]; + } + ] + ], + "userExtension" => [ + "custodian" => [ + \Akademiano\Config\Config::DYN_CONF => function ($c) { + return $c["custodian"]; + } + ] + ] + ], + "init" => [ + "setLocale" => function ($c) { + setlocale(LC_ALL, 'ru_RU.UTF-8'); + setlocale(LC_NUMERIC, "en_US.UTF-8"); + locale_set_default('ru'); + } + ], + "Acl" => [ + "adapter" => "Akademiano\\Acl\\Model\\Adapter\\RegisteredAdapter", + ], + "modules" => [ + "Akademiano\\User" + ], +]; diff --git a/src/config/local.config.dist.php b/src/config/local.config.dist.php new file mode 100644 index 0000000..ca5d8ed --- /dev/null +++ b/src/config/local.config.dist.php @@ -0,0 +1,5 @@ + [ + "patterns" => [ + "type" =>\Akademiano\Router\RoutePattern::TYPE_FIRST_PREFIX, + "value" => "/", + ], + "action" => ["index", "index"], + ], +]; diff --git a/src/themes/default/admin/index.twig b/src/themes/default/admin/index.twig new file mode 100644 index 0000000..0c58509 --- /dev/null +++ b/src/themes/default/admin/index.twig @@ -0,0 +1,5 @@ +{% extends "layoutAdmin.twig" %} + +{% block article %} + +{% endblock %} diff --git a/src/themes/default/assets/css/delta-index.css b/src/themes/default/assets/css/delta-index.css new file mode 100644 index 0000000..8c06387 --- /dev/null +++ b/src/themes/default/assets/css/delta-index.css @@ -0,0 +1,44 @@ +body { + padding-top: 20px; + padding-bottom: 40px; +} + +/* Custom container */ +.container-narrow { + margin: 0 auto; + max-width: 700px; +} +.container-narrow > hr { + margin: 30px 0; +} + +/* Main marketing message and sign up button */ +.jumbotron { + margin: 60px 0; + text-align: center; + background-color: #ffffff; +} +.jumbotron h1 { + font-size: 72px; + line-height: 1; +} +.jumbotron .btn { + font-size: 21px; + padding: 14px 24px; +} + +/* Supporting marketing content */ +.marketing { + margin: 60px 0; +} +.marketing p + h4 { + margin-top: 28px; +} + +div.liDesc>p { + height: 60px; +} + +div.docs h4 { + font-size: 12px; +} \ No newline at end of file diff --git a/src/themes/default/assets/js/colorbox.init.js b/src/themes/default/assets/js/colorbox.init.js new file mode 100644 index 0000000..7ecb04c --- /dev/null +++ b/src/themes/default/assets/js/colorbox.init.js @@ -0,0 +1,16 @@ +$(document).ready(function () { + $(".photo-thumb").colorbox({ + rel: 'photo-thumb', + slideshow: true, + slideshowSpeed: 4000, + slideshowAuto: false, +// transition:"none", + speed: 400, + maxWidth: "100%", maxHeight: "100%", + "isFitWidth": true, + + current: "{current} из {total}", + slideshowStart: "начать слайдшоу", + slideshowStop: "остановить слайдшоу" + }); +}); \ No newline at end of file diff --git a/src/themes/default/colorbox.twig b/src/themes/default/colorbox.twig new file mode 100644 index 0000000..94ba9c8 --- /dev/null +++ b/src/themes/default/colorbox.twig @@ -0,0 +1,9 @@ +{{ asset_css_once([ +"colorbox/example1/colorbox.css" +], default, true) }} + +{{ asset_js_once([ +"colorbox/jquery.colorbox-min.js", +"colorbox/i18n/jquery.colorbox-ru.js", +"assets/js/colorbox.init.js", +], default, true) }} diff --git a/src/themes/default/index/index.twig b/src/themes/default/index/index.twig new file mode 100644 index 0000000..61f95eb --- /dev/null +++ b/src/themes/default/index/index.twig @@ -0,0 +1,23 @@ +{% extends "layout.twig" %} + +{% block head %} + {{ parent() }} + + + +{% endblock head %} + +{% block content %} +
+
+

+ Akademiano Default All Site Template +

+ +

+ Default start page of Akademiano framework. +

+ Github +
+
+{% endblock content %} diff --git a/src/themes/default/layout.twig b/src/themes/default/layout.twig new file mode 100644 index 0000000..e4462a4 --- /dev/null +++ b/src/themes/default/layout.twig @@ -0,0 +1,72 @@ + + + + {% block head %} + {{ pageTitle | default('DeltaPHP Demo Site') }} + + + + {% if canonicalRef %} + + {% endif %} + + + {{ asset_css([ + "bootstrap/dist/css/bootstrap.css", + "bootstrap/dist/css/bootstrap-theme.css", + ], default, true) }} + +{# + #} + {{ asset_js([ + "jquery/dist/jquery.min.js", + "bootstrap/dist/js/bootstrap.min.js" + ], default, true) }} + {% endblock head %} + + + +{% block body %} +
+ {% block content %} +
+ +
+ {% block article %} + + {% endblock article %} +
+
+ {% endblock content %} +
+ + + + + {% if includeAnalitics %} + {% block counters %} + {% include "analitics.twig" %} + {% endblock counters %} + {% endif %} + +{% endblock body %} + + + diff --git a/src/themes/default/layoutAdmin.twig b/src/themes/default/layoutAdmin.twig new file mode 100644 index 0000000..f9bd534 --- /dev/null +++ b/src/themes/default/layoutAdmin.twig @@ -0,0 +1,54 @@ +{% extends "layout.twig" %} + +{% block body %} + + +
+ + {% block content %} +
+ +
+ {% block article %} + {% endblock article %} +
+
+ {% endblock content %} + +
+{% endblock body %} diff --git a/src/themes/default/layoutError.twig b/src/themes/default/layoutError.twig new file mode 100644 index 0000000..2120c8f --- /dev/null +++ b/src/themes/default/layoutError.twig @@ -0,0 +1,35 @@ +{% extends "layout.twig" %} + +{% block body %} + + +
+

Error

+
+{% endblock body %} diff --git a/tests/_support/_generated/AcceptanceTesterActions.php b/tests/_support/_generated/AcceptanceTesterActions.php index 1c0ed86..0804353 100644 --- a/tests/_support/_generated/AcceptanceTesterActions.php +++ b/tests/_support/_generated/AcceptanceTesterActions.php @@ -1,4 +1,4 @@ -wantTo('get index page'); +$I->amOnPage("/"); +$I->seeResponseCodeIs(200); +$I->see("OK");