From 211c0de4c88f8ec2dd7f20cdee6c6bbf8b1906f5 Mon Sep 17 00:00:00 2001 From: A1Gard Date: Sun, 4 Aug 2024 12:23:36 +0330 Subject: [PATCH] added clips list theme part added dor clip theme part fixed some clip upload bug fixe product preview permission optimized mp3 & mp4 player --- app/Http/Controllers/Admin/ClipController.php | 3 + app/Http/Controllers/ClientController.php | 25 ++++++ app/Http/Requests/ClipSaveRequest.php | 2 +- app/Models/Clip.php | 7 +- resources/js/client-vue/mp3player.vue | 4 +- resources/js/client-vue/videoPlayer.vue | 11 ++- .../segments/clip/DorClip/DorClip.blade.php | 15 ++++ .../views/segments/clip/DorClip/DorClip.js | 0 .../views/segments/clip/DorClip/DorClip.json | 10 +++ .../views/segments/clip/DorClip/DorClip.php | 21 +++++ .../views/segments/clip/DorClip/DorClip.scss | 16 ++++ .../segments/clip/DorClip/screenshot.png | Bin 0 -> 469542 bytes .../ClipListGrid/ClipListGrid.blade.php | 26 ++++++ .../clips_page/ClipListGrid/ClipListGrid.js | 0 .../clips_page/ClipListGrid/ClipListGrid.json | 10 +++ .../clips_page/ClipListGrid/ClipListGrid.php | 21 +++++ .../clips_page/ClipListGrid/ClipListGrid.scss | 79 ++++++++++++++++++ .../clips_page/ClipListGrid/screenshot.png | Bin 0 -> 512782 bytes routes/web.php | 4 +- 19 files changed, 243 insertions(+), 11 deletions(-) create mode 100644 resources/views/segments/clip/DorClip/DorClip.blade.php create mode 100644 resources/views/segments/clip/DorClip/DorClip.js create mode 100644 resources/views/segments/clip/DorClip/DorClip.json create mode 100644 resources/views/segments/clip/DorClip/DorClip.php create mode 100644 resources/views/segments/clip/DorClip/DorClip.scss create mode 100644 resources/views/segments/clip/DorClip/screenshot.png create mode 100644 resources/views/segments/clips_page/ClipListGrid/ClipListGrid.blade.php create mode 100644 resources/views/segments/clips_page/ClipListGrid/ClipListGrid.js create mode 100644 resources/views/segments/clips_page/ClipListGrid/ClipListGrid.json create mode 100644 resources/views/segments/clips_page/ClipListGrid/ClipListGrid.php create mode 100644 resources/views/segments/clips_page/ClipListGrid/ClipListGrid.scss create mode 100644 resources/views/segments/clips_page/ClipListGrid/screenshot.png diff --git a/app/Http/Controllers/Admin/ClipController.php b/app/Http/Controllers/Admin/ClipController.php index 2236fc9..00e5b3a 100644 --- a/app/Http/Controllers/Admin/ClipController.php +++ b/app/Http/Controllers/Admin/ClipController.php @@ -88,6 +88,9 @@ class ClipController extends XController config('app.media.watermark_size'), Unit::Percent, Fit::Contain, config('app.media.watermark_opacity')); } + if (!file_exists(storage_path() . '/app/public/cover')){ + mkdir(storage_path() . '/app/public/cover/'); + } $i->save(storage_path() . '/app/public/cover/optimized-'. $clip->$key); } diff --git a/app/Http/Controllers/ClientController.php b/app/Http/Controllers/ClientController.php index 35e42d4..cdb23ae 100644 --- a/app/Http/Controllers/ClientController.php +++ b/app/Http/Controllers/ClientController.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers; use App\Models\Attachment; use App\Models\Category; +use App\Models\Clip; use App\Models\Comment; use App\Models\Customer; use App\Models\Gallery; @@ -44,6 +45,18 @@ class ClientController extends Controller return view('client.post', compact('area', 'post', 'title', 'subtitle')); } + public function clip(Clip $clip) + { + + if ($clip->status = 0 && !auth()->check()) { + return abort(403); + } + $area = 'clip'; + $title = $clip->title; + $subtitle = ''; + return view('client.default-list', compact('area', 'clip', 'title', 'subtitle')); + } + public function gallery(Gallery $gallery) { if ($gallery->status = 0 && !auth()->check()) { @@ -85,6 +98,15 @@ class ClientController extends Controller ->orderByDesc('id')->paginate($this->paginate); return view('client.default-list', compact('area', 'galleries', 'title', 'subtitle')); } + public function clips() + { + $area = 'clips-list'; + $title = __("Video clips list"); + $subtitle = ''; + $clips = Clip::where('status', 1) + ->orderByDesc('id')->paginate($this->paginate); + return view('client.default-list', compact('area', 'clips', 'title', 'subtitle')); + } public function attachments() { @@ -167,6 +189,9 @@ class ClientController extends Controller public function product(Product $product) { + if ($product->status = 0 && !auth()->check()) { + return abort(403); + } $area = 'product'; $title = $product->name; $subtitle = $product->excerpt; // WIP SEO diff --git a/app/Http/Requests/ClipSaveRequest.php b/app/Http/Requests/ClipSaveRequest.php index 0a8f5b9..e979cc0 100644 --- a/app/Http/Requests/ClipSaveRequest.php +++ b/app/Http/Requests/ClipSaveRequest.php @@ -25,7 +25,7 @@ class ClipSaveRequest extends FormRequest 'title' => ['required', 'string', 'max:255','min:5'], 'body' => ['nullable', 'string',], 'active' => ['nullable', 'boolean'], - 'clip' => ['nullable', 'mimes:mp4', 'max:'.'max:'.getMaxUploadSize()], + 'clip' => ['nullable', 'mimes:mp4', 'max:'.getMaxUploadSize()], 'cover' => ['nullable', 'image', 'mimes:jpeg,png,jpg,gif,svg', 'max:2048'], ]; } diff --git a/app/Models/Clip.php b/app/Models/Clip.php index ac86e27..ff8d8e5 100644 --- a/app/Models/Clip.php +++ b/app/Models/Clip.php @@ -22,10 +22,10 @@ class Clip extends Model public function imgUrl() { if ($this->cover == null) { - return asset('assets/upload/logo.svg');; + return asset('assets/upload/logo.svg'); } - return \Storage::url('clips/optimized-' . $this->cover); + return \Storage::url('cover/optimized-' . $this->cover); } public function imgOriginalUrl() { @@ -55,8 +55,7 @@ class Clip extends Model } public function webUrl(){ - return '#';// WIP - return route(''); + return route('client.clip',$this->slug); } diff --git a/resources/js/client-vue/mp3player.vue b/resources/js/client-vue/mp3player.vue index 7b7bf25..c369127 100644 --- a/resources/js/client-vue/mp3player.vue +++ b/resources/js/client-vue/mp3player.vue @@ -64,14 +64,14 @@ export default { } }, mounted() { - // window.addEventListener('load',()=>{ + window.addEventListener('load',()=>{ setTimeout(() => { this.link = this.asset; }, 500); setInterval(() => { this.updatePlayer(); }, 300); - // }); + }); }, computed: { diff --git a/resources/js/client-vue/videoPlayer.vue b/resources/js/client-vue/videoPlayer.vue index 256d261..d8a7c01 100644 --- a/resources/js/client-vue/videoPlayer.vue +++ b/resources/js/client-vue/videoPlayer.vue @@ -1,6 +1,6 @@