|
|
|
@ -24,19 +24,20 @@ |
|
|
|
|
<h2>Table Revisions</h2> |
|
|
|
|
|
|
|
|
|
@php |
|
|
|
|
$revIds = $revisions->pluck('id'); |
|
|
|
|
$revIds = $revisions->pluck('id')->reverse()->values(); |
|
|
|
|
@endphp |
|
|
|
|
|
|
|
|
|
@foreach($revisions as $i => $revision) |
|
|
|
|
@php |
|
|
|
|
$num = count($revisions) - $i; |
|
|
|
|
$isCurrent = $revision->id == $table->revision_id; |
|
|
|
|
@endphp |
|
|
|
|
<div class="x-revision rounded border box-shadow mb-3 p-2" id="revision-{{$revision->id}}"> |
|
|
|
|
<div class="row"> |
|
|
|
|
<div class="col-md-8"> |
|
|
|
|
#{{$num}} |
|
|
|
|
– {{ $revision->created_at->format('Y-m-d, G:i:s') }} |
|
|
|
|
@if($i == 0) |
|
|
|
|
@if($isCurrent) |
|
|
|
|
<span class="text-muted ml-1">(current)</span> |
|
|
|
|
@else |
|
|
|
|
<span class="text-muted ml-1"> |
|
|
|
@ -47,7 +48,7 @@ |
|
|
|
|
<div class="col-md-4 text-right"> |
|
|
|
|
@if($revision->ancestor_id) |
|
|
|
|
@if ($revIds->contains($revision->ancestor_id)) |
|
|
|
|
<span class="x-revision-link text-muted" data-id="{{$revision->ancestor_id}}">Show parent</span> |
|
|
|
|
<span class="x-revision-link text-muted" data-id="{{$revision->ancestor_id}}">Based on #{{ 1+$revIds->search($revision->ancestor_id) }}</span> |
|
|
|
|
@else |
|
|
|
|
<span class="text-muted">Forked from elsewhere</span> |
|
|
|
|
@endif |
|
|
|
@ -56,36 +57,17 @@ |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<div class="row"> |
|
|
|
|
<div class="col-md-12" style="font-size:140%;"> |
|
|
|
|
<div class="col-md-10" style="font-size:140%;"> |
|
|
|
|
{{ $revision->note }} |
|
|
|
|
</div> |
|
|
|
|
<div class="col-md-2 text-right"> |
|
|
|
|
@if(!$isCurrent && user()->ownsTable($table)) |
|
|
|
|
<a href="{{$table->actionRoute('revert-to', ['rev' => $num])}}" class="btn btn-outline-secondary btn-sm">Set as current</a> |
|
|
|
|
@endif |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
@endforeach |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
@endsection |
|
|
|
|
|
|
|
|
|
@push('scripts') |
|
|
|
|
<style> |
|
|
|
|
.x-revision.highlight { |
|
|
|
|
background: #a5d5ff; |
|
|
|
|
border-color: #a5d5ff; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.x-revision-link { |
|
|
|
|
cursor: pointer; |
|
|
|
|
} |
|
|
|
|
</style> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
ready(function() { |
|
|
|
|
$('.x-revision-link').on('mouseenter', function () { |
|
|
|
|
$('#revision-'+$(this).data('id')).addClass('highlight'); |
|
|
|
|
}).on('mouseleave', function () { |
|
|
|
|
$('#revision-'+$(this).data('id')).removeClass('highlight'); |
|
|
|
|
}) |
|
|
|
|
}); |
|
|
|
|
</script> |
|
|
|
|
@endpush |
|
|
|
|