]> _ Git - odl.git/commitdiff
wip #4970 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 20 Dec 2021 16:22:39 +0000 (17:22 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 20 Dec 2021 16:23:30 +0000 (17:23 +0100)
app/Http/Controllers/FrontController.php
resources/views/front/home.blade.php
resources/views/front/resources.blade.php
resources/views/front/splash.blade.php
resources/views/layouts/app.blade.php
routes/web.php

index f5beb0f75cc3bc4b20de6aa34a46cc11f9f97c06..851ae79a9cb5236cb2a8f922db063ea82e8838c7 100644 (file)
@@ -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();
index 53c154c4be25f9d22b53e549281323ca4de30026..c1192ec5657f82b311f46c1cd9da80c76ecc36b9 100644 (file)
@@ -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
index d83a2ca7290d4d9575a7cf030c413257afe6bc9a..cf796844b784fbdb3d0048b4d21572c2cdeff7a4 100644 (file)
@@ -8,7 +8,7 @@
 
     {{-- RESOURCES --}}
     <div class="resources" x-data="{
-        viewerURL: '/tools/fluidbookpreview/pdfjs/web/viewer.html?file=', // Base URL for viewer
+        viewerURL: '/front/coeur/pdfjs/web/viewer.html?file=', // Base URL for viewer
         shown: false,
 
         init() {
index d853bb9fa408b55384dc5b7c8d3cdb3b2d052432..1ee9c98debf00fa6e3348e193b85dd4898d01a50 100644 (file)
@@ -24,7 +24,7 @@
             </video>
         </div>
 
-        <x-link href="/accueil"
+        <x-link href="/accueil.html"
                 id="home_link"
                 class="w-full max-h-[90vh] flex flex-col items-center justify-around">
             <img x-show="shown"
index bfe7eeb4f4d9a18456aafc4526d53325b1fe6b14..43fa3ce35cebf327bdeb213074884c060dd2e8fc 100644 (file)
         <ul class="w-full font-medium text-6xl">
             @php
                 $menu_links = [
-                    '/accueil' => 'Accueil',
-                    '/tools/fluidbookpreview/' => 'Cœur de l’offre',
-                    '/ressources' => 'Ressources',
-                    '/mediatheque' => 'Médiathèque',
-                    '/tour' => 'Visite guidée',
+                    '/accueil.html' => 'Accueil',
+                    '/coeur/index.html' => 'Cœur de l’offre',
+                    '/ressources.html' => 'Ressources',
+                    '/mediatheque.html' => 'Médiathèque',
+                    '/tour.html' => 'Visite guidée',
                 ];
             @endphp
 
index 7ab455d9c2cdae56f2ffcddfbb96f2ecccac10f3..0a98fe6e9ef311cf47319995926caf6e026198ff 100644 (file)
@@ -13,12 +13,12 @@ Route::group([
 // Frontend
 Route::group([
     'prefix' => 'front',
-    'middleware' => ['web', config('backpack.base.middleware_key', 'admin'),'can:view'],
+    'middleware' => ['web', config('backpack.base.middleware_key', 'admin'), 'can:view'],
     'namespace' => '\App\Http\Controllers',
 ], function () {
-    Route::get('','FrontController@splash');
-    Route::get('accueil','FrontController@home');
-    Route::get('ressources','FrontController@resources');
-    Route::get('mediatheque','FrontController@medialibrary');
-
+    Route::get('index.html', 'FrontController@splash');
+    Route::get('accueil.html', 'FrontController@home');
+    Route::get('ressources.html', 'FrontController@resources');
+    Route::get('mediatheque.html', 'FrontController@medialibrary');
+    Route::get('coeur/{args?}', 'FrontController@fluidbook')->where(['args' => '.*']);
 });