diff --git a/resources/js/panel/general-events.js b/resources/js/panel/general-events.js index ef0b1e8..426c969 100644 --- a/resources/js/panel/general-events.js +++ b/resources/js/panel/general-events.js @@ -1,26 +1,11 @@ -document.addEventListener('click', function(e) { - if (e.target.classList.contains('delete-confirm')) { - if (!confirm('Are you sure you want to delete this item?')) { // WIP Need to translate - e.preventDefault(); - } - } -}); - -document.querySelectorAll('.delete-confirm')?.forEach(function (el) { - el.addEventListener('click',function (e) { - if (!confirm('Are you sure you want to delete this item?')) { // WIP Need to translate - e.preventDefault(); - } - }); -}); -window.findUrl = function (name,item = null) { +window.findUrl = function (name, item = null) { for (var i = 0; i < window.routesList.length; i++) { if (window.routesList[i].name === name) { - if (item != null){ + if (item != null) { return window.routesList[i].url.split('{item}').join(item); - }else{ + } else { return window.routesList[i].url; } } @@ -30,3 +15,27 @@ window.findUrl = function (name,item = null) { +document.addEventListener('DOMContentLoaded', () => { + + document.addEventListener('click', function (e) { + if (e.target.classList.contains('delete-confirm')) { + if (!confirm('Are you sure you want to delete this item?')) { // WIP Need to translate + e.preventDefault(); + } + } + }); + + document.querySelectorAll('.delete-confirm')?.forEach(function (el) { + el.addEventListener('click', function (e) { + if (!confirm('Are you sure you want to delete this item?')) { // WIP Need to translate + e.preventDefault(); + } + }); + }); + + document.querySelectorAll('[data-open-file]')?.forEach(function (el) { + el.addEventListener('click', function () { + document.querySelector(this.getAttribute('data-open-file')).click(); + }); + }); +}); diff --git a/resources/sass/panel/_common.scss b/resources/sass/panel/_common.scss index e74eda6..9f7d200 100644 --- a/resources/sass/panel/_common.scss +++ b/resources/sass/panel/_common.scss @@ -194,3 +194,6 @@ a.btn,a.action-btn,a.circle-btn{ margin: 1rem auto; } } +[data-open-file]{ + cursor: pointer; +} diff --git a/resources/views/admin/categories/category-form.blade.php b/resources/views/admin/categories/category-form.blade.php index 1c6fa58..1cf099c 100644 --- a/resources/views/admin/categories/category-form.blade.php +++ b/resources/views/admin/categories/category-form.blade.php @@ -30,7 +30,7 @@ {{__('Feature image')}} - {{$item->name}} + {{$item->name}}
@@ -38,7 +38,7 @@ {{__('Background image')}} - {{$item->name}} + {{$item->name}}
@endif diff --git a/resources/views/admin/galleries/gallery-form.blade.php b/resources/views/admin/galleries/gallery-form.blade.php index 724385a..8a4f9be 100644 --- a/resources/views/admin/galleries/gallery-form.blade.php +++ b/resources/views/admin/galleries/gallery-form.blade.php @@ -36,7 +36,7 @@ {{__("Index image")}}
- {{$item->title}} + {{$item->title}}
@endif @@ -111,7 +111,7 @@ + placeholder="{{__('Index image')}}" id="image"/>
@@ -143,7 +143,7 @@ - +
{{__('Feature image')}} - {{$item->name}} + {{$item->name}}
@@ -37,7 +37,7 @@ {{__('Background image')}} - {{$item->name}} + {{$item->name}}
@endif diff --git a/resources/views/admin/posts/post-form.blade.php b/resources/views/admin/posts/post-form.blade.php index 2629391..d1471e4 100644 --- a/resources/views/admin/posts/post-form.blade.php +++ b/resources/views/admin/posts/post-form.blade.php @@ -29,7 +29,7 @@ {{__("Index image")}} -
+
{{$item->title}}
diff --git a/resources/views/admin/sliders/slider-form.blade.php b/resources/views/admin/sliders/slider-form.blade.php index cc3c66f..d141f04 100644 --- a/resources/views/admin/sliders/slider-form.blade.php +++ b/resources/views/admin/sliders/slider-form.blade.php @@ -30,7 +30,7 @@ {{__("Preview")}}
- image + image
@endif