added open file by click on image [UX]

pull/44/head
A1Gard 4 months ago
parent 061784523b
commit 2a00c64fea

@ -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();
});
});
});

@ -194,3 +194,6 @@ a.btn,a.action-btn,a.circle-btn{
margin: 1rem auto;
}
}
[data-open-file]{
cursor: pointer;
}

@ -30,7 +30,7 @@
<i class="ri-image-2-line"></i>
{{__('Feature image')}}
</h3>
<img src="{{$item->imgUrl()}}" alt="{{$item->name}}" class="img-fluid mb-4">
<img src="{{$item->imgUrl()}}" alt="{{$item->name}}" data-open-file="#image" class="img-fluid mb-4">
</div>
<div class="item-list mb-3">
@ -38,7 +38,7 @@
<i class="ri-image-2-line"></i>
{{__('Background image')}}
</h3>
<img src="{{$item->bgUrl()}}" alt="{{$item->name}}" class="img-fluid mb-4">
<img src="{{$item->bgUrl()}}" data-open-file="#bg" alt="{{$item->name}}" class="img-fluid mb-4">
</div>
@endif

@ -36,7 +36,7 @@
{{__("Index image")}}
</h3>
<div class="pb-4">
<img src="{{$item->imgUrl()}}" class="img-fluid" alt="{{$item->title}}">
<img src="{{$item->imgUrl()}}" data-open-file="#image" class="img-fluid" alt="{{$item->title}}">
</div>
</div>
@endif
@ -111,7 +111,7 @@
</label>
<input name="image" accept=".jpg,.png,.jpeg,.gif,.svg" type="file"
class="form-control @error('image') is-invalid @enderror"
placeholder="{{__('Index image')}}" value="{{old('image',$item->image??null)}}"/>
placeholder="{{__('Index image')}}" id="image"/>
</div>
</div>
<div class="col-md-12">
@ -143,7 +143,7 @@
<a href="{{route('admin.image.destroy',$img->id)}}" class="btn btn-danger delete-confirm rm-img ms-2">
<i class="ri-delete-bin-6-line"></i>
</a>
<img src="{{$img->imgUrl()}}" class="img-squire" alt="">
<img src="{{$img->imgUrl()}}" class="img-squire" alt="">
<div class="row mt-2">
<div class="col-md-10">
<input type="text" class="form-control" name="titles[{{$img->id}}]"

@ -29,7 +29,7 @@
<i class="ri-image-2-line"></i>
{{__('Feature image')}}
</h3>
<img src="{{$item->imgUrl()}}" alt="{{$item->name}}" class="img-fluid">
<img src="{{$item->imgUrl()}}" data-open-file="#image" alt="{{$item->name}}" class="img-fluid">
</div>
<div class="item-list mb-3">
@ -37,7 +37,7 @@
<i class="ri-image-2-line"></i>
{{__('Background image')}}
</h3>
<img src="{{$item->bgUrl()}}" alt="{{$item->name}}" class="img-fluid">
<img src="{{$item->bgUrl()}}" data-open-file="#bg" alt="{{$item->name}}" class="img-fluid">
</div>
@endif

@ -29,7 +29,7 @@
<i class="ri-image-2-line"></i>
{{__("Index image")}}
</h3>
<div>
<div data-open-file="#customFile">
<img src="{{$item->imgUrl()}}" class="img-fluid" alt="{{$item->title}}">
</div>
</div>

@ -30,7 +30,7 @@
{{__("Preview")}}
</h3>
<div class="p2 pb-5">
<img src="{{$item->imgUrl()}}" class="img-fluid" alt="image">
<img src="{{$item->imgUrl()}}" data-open-file="#cover" class="img-fluid" alt="image">
</div>
</div>
@endif

Loading…
Cancel
Save