stub of the row editor

This commit is contained in:
2018-08-05 14:45:43 +02:00
parent e17548e5e7
commit bb8bc459dc
34 changed files with 724 additions and 175 deletions
@@ -0,0 +1,6 @@
@php($tab='add-rows')
@extends('table.propose.layout')
@section('tab-content')
...
@stop
@@ -0,0 +1,43 @@
@php
$tab = 'edit-rows';
/** @var \App\Tables\Column[] $columns */
/** @var \App\Tables\Changeset $changeset */
/** @var \App\Models\Row[]|Illuminate\Pagination\Paginator $rows */
/** @var \App\Models\Table $table */
@endphp
@extends('table.propose.layout')
@section('tab-content')
@if($rows->hasPages())
<div class="col-md-12 d-flex">
<nav class="text-center" aria-label="Pages of the table">
{{ $rows->links(null, ['ulClass' => 'mb-0']) }}
</nav>
</div>
@endif
<div class="col-12">
@php
$transformed = $rows->keyBy('_id')->map(function($r) use ($changeset) {
/** @var \App\Tables\Changeset $changeset */
return $changeset->transformRow($r, true);
});
@endphp
<table is="row-editor"
route="{{$table->getDraftRoute('update')}}"
:columns="{{toJSON($columns)}}"
:x-rows="{{toJSON($transformed)}}">
</table>
</div>
@if($rows->hasPages())
<div class="col-md-12 d-flex">
<nav class="text-center" aria-label="Pages of the table">
{{ $rows->links(null, ['ulClass' => 'mb-0']) }}
</nav>
</div>
@endif
@stop
@@ -0,0 +1,58 @@
{{-- Basic table view --}}
@extends('layouts.app')
@php
/** @var \App\Models\Table $table */
if (!isset($tab) || $tab == '') $tab = 'edit-rows';
@endphp
@section('content')
<div class="row justify-content-start px-3">
<div class="d-flex w-100 align-items-center">
<small class="flex-grow-1" style="font-size: 120%;">
<a href="{{ route('profile.view', $table->owner->name) }}" class="link-no-color">{{ $table->owner->handle }}</a>{{--
--}}<span class="px-1">/</span>{{--
--}}<b>{{ $table->name }}</b>
</small>
<h1 class="mx-3">{{ $table->title }}</h1>
<a href="" class="btn btn-outline-danger mr-2" @tooltip(Discard changes)>
@icon(fa-close, sr:Discard)
</a>
@if(user()->ownsTable($table))
<a href="" class="btn btn-outline-success" @tooltip(Save the changes and apply them as a new table revision)>
@icon(fa-save fa-pr)Commit
</a>
@else
<a href="" class="btn btn-outline-success" @tooltip(Submit your changes for review by the table owner)>
@icon(fa-save fa-pr)Submit
</a>
@endif
</div>
</div>
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link{{ $tab=='edit-rows'?' active':'' }}" href="{{ $table->getDraftRoute('edit-rows') }}">Edit Rows</a>
</li>
<li class="nav-item">
<a class="nav-link{{ $tab=='add-rows'?' active':'' }}" href="{{ $table->getDraftRoute('add-rows') }}">Add Rows</a>
</li>
<li class="nav-item">
<a class="nav-link{{ $tab=='manage-columns'?' active':'' }}" href="{{ $table->getDraftRoute('manage-columns') }}">Columns</a>
</li>
<li class="nav-item">
<a class="nav-link{{ $tab=='review'?' active':'' }}" href="{{ $table->getDraftRoute('review') }}">Note & Review</a>
</li>
<li class="nav-item ml-auto pt-2 pr-2 opacity-fade" style="opacity:0" id="draft-busy">
@icon(fa-hourglass, Working...)
</li>
</ul>
<div class="row justify-content-center mb-2">
@yield('tab-content')
</div>{{-- End of row --}}
@endsection
@@ -0,0 +1,6 @@
@php($tab='manage-columns')
@extends('table.propose.layout')
@section('tab-content')
...
@stop
@@ -0,0 +1,6 @@
@php($tab='review')
@extends('table.propose.layout')
@section('tab-content')
...
@stop