From 224ee241fa1ec9fec0b9073f09c180cfa1020a4a Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Mon, 20 Dec 2021 17:22:39 +0100 Subject: [PATCH] wip #4970 @0.5 --- app/Http/Controllers/FrontController.php | 46 ++++++++++++++++------- resources/views/front/home.blade.php | 8 ++-- resources/views/front/resources.blade.php | 2 +- resources/views/front/splash.blade.php | 2 +- resources/views/layouts/app.blade.php | 10 ++--- routes/web.php | 12 +++--- 6 files changed, 49 insertions(+), 31 deletions(-) diff --git a/app/Http/Controllers/FrontController.php b/app/Http/Controllers/FrontController.php index f5beb0f..851ae79 100644 --- a/app/Http/Controllers/FrontController.php +++ b/app/Http/Controllers/FrontController.php @@ -4,37 +4,55 @@ namespace App\Http\Controllers; use App\Models\Resource; use Cubist\Backpack\Magic\PageData; +use Cubist\Util\Files\Files; -class FrontController extends Controller -{ - public function splash() - { +class FrontController extends Controller { + public function splash() { return view('front.splash', $this->_getDataFromCMS()); } - public function home() - { + public function home() { return view('front.home', $this->_getDataFromCMS()); } - public function resources() - { + public function resources() { return view('front.resources', $this->_getDataFromCMS()); } - public function medialibrary() - { + public function medialibrary() { return view('front.media-library', $this->_getDataFromCMS()); } - protected function _getDataFromCMS() - { + public function fluidbook($args = '') { + if (!$args) { + $args = []; + } else { + $args = explode('/', $args); + } + + if (count($args) > 0) { + $path = implode('/', $args); + } else { + return redirect(backpack_url('front/coeur/index.html')); + } + + $path = storage_path('fluidbook/out') . '/' . $path; + + + if (file_exists($path)) { + return response(null)->header('Content-Type', Files::_getMimeType($path))->header('X-Sendfile', $path); + } else { + return response(null)->setStatusCode(404); + } + + } + + protected function _getDataFromCMS() { return ['resources' => $this->_getResourcesFromCMS()]; } - protected function _getResourcesFromCMS() - { + protected function _getResourcesFromCMS() { /** @var PageData $d */ $d = Resource::find('1')->getPageData(); return $d->getRawData(); diff --git a/resources/views/front/home.blade.php b/resources/views/front/home.blade.php index 53c154c..c1192ec 100644 --- a/resources/views/front/home.blade.php +++ b/resources/views/front/home.blade.php @@ -7,26 +7,26 @@ $logo = '/storage/102/groupe-84.svg'; $subtitle = "Découvrez le coeur de l'offre sous forme de feuilleteur interactif"; $button = "Découvrir l'offre"; - $button_link = '/tools/fluidbookpreview/'; + $button_link = '/front/coeur/index.html'; $illustration = '/storage/137/home-magazine.jpg'; $shortcuts = [ [ 'title' => 'Ressources', 'content' => "Consultez l'ensemble des documents au format PDF", 'image' => '/storage/104/groupe-209-at-2x.png', - 'link' => '/ressources', + 'link' => '/ressources.html', ], [ 'title' => 'Médiathèque', 'content' => 'Consultez les médias audio et vidéo', 'image' => '/storage/105/groupe-211-at-2x.png', - 'link' => '/mediatheque', + 'link' => '/mediatheque.html', ], [ 'title' => 'Visite guidée', 'content' => 'Laissez-vous guider dans une lecture thématique', 'image' => '/storage/106/groupe-221-at-2x.png', - 'link' => '/tour', + 'link' => '/tour.html', ], ]; @endphp diff --git a/resources/views/front/resources.blade.php b/resources/views/front/resources.blade.php index d83a2ca..cf79684 100644 --- a/resources/views/front/resources.blade.php +++ b/resources/views/front/resources.blade.php @@ -8,7 +8,7 @@ {{-- RESOURCES --}}