From 787ad20ce78a308278b1ea5c5c283609dbdb7a62 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Thu, 16 Jul 2015 19:15:22 +0100 Subject: [PATCH] Added link functionality --- app/Http/Controllers/PageController.php | 6 +++++ app/Http/routes.php | 2 ++ resources/assets/sass/_text.scss | 2 ++ resources/assets/sass/styles.scss | 19 ++++++++++++++ resources/views/base.blade.php | 2 ++ resources/views/pages/create.blade.php | 4 +++ resources/views/pages/edit.blade.php | 4 +++ resources/views/pages/form.blade.php | 20 +-------------- resources/views/pages/image-manager.blade.php | 19 ++++++++++++++ resources/views/pages/show.blade.php | 25 +++++++++++++++++++ 10 files changed, 84 insertions(+), 19 deletions(-) create mode 100644 resources/views/pages/image-manager.blade.php diff --git a/app/Http/Controllers/PageController.php b/app/Http/Controllers/PageController.php index da56fb26b..0a9f11844 100644 --- a/app/Http/Controllers/PageController.php +++ b/app/Http/Controllers/PageController.php @@ -126,6 +126,12 @@ class PageController extends Controller return redirect($page->getUrl()); } + public function redirectFromLink($pageId) + { + $page = $this->pageRepo->getById($pageId); + return redirect($page->getUrl()); + } + /** * Remove the specified resource from storage. * diff --git a/app/Http/routes.php b/app/Http/routes.php index be5d7c487..52394c564 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -35,6 +35,8 @@ Route::get('/images/all', 'ImageController@getAll'); Route::get('/images/all/{page}', 'ImageController@getAll'); Route::get('/images/{any}', 'ImageController@getImage')->where('any', '.*'); +Route::get('/link/{id}', 'PageController@redirectFromLink'); + Route::get('/', function () { return view('base'); }); diff --git a/resources/assets/sass/_text.scss b/resources/assets/sass/_text.scss index 9e24d4cd5..584b12b5b 100644 --- a/resources/assets/sass/_text.scss +++ b/resources/assets/sass/_text.scss @@ -29,6 +29,8 @@ h4 { h1, h2, h3, h4 { font-weight: 500; + position: relative; + display: block; .subheader { display: block; font-size: 0.5em; diff --git a/resources/assets/sass/styles.scss b/resources/assets/sass/styles.scss index 6df66b832..853e98454 100644 --- a/resources/assets/sass/styles.scss +++ b/resources/assets/sass/styles.scss @@ -116,6 +116,8 @@ header .menu { } } + + .overlay { background-color: rgba(0, 0, 0, 0.2); position: fixed; @@ -180,4 +182,21 @@ header .menu { padding-top: $-xl*1.2; color: #666; border-top: 2px solid $primary; +} + +// Link hooks & popovers +a.link-hook { + position: absolute; + display: inline-block; + top: $-xs; + left: -$-xl+2px; + font-size: 20px; + line-height: 20px; + color: #BBB; + opacity: 0; +} +h1, h2, h3, h4, h5, h6 { + &:hover a.link-hook { + opacity: 1; + } } \ No newline at end of file diff --git a/resources/views/base.blade.php b/resources/views/base.blade.php index a8e17ce7e..e61944e37 100644 --- a/resources/views/base.blade.php +++ b/resources/views/base.blade.php @@ -10,6 +10,7 @@ +@stop + +@section('bottom') + @include('pages/image-manager') @stop \ No newline at end of file diff --git a/resources/views/pages/edit.blade.php b/resources/views/pages/edit.blade.php index 16ded0b3d..30a27cb79 100644 --- a/resources/views/pages/edit.blade.php +++ b/resources/views/pages/edit.blade.php @@ -15,4 +15,8 @@ +@stop + +@section('bottom') + @include('pages/image-manager') @stop \ No newline at end of file diff --git a/resources/views/pages/form.blade.php b/resources/views/pages/form.blade.php index 980c36f04..7e0cd3eb0 100644 --- a/resources/views/pages/form.blade.php +++ b/resources/views/pages/form.blade.php @@ -18,25 +18,7 @@ - @stop