recreate Proposals button/inbox, start of edit page
This commit is contained in:
@@ -20,7 +20,7 @@ class TableController extends Controller
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
/** @var Table $tableModel */
|
/** @var Table $tableModel */
|
||||||
$tableModel = $user->tables()->withCount(['favourites', 'forks', 'revisions', 'comments'])
|
$tableModel = $user->tables()->withCount(['favourites', 'forks', 'revisions', 'comments', 'proposals'])
|
||||||
->where('name', $table)->first();
|
->where('name', $table)->first();
|
||||||
|
|
||||||
if ($tableModel === null) abort(404, "No such table.");
|
if ($tableModel === null) abort(404, "No such table.");
|
||||||
@@ -66,6 +66,17 @@ class TableController extends Controller
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function settings(Request $request, User $user, string $table)
|
||||||
|
{
|
||||||
|
/** @var Table $tableModel */
|
||||||
|
$tableModel = $user->tables()->where('name', $table)->first();
|
||||||
|
if ($tableModel === null) abort(404, "No such table.");
|
||||||
|
|
||||||
|
return view('table.edit', [
|
||||||
|
'table' => $tableModel,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
public function storeNew(Request $request)
|
public function storeNew(Request $request)
|
||||||
{
|
{
|
||||||
/** @var User $u */
|
/** @var User $u */
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ use Illuminate\Database\Eloquent\Collection;
|
|||||||
* @property string $license
|
* @property string $license
|
||||||
* @property string $origin
|
* @property string $origin
|
||||||
* @property int $visits
|
* @property int $visits
|
||||||
* @property-read string $viewPage
|
* @property-read string $viewRoute
|
||||||
|
* @property-read string $settingsRoute
|
||||||
* @property-read User $owner
|
* @property-read User $owner
|
||||||
* @property-read Table $parentTable
|
* @property-read Table $parentTable
|
||||||
* @property-read Table[]|Collection $forks
|
* @property-read Table[]|Collection $forks
|
||||||
@@ -122,16 +123,20 @@ class Table extends BaseModel
|
|||||||
|
|
||||||
public function __get($name)
|
public function __get($name)
|
||||||
{
|
{
|
||||||
if ($name == 'viewPage') {
|
if ($name == 'viewRoute') {
|
||||||
return route('table.view', ['user' => $this->cachedOwner()->name, 'table' => $this->name]);
|
return route('table.view', ['user' => $this->cachedOwner()->name, 'table' => $this->name]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($name == 'settingsRoute') {
|
||||||
|
return route('table.conf', ['user' => $this->cachedOwner()->name, 'table' => $this->name]);
|
||||||
|
}
|
||||||
|
|
||||||
return parent::__get($name);
|
return parent::__get($name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function scopeForList(Builder $query)
|
public function scopeForList(Builder $query)
|
||||||
{
|
{
|
||||||
return $query->with('revision:id,row_count')->with('owner:id,name,title')
|
return $query->with('revision:id,row_count')->with('owner:id,name,title')
|
||||||
->withCount(['favourites', 'forks', 'revisions']);
|
->withCount(['favourites', 'forks', 'revisions', 'proposals']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,10 @@
|
|||||||
if (!isset($showAuthors)) $showAuthors = false;
|
if (!isset($showAuthors)) $showAuthors = false;
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
|
@php
|
||||||
|
/** @var \App\Models\Table[] $tables */
|
||||||
|
@endphp
|
||||||
|
|
||||||
<div class="list-group list-group-flush">
|
<div class="list-group list-group-flush">
|
||||||
@if(count($tables) == 0)
|
@if(count($tables) == 0)
|
||||||
<span class="list-group-item">No tables yet.</span>
|
<span class="list-group-item">No tables yet.</span>
|
||||||
@@ -14,7 +18,7 @@
|
|||||||
$rows = $table->revision->row_count;
|
$rows = $table->revision->row_count;
|
||||||
@endphp
|
@endphp
|
||||||
<a class="list-group-item list-group-item-action"
|
<a class="list-group-item list-group-item-action"
|
||||||
href="{{$table->viewPage}}">
|
href="{{$table->viewRoute}}">
|
||||||
<span class="row">{{-- this must be span so that Lynx includes the table name in the anchor --}}
|
<span class="row">{{-- this must be span so that Lynx includes the table name in the anchor --}}
|
||||||
<span class="d-block col-7 flex-grow-1">
|
<span class="d-block col-7 flex-grow-1">
|
||||||
@icon(fa-table fa-pr){!!
|
@icon(fa-table fa-pr){!!
|
||||||
|
|||||||
@@ -2,6 +2,10 @@
|
|||||||
args: $table
|
args: $table
|
||||||
--}}
|
--}}
|
||||||
|
|
||||||
|
@php
|
||||||
|
/** @var \App\Models\Table $table */
|
||||||
|
@endphp
|
||||||
|
|
||||||
<nav aria-label="Table action buttons">
|
<nav aria-label="Table action buttons">
|
||||||
@sr(Table actions)
|
@sr(Table actions)
|
||||||
|
|
||||||
@@ -67,10 +71,29 @@
|
|||||||
@icon(fa-comment, sr:Comments)
|
@icon(fa-comment, sr:Comments)
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
{{-- Active proposals button | counter --}}
|
||||||
|
<div class="btn-group" role="group" aria-label="Fork">
|
||||||
|
<a href="" class="btn btn-outline-primary py-1 btn-sm" title="Change Proposals"
|
||||||
|
data-toggle="tooltip" data-placement="top">
|
||||||
|
@icon(fa-inbox fa-pr, sr:Change Proposals){{ $table->proposals_count ?: '–' }}
|
||||||
|
</a>
|
||||||
|
@if(user()->ownsTable($table))
|
||||||
|
<a href="" class="btn btn-outline-primary py-1 btn-sm btn-square" title="Draft Change"
|
||||||
|
data-toggle="tooltip" data-placement="top">
|
||||||
|
@icon(fa-pencil, sr:Draft Change)
|
||||||
|
</a>
|
||||||
|
@else
|
||||||
|
<a href="" class="btn btn-outline-primary py-1 btn-sm btn-square" title="Propose Change"
|
||||||
|
data-toggle="tooltip" data-placement="top">
|
||||||
|
@icon(fa-pencil, sr:Propose Change)
|
||||||
|
</a>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if(user() && user()->ownsTable($table))
|
@if(user() && user()->ownsTable($table))
|
||||||
<a href="" class="btn btn-outline-primary py-1 btn-sm"
|
<a href="{{ $table->settingsRoute }}" class="btn btn-outline-primary py-1 btn-sm"
|
||||||
title="Table Options" data-toggle="tooltip" data-placement="top">
|
title="Table Options" data-toggle="tooltip" data-placement="top">
|
||||||
@icon(fa-wrench, sr:Table Options)
|
@icon(fa-wrench, sr:Table Options)
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -2,6 +2,11 @@
|
|||||||
args: $rows, $cols
|
args: $rows, $cols
|
||||||
--}}
|
--}}
|
||||||
|
|
||||||
|
@php
|
||||||
|
/** @var object[] $columns */
|
||||||
|
/** @var \App\Models\Row[]|array[][] $rows */
|
||||||
|
@endphp
|
||||||
|
|
||||||
<table class="table table-hover table-sm">
|
<table class="table table-hover table-sm">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
{{-- Basic table view --}}
|
||||||
|
|
||||||
|
@extends('layouts.app')
|
||||||
|
|
||||||
|
@php
|
||||||
|
/** @var \App\Models\Table $table */
|
||||||
|
@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="{{ $table->viewRoute }}" class="btn btn-outline-primary py-1 btn-sm"
|
||||||
|
title="Back to Table" data-toggle="tooltip" data-placement="top">
|
||||||
|
@icon(fa-table, sr:Back to Table)
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row mx-auto col-md-12 justify-content-center mb-1 border rounded px-0 py-2 box-shadow mb-3">
|
||||||
|
lalala
|
||||||
|
</div>{{-- End of row --}}
|
||||||
|
|
||||||
|
@endsection
|
||||||
@@ -53,6 +53,8 @@ Route::group(['middleware' => 'auth'], function () {
|
|||||||
Route::post('store', 'AccountController@storeAccount')->name('account.store');
|
Route::post('store', 'AccountController@storeAccount')->name('account.store');
|
||||||
Route::get('forget-social-login/{id}', 'AccountController@forgetSocialLogin')->name('forget-identity');
|
Route::get('forget-social-login/{id}', 'AccountController@forgetSocialLogin')->name('forget-identity');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Route::get('@{user}/{table}/settings', 'TableController@settings')->name('table.conf');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Table resource - located at the end to work as a fallback
|
// Table resource - located at the end to work as a fallback
|
||||||
|
|||||||
Reference in New Issue
Block a user