diff --git a/app/Http/Controllers/TableController.php b/app/Http/Controllers/TableController.php
index 45c8b94..35c77f4 100644
--- a/app/Http/Controllers/TableController.php
+++ b/app/Http/Controllers/TableController.php
@@ -20,7 +20,7 @@ class TableController extends Controller
]);
/** @var Table $tableModel */
- $tableModel = $user->tables()->withCount(['favourites', 'forks', 'revisions', 'comments'])
+ $tableModel = $user->tables()->withCount(['favourites', 'forks', 'revisions', 'comments', 'proposals'])
->where('name', $table)->first();
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)
{
/** @var User $u */
diff --git a/app/Models/Table.php b/app/Models/Table.php
index 700043a..c78c232 100644
--- a/app/Models/Table.php
+++ b/app/Models/Table.php
@@ -21,7 +21,8 @@ use Illuminate\Database\Eloquent\Collection;
* @property string $license
* @property string $origin
* @property int $visits
- * @property-read string $viewPage
+ * @property-read string $viewRoute
+ * @property-read string $settingsRoute
* @property-read User $owner
* @property-read Table $parentTable
* @property-read Table[]|Collection $forks
@@ -122,16 +123,20 @@ class Table extends BaseModel
public function __get($name)
{
- if ($name == 'viewPage') {
+ if ($name == 'viewRoute') {
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);
}
public function scopeForList(Builder $query)
{
return $query->with('revision:id,row_count')->with('owner:id,name,title')
- ->withCount(['favourites', 'forks', 'revisions']);
+ ->withCount(['favourites', 'forks', 'revisions', 'proposals']);
}
}
diff --git a/resources/views/profile/_table-list.blade.php b/resources/views/profile/_table-list.blade.php
index 948f800..3ebeb92 100644
--- a/resources/views/profile/_table-list.blade.php
+++ b/resources/views/profile/_table-list.blade.php
@@ -2,6 +2,10 @@
if (!isset($showAuthors)) $showAuthors = false;
@endphp
+@php
+ /** @var \App\Models\Table[] $tables */
+@endphp
+
@if(count($tables) == 0)
No tables yet.
@@ -14,7 +18,7 @@
$rows = $table->revision->row_count;
@endphp
+ href="{{$table->viewRoute}}">
{{-- this must be span so that Lynx includes the table name in the anchor --}}
@icon(fa-table fa-pr){!!
diff --git a/resources/views/table/_action-buttons.blade.php b/resources/views/table/_action-buttons.blade.php
index 016dd69..57edce6 100644
--- a/resources/views/table/_action-buttons.blade.php
+++ b/resources/views/table/_action-buttons.blade.php
@@ -2,6 +2,10 @@
args: $table
--}}
+@php
+ /** @var \App\Models\Table $table */
+@endphp
+
@sr(Table actions)
@@ -67,10 +71,29 @@
@icon(fa-comment, sr:Comments)
+ {{-- Active proposals button | counter --}}
+
+
@endif
@if(user() && user()->ownsTable($table))
-
@icon(fa-wrench, sr:Table Options)
diff --git a/resources/views/table/_rows.blade.php b/resources/views/table/_rows.blade.php
index 3e28d8e..63df5e7 100644
--- a/resources/views/table/_rows.blade.php
+++ b/resources/views/table/_rows.blade.php
@@ -2,6 +2,11 @@
args: $rows, $cols
--}}
+@php
+ /** @var object[] $columns */
+ /** @var \App\Models\Row[]|array[][] $rows */
+@endphp
+
diff --git a/resources/views/table/edit.blade.php b/resources/views/table/edit.blade.php
new file mode 100644
index 0000000..399281e
--- /dev/null
+++ b/resources/views/table/edit.blade.php
@@ -0,0 +1,31 @@
+{{-- Basic table view --}}
+
+@extends('layouts.app')
+
+@php
+ /** @var \App\Models\Table $table */
+@endphp
+
+@section('content')
+
+
+
+ lalala
+
{{-- End of row --}}
+
+@endsection
diff --git a/resources/views/table/view.blade.php b/resources/views/table/view.blade.php
index 8f18af0..5f517f0 100644
--- a/resources/views/table/view.blade.php
+++ b/resources/views/table/view.blade.php
@@ -7,19 +7,19 @@
@endphp
@section('content')
-
-
-
- {{ $table->owner->handle }} {{--
- --}}/ {{--
- --}}{{ $table->name }}
-
+
+
+
+ {{ $table->owner->handle }} {{--
+ --}}/ {{--
+ --}}{{ $table->name }}
+
-
{{ $table->title }}
+
{{ $table->title }}
- @include('table._action-buttons')
-
+ @include('table._action-buttons')
+
diff --git a/routes/web.php b/routes/web.php
index e142372..6f32303 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -53,6 +53,8 @@ Route::group(['middleware' => 'auth'], function () {
Route::post('store', 'AccountController@storeAccount')->name('account.store');
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