kuvia/resources/views/gallery/images.blade.php

75 lines
3.1 KiB
PHP
Raw Normal View History

2021-01-12 16:50:08 +00:00
@extends('layout/template')
@section('content')
2021-01-17 04:12:42 +00:00
<div class="row" style="margin-top: 20px;">
2021-01-12 16:50:08 +00:00
<div class="col-md-12">
@foreach($images as $image)
2021-01-12 19:45:20 +00:00
<div class="card col-md-2 editImage" x-id="{{ $image->id }}" x-name="{{ $image->filename }}" x-image-url="/{{ $tenant->url }}/{{ $gallery->url }}/{{ $image->id }}/file?size=medium" style="float:left;cursor: pointer;" >
2021-01-12 16:50:08 +00:00
<div class="card-body" style="text-align: center;">
<img class="card-img-top" src="/{{ $tenant->url }}/{{ $gallery->url }}/{{ $image->id }}/file?size=small" style="height: 200px;width: auto; max-width: 100%;">
<h5 class="card-title">
{{ $image->filename }}
</h5>
</div>
</div>
@endforeach
</div>
</div>
<!-- Button trigger modal -->
<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
2021-01-12 19:45:20 +00:00
<h5 class="modal-title" id="exampleModalLabel">Bild bearbeiten</h5>
2021-01-12 16:50:08 +00:00
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
2021-01-12 19:45:20 +00:00
<img src="" id="imagePreview" style="width: 100%;">
<input style="display: none;" name="name" id="edit-name" placeholder="Name" class="form-control">
<input style="display: none;" name="edit-id" id="edit-id" placeholder="ID" class="form-control">
2021-01-12 16:50:08 +00:00
</div>
<div class="modal-footer">
2021-01-19 18:57:14 +00:00
<button type="button" id="deleteImage" class="btn btn-danger">Delete</button>
2021-01-12 19:45:20 +00:00
<button type="button" id="makeGalleryDefault" class="btn btn-warning">Make Galery Preview</button>
2021-01-19 18:57:14 +00:00
2021-01-12 16:50:08 +00:00
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
2021-01-12 19:45:20 +00:00
<!--<button type="button" class="btn btn-primary">Save changes</button>!-->
2021-01-12 16:50:08 +00:00
</div>
</div>
</div>
</div>
2021-01-12 19:45:20 +00:00
@endsection
@section('js')
<script>
$(".editImage").click(function () {
$("#imagePreview").attr("src", $(this).attr("x-image-url"));
$("#edit-name").val($(this).attr("x-name"));
$("#edit-id").val($(this).attr("x-id"));
$('#exampleModal').modal('show')
});
$("#makeGalleryDefault").click(function () {
$.ajax("/g/{{ $gallery->url }}/setDefault?id="+$("#edit-id").val()).done(function () {
alert("Set as Main Image");
});
});
2021-01-19 18:57:14 +00:00
$("#deleteImage").click(function () {
$.ajax("/g/{{ $gallery->url }}/delete?id="+$("#edit-id").val()).done(function () {
alert("Image deleted");
});
});
2021-01-12 19:45:20 +00:00
</script>
2021-01-12 16:50:08 +00:00
@endsection