Commit b8721dbe authored by nirgendswo's avatar nirgendswo

Merge branch 'master' of github.com:nirgendswo/fuzzy-cms

parents bb293b79 5034a4dc
## Table of contents
- [\App\Console\Kernel](#class-appconsolekernel)
- [\App\Console\Commands\InstallAssets](#class-appconsolecommandsinstallassets)
- [\App\Console\Commands\AssetsInstall](#class-appconsolecommandsassetsinstall)
- [\App\Console\Commands\MediaClear](#class-appconsolecommandsmediaclear)
- [\App\Exceptions\Handler](#class-appexceptionshandler)
- [\App\Facades\ViewHelperFacade](#class-appfacadesviewhelperfacade)
- [\App\Facades\PageRepositoryFacade](#class-appfacadespagerepositoryfacade)
......@@ -10,6 +11,8 @@
- [\App\Helpers\MarkdownHelper](#class-apphelpersmarkdownhelper)
- [\App\Helpers\ViewHelper](#class-apphelpersviewhelper)
- [\App\Helpers\ImageHelper](#class-apphelpersimagehelper)
- [\App\Http\Actions\PostActionAbstract (abstract)](#class-apphttpactionspostactionabstract-abstract)
- [\App\Http\Actions\PostActionInterface (interface)](#interface-apphttpactionspostactioninterface)
- [\App\Http\Controllers\PageController](#class-apphttpcontrollerspagecontroller)
- [\App\Http\Controllers\RssController](#class-apphttpcontrollersrsscontroller)
- [\App\Http\Middleware\Parameters](#class-apphttpmiddlewareparameters)
......@@ -33,7 +36,20 @@
<hr />
### Class: \App\Console\Commands\InstallAssets
### Class: \App\Console\Commands\AssetsInstall
> Copy all Assets from the Active Theme to the Public-Directory
| Visibility | Function |
|:-----------|:---------|
| public | <strong>__construct()</strong> : <em>void</em><br /><em>Create a new command instance.</em> |
| public | <strong>handle()</strong> : <em>mixed</em><br /><em>Execute the console command.</em> |
*This class extends \Illuminate\Console\Command*
<hr />
### Class: \App\Console\Commands\MediaClear
> Copy all Assets from the Active Theme to the Public-Directory
......@@ -113,6 +129,7 @@
| Visibility | Function |
|:-----------|:---------|
| protected | <strong>inlineImage(</strong><em>array</em> <strong>$excerpt</strong>)</strong> : <em>array</em><br /><em>extend default funcion, if a link is locale, use ImageHelper to generate images</em> |
| protected | <strong>inlineLink(</strong><em>array</em> <strong>$excerpt</strong>)</strong> : <em>array</em><br /><em>extend default function, if a link has http|https in url, then handle this link as external and set target to _blank</em> |
*This class extends \Parsedown*
......@@ -125,6 +142,11 @@
| Visibility | Function |
|:-----------|:---------|
| public | <strong>checkbox(</strong><em>string</em> <strong>$key</strong>, <em>array</em> <strong>$data</strong>)</strong> : <em>mixed</em><br /><em>check if $data has a index, and returning checked="checked" as string</em> |
| public | <strong>current(</strong><em>\App\Helpers\PageModel</em> <strong>$page</strong>, <em>string</em> <strong>$class=`'current'`</strong>)</strong> : <em>string</em><br /><em>check if this current route, if so return css class</em> |
| public | <strong>route(</strong><em>\App\Helpers\PageModel</em> <strong>$page</strong>)</strong> : <em>string</em><br /><em>create route, if slug is empty use page.index route</em> |
| public | <strong>selected(</strong><em>string</em> <strong>$key</strong>, <em>array</em> <strong>$data</strong>)</strong> : <em>mixed</em><br /><em>check if $data has a index, and returning selected="selected" as string</em> |
| public | <strong>text(</strong><em>string</em> <strong>$key</strong>, <em>array</em> <strong>$data</strong>)</strong> : <em>mixed</em><br /><em>check if $data has a index, and returning him</em> |
| public | <strong>timeElapsed(</strong><em>\App\Helpers\datetime</em> <strong>$dateTime</strong>)</strong> : <em>string</em><br /><em>time elapsed from a datetime object</em> |
| public | <strong>truncated(</strong><em>mixed</em> <strong>$html</strong>, <em>integer</em> <strong>$length=150</strong>)</strong> : <em>string</em><br /><em>truncated html</em> |
......@@ -136,17 +158,41 @@
| Visibility | Function |
|:-----------|:---------|
| public | <strong>passThrough(</strong><em>string</em> <strong>$relativePath</strong>)</strong> : <em>string</em><br /><em>pass through</em> |
| public | <strong>resize(</strong><em>string</em> <strong>$relativePath</strong>, <em>string</em> <strong>$width</strong>, <em>string</em> <strong>$height</strong>)</strong> : <em>string</em><br /><em>resize image with width and height</em> |
| public | <strong>resizeToHeight(</strong><em>string</em> <strong>$relativePath</strong>, <em>string</em> <strong>$height</strong>)</strong> : <em>string</em><br /><em>resize image height</em> |
| public | <strong>resizeToWidth(</strong><em>string</em> <strong>$relativePath</strong>, <em>string</em> <strong>$width</strong>)</strong> : <em>string</em><br /><em>resize image width</em> |
| public | <strong>scale(</strong><em>string</em> <strong>$relativePath</strong>, <em>string</em> <strong>$percentage</strong>)</strong> : <em>string</em><br /><em>scale image with percentage</em> |
| protected | <strong>getFilePathname(</strong><em>string</em> <strong>$filePathname</strong>, <em>string</em> <strong>$suffix</strong>)</strong> : <em>string</em><br /><em>adding suffix to filename</em> |
| protected | <strong>getFilePathname(</strong><em>string</em> <strong>$filePathname</strong>, <em>string</em> <strong>$suffix=`''`</strong>)</strong> : <em>string</em><br /><em>adding suffix to filename</em> |
| protected | <strong>getPublicFilePathname(</strong><em>string</em> <strong>$filePathname</strong>)</strong> : <em>string</em><br /><em>adding suffix to filename</em> |
| protected | <strong>has(</strong><em>mixed</em> <strong>$destinationPath</strong>, <em>mixed</em> <strong>$sourcePath</strong>)</strong> : <em>mixed</em><br /><em>if file not found create ImageResize</em> |
| protected | <strong>save(</strong><em>\App\Helpers\ImageResize</em> <strong>$image</strong>, <em>string</em> <strong>$filePathname</strong>)</strong> : <em>string</em><br /><em>save image to public</em> |
<hr />
### Class: \App\Http\Actions\PostActionAbstract (abstract)
> Abstract to create controller to handle post-action
| Visibility | Function |
|:-----------|:---------|
| public | <strong>__construct(</strong><em>\App\Http\Actions\Page/[\App\Models\PageModel](#class-appmodelspagemodel)</em> <strong>$page</strong>, <em>\Illuminate\Http\Request</em> <strong>$request</strong>)</strong> : <em>void</em> |
| public | <strong>getResult()</strong> : <em>mixed</em> |
*This class implements [\App\Http\Actions\PostActionInterface](#interface-apphttpactionspostactioninterface)*
<hr />
### Interface: \App\Http\Actions\PostActionInterface
> Interface to handle post-action
| Visibility | Function |
|:-----------|:---------|
| public | <strong>process()</strong> : <em>void</em> |
<hr />
### Class: \App\Http\Controllers\PageController
> Handle Pages
......@@ -155,8 +201,11 @@
|:-----------|:---------|
| public | <strong>__construct()</strong> : <em>void</em><br /><em>Create a new controller instance.</em> |
| public | <strong>jsonAction()</strong> : <em>\App\Http\Controllers\View</em><br /><em>show single page as json</em> |
| public | <strong>postAction(</strong><em>\Illuminate\Http\Request</em> <strong>$request</strong>)</strong> : <em>\App\Http\Controllers\View</em><br /><em>post single page with slug check for controller in current theme and call</em> |
| public | <strong>putAction(</strong><em>\Illuminate\Http\Request</em> <strong>$request</strong>)</strong> : <em>\App\Http\Controllers\View</em><br /><em>put single page with slug check for controller in current theme and call</em> |
| public | <strong>showAction()</strong> : <em>\App\Http\Controllers\View</em><br /><em>show single page with slug</em> |
| protected | <strong>getPage()</strong> : <em>\App\Http\Controllers\PageModel</em><br /><em>search by slug a page, if not found, redirect to page.404</em> |
| protected | <strong>processAction(</strong><em>Mixed</em> <strong>$action</strong>, <em>\App\Http\Controllers\PageModel</em> <strong>$page</strong>, <em>\App\Http\Controllers\Request</em> <strong>$request</strong>)</strong> : <em>Mixed</em> |
*This class extends \Laravel\Lumen\Routing\Controller*
......@@ -247,4 +296,3 @@
| public | <strong>getPage()</strong> : <em>integer</em><br /><em>get current page</em> |
| public | <strong>getSlug()</strong> : <em>string</em><br /><em>getting current slug</em> |
| public | <strong>getTags()</strong> : <em>array</em><br /><em>getting current tags</em> |
......@@ -11,21 +11,21 @@ use Exception;
*
* @author Björn Hase
*/
class MediaClear extends Command
class FilesClear extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'media:clear';
protected $signature = 'files:clear';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Delete all cached Media';
protected $description = 'Delete all cached Files';
/**
* Create a new command instance.
......@@ -44,11 +44,11 @@ class MediaClear extends Command
*/
public function handle()
{
$mediaDir = base_path().'/resources/media';
$mediaDir = base_path().'/resources/files';
$success = File::cleanDirectory($directory);
if ($success) {
$this->info('all cached Media has been deleted');
$this->info('all cached Files has been deleted');
}
}
}
......@@ -13,7 +13,8 @@ class Kernel extends ConsoleKernel
* @var array
*/
protected $commands = [
Commands\InstallAssets::class,
Commands\AssetsInstall::class,
Commands\FilesClear::class
];
/**
......
......@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use Laravel\Lumen\Routing\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use App\Facades\PageRepositoryFacade as PageRepository;
use App\PageService;
......@@ -49,14 +50,6 @@ class PageController extends Controller
// get current page with slug
$page = PageRepository::findOne($slug);
// if page not found redirect to 404
if (!$page) {
return redirect()->route('page.show', [
'slug' => '404'
]);
}
return $page;
}
......@@ -70,11 +63,24 @@ class PageController extends Controller
public function postAction(Request $request)
{
$page = $this->getPage();
if (!$page) {
return redirect()->route('page.show', [
'slug' => '404'
]);
}
$view = $this->getView($page);
$action = $this->getAction($page, self::METHOD_POST);
$action = $this->processAction($action, $page, $request);
if (!$action) {
return redirect()->route('page.show', [
'slug' => $page->slug
]);
}
return app()->make('view')->make($view, [
'page' => $page,
'request' => $request,
......@@ -92,11 +98,24 @@ class PageController extends Controller
public function putAction(Request $request)
{
$page = $this->getPage();
if (!$page) {
return redirect()->route('page.show', [
'slug' => '404'
]);
}
$view = $this->getView($page);
$action = $this->getAction($page, self::METHOD_PUT);
$action = $this->processAction($action, $page, $request);
if (!$action) {
return redirect()->route('page.show', [
'slug' => $page->slug
]);
}
return app()->make('view')->make($view, [
'page' => $page,
'request' => $request,
......@@ -116,10 +135,6 @@ class PageController extends Controller
if ($action) {
$action = new $action($page, $request);
$action->process();
} else {
return redirect()->route('page.show', [
'slug' => $page->slug
]);
}
return $action;
......@@ -135,6 +150,12 @@ class PageController extends Controller
{
$page = $this->getPage();
if (!$page) {
return redirect()->route('page.show', [
'slug' => '404'
]);
}
return app()->make('view')->make($this->getView($page), [
'page' => $page,
'result' => []
......@@ -188,7 +209,6 @@ class PageController extends Controller
$theme = env('APP_THEME');
$className = ucfirst(camel_case(str_replace('/', '', $page->slug)));
$classPath = '\\Themes\\'.$theme.'\\Actions\\'.$className.$method.'Action';
if (class_exists($classPath)) {
......
......@@ -39,6 +39,9 @@
"scripts": {
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"generate-documentation": [
"./vendor/bin/phpdoc-md generate app > DOCUMENTATION.md"
]
},
"minimum-stability": "dev",
......
This diff is collapsed.
......@@ -11,14 +11,16 @@
syntaxCheck="false">
<testsuites>
<testsuite name="Application Test Suite">
<directory suffix="Test.php">./tests</directory>
<directory>./tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./app</directory>
</whitelist>
</filter>
<php>
<env name="APP_ENV" value="testing"/>
<env name="CACHE_DRIVER" value="array"/>
......
......@@ -5,6 +5,7 @@ namespace Themes\FuzzyCms\Actions;
use App\Http\Actions\PostActionAbstract;
/**
* Only to show how it works
*
*
* @author Björn Hase
......@@ -12,6 +13,13 @@ use App\Http\Actions\PostActionAbstract;
*/
class GettingStartedPostAction extends PostActionAbstract
{
/**
* process request and adding values to result
*
*
* @inheritance
*
*/
public function process()
{
$this->result['value'] = $this->request->get('value');
......
This source diff could not be displayed because it is too large. You can view the blob instead.
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48">
<path d="M0 0h48v48h-48z" fill="none"/>
<path d="M6 36h36v-4h-36v4zm0-10h36v-4h-36v4zm0-14v4h36v-4h-36z"/>
</svg>
\ No newline at end of file
......@@ -7,7 +7,7 @@
"url": "git@github.com:nirgendswo/fuzzy-cms.git"
},
"devDependencies": {
"clean-css": "^3.4.20",
"clean-css-cli": "^4.1.6",
"concat": "^1.0.3",
"concat-cli": "^4.0.0",
"node-sass": "^4.3.0",
......@@ -23,9 +23,9 @@
"clean:js": "rimraf ../assets/js/*",
"concat:js": "concat-cli -f node_modules/zepto/dist/zepto.js js/script.js -o ../assets/js/scripts.js",
"minify:js": "uglifyjs ../assets/js/scripts.js -mc -o ../assets/js/scripts.js",
"build:css": "npm run clean:css && npm run build:scss",
"build:css": "npm run clean:css && npm run build:scss && npm run minify:css",
"clean:css": "rimraf ../assets/css/*",
"minify:css": "cleancss -o ../assets/css/styles.min.css ../assets/css/styles.css",
"minify:css": "cleancss -o ../assets/css/styles.css ../assets/css/styles.css",
"build:scss": "node-sass scss/styles.scss ../assets/css/styles.css",
"clean:svg": "rimraf build && rimraf assets",
"optimize:svg": "svgo -f linecons/src/svg -o build",
......
......@@ -9,36 +9,44 @@
.button {
background-color: $purple-color;
&:hover {
cursor: pointer;
}
&:hover, &:focus {
background-color: lighten($purple-color, 15%);
outline: 0;
}
}
.button--stories {
display: block;
}
.button__menu {
// for mobile use, to open navigation
.button-navigation {
position: fixed;
margin: 5px;
left: 0;
top: 0;
z-index: 101;
//position: absolute;
top: 15px;
left: 300px;
margin: 4px;
width: 55px;
border: 1px solid black;
color: white;
padding: 8px 12px;
padding: 8px 0;
font-weight: bold;
text-transform: uppercase;
&__icon {
fill: white;
width: 20px;
height: 20px;
margin: 0 2px;
}
@media (min-width: $reflex-lg) {
@media (min-width: $reflex-md) {
display: none;
}
}
.button__up {
// button to anchor to header
.button-up {
position: fixed;
margin: 5px;
bottom: 0;
......
......@@ -31,6 +31,8 @@ $table__background-color--odd: #f9f9f9;
font-size: 1em;
&__result {
margin: 0 0 10px;
dl {
margin: 0 0 10px 0;
......
......@@ -23,6 +23,11 @@ textarea {
max-height: 214px;
}
input[type="checkbox"] {
position: relative;
top: 2px;
}
.form__message {
color: $form__message-color;
padding: 1em;
......@@ -43,6 +48,10 @@ textarea {
background-color: $form__error-background-color;
}
.form__field {
margin: 3px 0;
}
// honeypot
.form__field--other {
display: none;
......
......@@ -29,5 +29,17 @@ $icon__sizes: (
margin-top: -4px;
}
&--menu {
width: 30px;
height: 30px;
left: 3px;
@media (min-width: $reflex-md) {
width: 20px;
height: 20px;
left: 0;
}
}
@include icon-sizes($icon__sizes);
}
......@@ -2,12 +2,16 @@
* navigation
*
*
* @AUTHOR Björn Hase
* @author Björn Hase
*
*/
.navigation {
margin-top: 15px;
margin-top: 46px;
@media (min-width: $reflex-md) {
margin-top: 12px;
}
&__list {
list-style: none;
......
......@@ -12,6 +12,36 @@
transition: all 0.1s ease-in;
&__logo {
background-color: white;
padding: 1.2em;
@media (min-width: $reflex-sm) {
padding-top: 70px;
}
}
&__title {
display: none;
font-family: 'Oswald', sans-serif;
font-weight: bold;
line-height: 1.4;
color: $dark-color;
background-color: white;
padding: 20px 21px;
@include fontSize(1.2);
@media (min-width: $reflex-lg) {
display: block;
}
}
&__title--small {
@font-size(12px);
padding: 0 12px 0 12px;
}
@media (min-width: $reflex-md) {
width: 105px;
left: 0;
......@@ -21,41 +51,20 @@
width: 280px;
left: 0;
}
}
.site-header__translation {
-webkit-transform:translateX(105px);
-moz-transform:translateX(105px);
-ms-transform:translateX(105px);
-o-transform:translateX(105px);
transform: translateX(105px);
}
.site-header__logo {
background-color: white;
padding: 1.2em;
&--open {
-webkit-transform:translateX(105px);
-moz-transform:translateX(105px);
-ms-transform:translateX(105px);
-o-transform:translateX(105px);
transform: translateX(105px);
@media (min-width: $reflex-sm) {
padding-top: 70px;
@media (min-width: $reflex-md) {
-webkit-transform:translateX(0px);
-moz-transform:translateX(0px);
-ms-transform:translateX(0px);
-o-transform:translateX(0px);
transform: translateX(0px);
}
}
}
.site-header__title {
display: none;
font-family: 'Oswald', sans-serif;
font-weight: bold;
line-height: 1.4;
color: $dark-color;
background-color: white;
padding: 20px 21px;
@include fontSize(1.2);
@media (min-width: $reflex-lg) {
display: block;
}
}
.site-header__title--small {
@font-size(12px);
padding: 0 12px 0 12px;
}
......@@ -35,3 +35,9 @@ body {
padding: 0 2%;
max-width: 1200px;
}
.clearfix:after {
content:" ";
display:block;
clear:both;
}
......@@ -23,7 +23,7 @@
<div class="content">
{!! $page->html() !!}
<div class="code">
<div class="code__result">
<div class="code__result clearfix">
<dl>
<dt>result['value']</dt><dd>{{ $viewHelper->text('value', $result) }}</dd>
<dt>result['checkbox']</dt><dd>{{ $viewHelper->text('checkbox', $result) }}</dd>
......
......@@ -2,13 +2,25 @@
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Fuzzy Blog | {{ $page->data['title'] }}</title>
@include('helpers.meta', ['page' => $page])
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="/assets/css/styles.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Oswald:700%7CDroid+Sans:400,700" rel="stylesheet" type="text/css">
</head>
<body>
<!--[if lte IE 9]>
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="https://browsehappy.com/">upgrade your browser</a> to improve your experience and security.</p>
<![endif]-->
<button class="button button-navigation">
<svg class="icon button-navigation__icon">
<use xlink:href="/assets/svg/icons.svg#menu" />
</svg>
</button>
<div class="bg bg--grey bordered">
<header class="site-header">
<div class="site-header__title">
......@@ -19,9 +31,6 @@
</div>
<div class="grid-wrap">
<main class="site-main">
<button class="button button-navigation">
Menu
</button>
@section('header')
<div class="grid">
<div class="grid__col-xs-12">
......@@ -44,7 +53,9 @@
<footer class="site-footer">
<div class="grid">
<div class="grid__col-xs-12">
MIT License / Copyright (c) 2017 Björn Hase
<p>
MIT License / Copyright (c) 2017 Björn Hase / <a href="/imprint">Imprint</a>
</p>
</div>
</div>
</footer>
......
.gitignore
.gitkeep
.git
node_modules
*.log
cache/*
public/files
<?php
use Laravel\Lumen\Testing\DatabaseMigrations;
use Laravel\Lumen\Testing\DatabaseTransactions;
class PageParserTest extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function testExample()
{
$this->get('/');
$this->assertEquals(
$this->app->version(), $this->response->getContent()
);
}
}
<?php
use Laravel\Lumen\Testing\DatabaseMigrations;
use Laravel\Lumen\Testing\DatabaseTransactions;
class PageRepositoryTest extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function testExample()
{
$this->get('/');
$this->assertEquals(
$this->app->version(), $this->response->getContent()
);
}
}
<?php
use Laravel\Lumen\Testing\DatabaseMigrations;
use Laravel\Lumen\Testing\DatabaseTransactions;
class PageServiceTest extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function testExample()
{
$this->get('/');
$this->assertEquals(
$this->app->version(), $this->response->getContent()
);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment