diff --git a/app/Http/Controllers/MediaController.php b/app/Http/Controllers/MediaController.php index a530f5d..5003a76 100644 --- a/app/Http/Controllers/MediaController.php +++ b/app/Http/Controllers/MediaController.php @@ -3,8 +3,6 @@ namespace App\Http\Controllers; use App\Helpers; -use App\Jobs\ProcessMedia; -use App\MediaService\MediaService; use App\Models\Media; use Illuminate\Http\Request; use Illuminate\Http\UploadedFile; diff --git a/app/Jobs/ProcessMedia.php b/app/Jobs/ProcessMedia.php deleted file mode 100644 index d2cad1f..0000000 --- a/app/Jobs/ProcessMedia.php +++ /dev/null @@ -1,43 +0,0 @@ -file = $file; - } - - /** - * Execute the job. - */ - public function handle(): void - { - if(Storage::disk('temp')->exists($this->media->name)) { - - } - } -} diff --git a/public/script.js b/public/script.js index 982fa51..2b0d219 100644 --- a/public/script.js +++ b/public/script.js @@ -1,6 +1,6 @@ let SM = { alert: (title, text, type = 'info') =>{ - data = { + const data = { position: 'top-end', timer: 7000, toast: true, @@ -26,7 +26,7 @@ let SM = { } } - copyContent(); + copyContent().then(r => { /* empty */}); }, updateBillingAddress: () => { @@ -70,7 +70,7 @@ let SM = { window.location.href = response.data.redirect; } }) - .catch((error) => { + .catch(() => { window.location.reload(); }); } @@ -96,7 +96,6 @@ let SM = { Swal.fire(data); const showError = (message) => { - failed = true; Swal.fire({ position: 'top', icon: 'error', @@ -104,7 +103,7 @@ let SM = { html: message, showConfirmButton: true, confirmButtonColor: '#b91c1c', - }).then((result) => { + }).then(() => { if(callback) { callback({success: false}); } @@ -132,9 +131,9 @@ let SM = { formData.append('filesize', file.size); if (start === 0) { - formData.append('filestart', true); + formData.append('filestart', 'true'); } else { - formData.append('fileappend', true); + formData.append('fileappend', 'true'); } if (title !== '') { @@ -198,7 +197,7 @@ let SM = { } else { showError(response.data.message); } - }).catch((error) => { + }).catch(() => { showError('An error occurred while uploading the file.'); }); } @@ -207,9 +206,14 @@ let SM = { }, bytesToString: (bytes) => { + bytes = parseInt(bytes); + if (isNaN(bytes)) { + bytes = 0; + } + const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']; if (bytes === 0) return '0 Bytes'; - const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024))); + const i = Math.floor(Math.log(bytes) / Math.log(1024)); const size = parseFloat((bytes / Math.pow(1024, i)).toFixed(2)); return size + ' ' + sizes[i]; }, diff --git a/qodana.yaml b/qodana.yaml index 630c7bd..01c64a6 100644 --- a/qodana.yaml +++ b/qodana.yaml @@ -30,3 +30,5 @@ php: #Specify Qodana linter for analysis (Applied in CI/CD pipeline) linter: jetbrains/qodana-php:latest +exclude: + - name: HttpUrlsUsage diff --git a/resources/js/editor/Box.js b/resources/js/editor/Box.js index c6ddd51..9e996f8 100644 --- a/resources/js/editor/Box.js +++ b/resources/js/editor/Box.js @@ -29,7 +29,7 @@ export const Box = Node.create({ defining: true, parseHTML() { - return this.options.types.map((type) => ({ + return this.options.types.map((/* type */) => ({ tag: 'div', getAttrs: (node) => { // Extract the class attribute and find the type based on the class diff --git a/resources/js/editor/TipTap.js b/resources/js/editor/TipTap.js index 2f61d47..ef667fe 100644 --- a/resources/js/editor/TipTap.js +++ b/resources/js/editor/TipTap.js @@ -64,14 +64,14 @@ document.addEventListener('alpine:init', () => { Box ], content: content, - onCreate({editor}) { + onCreate({/* editor */}) { _this.updatedAt = Date.now() }, onUpdate({editor}) { _this.updatedAt = Date.now() _this.content = editor.getHTML() }, - onSelectionUpdate({editor}) { + onSelectionUpdate({/* editor */}) { _this.updatedAt = Date.now() } }) diff --git a/resources/js/media-picker.js b/resources/js/media-picker.js index 339e13a..45bf934 100644 --- a/resources/js/media-picker.js +++ b/resources/js/media-picker.js @@ -86,6 +86,8 @@ const SMMediaPicker = { Alpine.store('media').pagination = []; Alpine.nextTick(() => { Alpine.store('media').pagination = response.data.links; + }).then(r => { + /* empty */ }); }) .catch(error => { diff --git a/resources/views/admin/post/edit.blade.php b/resources/views/admin/post/edit.blade.php index 2b21d35..c099771 100644 --- a/resources/views/admin/post/edit.blade.php +++ b/resources/views/admin/post/edit.blade.php @@ -23,7 +23,7 @@
- +
@@ -71,4 +71,11 @@ } } } + + document.addEventListener('DOMContentLoaded', function() { + const publishedAt = document.getElementById('published_at'); + if(publishedAt) { + publishedAt.addEventListener('change', updateStatus); + } + }); diff --git a/resources/views/admin/user/edit.blade.php b/resources/views/admin/user/edit.blade.php index 10acadd..d7fd97b 100644 --- a/resources/views/admin/user/edit.blade.php +++ b/resources/views/admin/user/edit.blade.php @@ -1,3 +1,5 @@ +@props(['user']) + @php $billing_same_home = $user->home_address === $user->billing_address && $user->home_address2 === $user->billing_address2 diff --git a/resources/views/admin/workshop/edit.blade.php b/resources/views/admin/workshop/edit.blade.php index da5029d..ade5634 100644 --- a/resources/views/admin/workshop/edit.blade.php +++ b/resources/views/admin/workshop/edit.blade.php @@ -83,13 +83,13 @@
- + - + - +
@@ -145,6 +145,22 @@ } } + document.addEventListener('DOMContentLoaded', function() { + const elementIds = ['registration_url', 'registration_email', 'registration_message']; + const registrationElem = document.getElementById('registration_data'); + + if(registrationElem) { + elementIds.forEach(id => { + const elem = document.getElementById(id); + if (elem) { + elem.addEventListener('change', function(event) { + registrationElem.value = event.target.value; + }); + } + }) + } + }); + /* Initalize */ const elemPublishAt = document.getElementsByName('publish_at')[0]; if(elemPublishAt && elemPublishAt.value === '') { @@ -152,9 +168,4 @@ document.getElementsByName('publish_at')[0].value = SM.toLocalISOString(publishAt); } - /* Remove seconds from dates if they exist */ - // document.getElementsByName('starts_at')[0].value = document.getElementsByName('starts_at')[0].value.replace(/T(\d{2}:\d{2}):\d{2}$/, 'T$1'); - // document.getElementsByName('ends_at')[0].value = document.getElementsByName('ends_at')[0].value.replace(/T(\d{2}:\d{2}):\d{2}$/, 'T$1'); - // document.getElementsByName('publish_at')[0].value = document.getElementsByName('publish_at')[0].value.replace(/T(\d{2}:\d{2}):\d{2}$/, 'T$1'); - // document.getElementsByName('closes_at')[0].value = document.getElementsByName('closes_at')[0].value.replace(/T(\d{2}:\d{2}):\d{2}$/, 'T$1'); diff --git a/resources/views/components/container.blade.php b/resources/views/components/container.blade.php index b7b1b01..f3f1526 100644 --- a/resources/views/components/container.blade.php +++ b/resources/views/components/container.blade.php @@ -1,3 +1,3 @@ -
-
{{ $slot }}
+
+
{{ $slot }}
diff --git a/resources/views/components/heading.blade.php b/resources/views/components/heading.blade.php index 383962c..6ad89d2 100644 --- a/resources/views/components/heading.blade.php +++ b/resources/views/components/heading.blade.php @@ -1,16 +1,16 @@ @php -$id = Str::slug($slot); -$uri = url()->current() . '#' . $id; + $id = \Illuminate\Support\Str::slug($slot); + $uri = url()->current() . '#' . $id; @endphp - - {{ $slot }} - # - + + {{ $slot }} + # + diff --git a/resources/views/components/ui/checkbox.blade.php b/resources/views/components/ui/checkbox.blade.php index 8eb5552..3972a54 100644 --- a/resources/views/components/ui/checkbox.blade.php +++ b/resources/views/components/ui/checkbox.blade.php @@ -17,7 +17,7 @@
- +
diff --git a/resources/views/components/ui/file.blade.php b/resources/views/components/ui/file.blade.php index ffe24d7..dbed72c 100644 --- a/resources/views/components/ui/file.blade.php +++ b/resources/views/components/ui/file.blade.php @@ -6,7 +6,7 @@ $readonly = filter_var($readonly, FILTER_VALIDATE_BOOLEAN); @endphp -
+
{{ $label }}
@@ -25,7 +25,7 @@ @endif
@if (!$readonly) - + @endif {{-- --}}
@@ -69,6 +69,13 @@ reader.readAsDataURL(file); } + document.addEventListener('DOMContentLoaded', function() { + const fileInput = document.getElementById('{{ $name }}'); + if(fileInput) { + fileInput.addEventListener('change', updatePreview); + } + }); + if('{{ $fileName }}' !== '' && '{{ $fileSize }}' !== '' && '{{ $fileType }}' !== '' && '{{ $fileUrl }}' !== '') { updateDetails('{{ $fileName }}', '{{ $fileType }}', '{{ $fileSize }}', '{{ $fileUrl }}'); } else if('{{ $value }}' !== '') { diff --git a/resources/views/components/ui/filelist.blade.php b/resources/views/components/ui/filelist.blade.php index 8490dde..bbcb687 100644 --- a/resources/views/components/ui/filelist.blade.php +++ b/resources/views/components/ui/filelist.blade.php @@ -8,7 +8,7 @@ @endphp @if($value !== '' || $editor === true) -
+

{{ $label }}