Add a swap button to make it easier to swap the selection of duplicate/delete images
This commit is contained in:
parent
861cefb2db
commit
648f18dae1
@ -35,4 +35,30 @@
|
||||
NONE!
|
||||
@endif
|
||||
</div>
|
||||
@endsection
|
||||
@endsection
|
||||
|
||||
@section('page-scripts')
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('span.swap').on('click',function() {
|
||||
var that = $(this);
|
||||
var tr = that.closest('tr');
|
||||
|
||||
['duplicate','remove'].forEach(function(item) {
|
||||
var items = tr.find('input[name^="'+item+'\["]');
|
||||
|
||||
if (items.length !== 2) {
|
||||
alert('cannot swap');
|
||||
return false;
|
||||
}
|
||||
|
||||
var rotate = items[0].checked;
|
||||
$(items[0]).prop('checked',items[1].checked);
|
||||
$(items[1]).prop('checked',rotate);
|
||||
|
||||
that.removeData();
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@append
|
@ -22,6 +22,7 @@
|
||||
|
||||
<div class="card-body">
|
||||
<x-photo.thumbnail :id="$o->id" :css="$css ?? NULL"/>
|
||||
<span class="btn btn-sm btn-outline-dark float-right swap">SWAP</span>
|
||||
</div>
|
||||
|
||||
<div class="card-footer card-comments">
|
||||
|
Loading…
Reference in New Issue
Block a user