From f825ce8a9c8b037450af35678666bf7310b581c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Fri, 18 Jun 2021 16:52:57 +0200 Subject: [PATCH] - Set jquery from cdn - fix fslightbox - fslightbox gallery mode --- app/Lib/Utils.php | 4 ++-- package.json | 1 - resources/js/bootstrap.js | 8 ++------ resources/views/layout/app.blade.php | 1 + resources/views/ticket/index.blade.php | 4 ++-- resources/views/ticket/show.blade.php | 8 ++++---- 6 files changed, 11 insertions(+), 15 deletions(-) diff --git a/app/Lib/Utils.php b/app/Lib/Utils.php index 061afa8..d2f3bf7 100644 --- a/app/Lib/Utils.php +++ b/app/Lib/Utils.php @@ -24,7 +24,7 @@ class Utils if (\strpos($url, 'http') === false and \strpos($url, 'https') === false) { $url = sprintf('http://%s', $url); } - $fsligthbox = self::isImageFile($url) ? 'data-fslightbox' : ''; + $fsligthbox = self::isImageFile($url) ? 'data-fslightbox="gallery"' : ''; return strlen($match) ? "$match" : $match; } }, @@ -36,6 +36,6 @@ class Utils public static function isImageFile(string $url): bool { $m = []; - return \preg_match('/(.png|.jpg|.jpeg|.gif)$/', $url, $m) === 1; + return \preg_match('/(\.png|\.jpg|\.jpeg|\.gif)$/', $url, $m) === 1; } } diff --git a/package.json b/package.json index d9270d2..7a09662 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,6 @@ "axios": "^0.21.1", "cross-env": "^7.0", "fslightbox": "^3.2.3", - "jquery": "^3.2", "laravel-mix": "^6.0.16", "laravel-mix-polyfill": "^3.0.1", "lodash": "^4.17.19", diff --git a/resources/js/bootstrap.js b/resources/js/bootstrap.js index fdb2696..3997bc7 100644 --- a/resources/js/bootstrap.js +++ b/resources/js/bootstrap.js @@ -6,12 +6,6 @@ window._ = require('lodash'); * code may be modified to fit the specific needs of your application. */ -try { - window.$ = window.jQuery = require('jquery'); - - require('fslightbox'); -} catch (e) {} - /** * We'll load the axios HTTP library which allows us to easily issue requests * to our Laravel back-end. This library automatically handles sending the @@ -69,3 +63,5 @@ vues.keys().map(key => ); const app = new Vue(vueOptions); + +require('fslightbox'); diff --git a/resources/views/layout/app.blade.php b/resources/views/layout/app.blade.php index 5f9240b..e611d89 100644 --- a/resources/views/layout/app.blade.php +++ b/resources/views/layout/app.blade.php @@ -99,6 +99,7 @@
@yield('content')
+ @stack('scriptsConstants') diff --git a/resources/views/ticket/index.blade.php b/resources/views/ticket/index.blade.php index 5e5f196..ecbe38a 100644 --- a/resources/views/ticket/index.blade.php +++ b/resources/views/ticket/index.blade.php @@ -92,12 +92,12 @@ @if ($ticket->file !== null) - Fichier + Fichier @endif @if ($ticket->file2 !== null) - Fichier 2 + Fichier 2 @endif {{ Carbon\Carbon::parse($ticket->created_at)->format('d/m/Y à H:i') }} diff --git a/resources/views/ticket/show.blade.php b/resources/views/ticket/show.blade.php index 23fad03..8de3b1e 100644 --- a/resources/views/ticket/show.blade.php +++ b/resources/views/ticket/show.blade.php @@ -103,7 +103,7 @@
{!! Utils::plainToHtml($message->message) !!} @if ($message->file !== null) -
Ouvrir la pièce jointe
+
Ouvrir la pièce jointe
@endif

Le {{ \Carbon\Carbon::parse($message->created_at)->format('d/m/Y à H:i')}} par {{ $message->user->name }}
@@ -111,7 +111,7 @@
{!! Utils::plainToHtml($message->message) !!} @if ($message->file !== null) -
Ouvrir la pièce jointe
+
Ouvrir la pièce jointe
@endif

Le {{ \Carbon\Carbon::parse($message->created_at)->format('d/m/Y à H:i')}} par {{ $message->user->name }}
@@ -132,13 +132,13 @@ @if ($ticket->file !== null)
  • Pièce jointe n°1 : - file))data-fslightbox @endif href="{{ asset($ticket->file) }}" target="_blank">Ouvrir la pièce jointe + file))data-fslightbox="gallery" @endif href="{{ asset($ticket->file) }}" target="_blank">Ouvrir la pièce jointe
  • @endif @if ($ticket->file2 !== null)
  • Pièce jointe n°2 : - file))data-fslightbox @endif href="{{ asset($ticket->file2) }}" target="_blank">Ouvrir la pièce jointe + file))data-fslightbox="gallery" @endif href="{{ asset($ticket->file2) }}" target="_blank">Ouvrir la pièce jointe
  • @endif