implement GRIDs

This commit is contained in:
2018-08-01 22:19:30 +02:00
parent 8988df93fd
commit 755c65a42d
12 changed files with 203 additions and 37 deletions
+25 -22
View File
@@ -10,25 +10,26 @@
@sr(Table actions)
{{-- Disabled until implemented --}}
@if(true)
@if(guest() || !user()->confirmed || user()->ownsTable($table))
{{-- Guest, unconfirmed, or a table owner --}}
{{-- Passive fork buttons with counter --}}
<a href="" class="btn btn-outline-primary py-1 btn-sm" title="Forks"
data-toggle="tooltip" data-placement="top">
{{ $table->forks_count ?: '' }}&nbsp;
@icon(fa-code-fork, sr:Forks)
@icon(fa-code-fork, sr:Forks)&nbsp;
{{ $table->forks_count ?: '' }}
</a>
{{-- Passive favourite buttons with counter --}}
<a href="" class="btn btn-outline-primary py-1 btn-sm"
title="Favourites" data-toggle="tooltip" data-placement="top">
{{ $table->favourites_count ?: '' }}&nbsp;
@icon(fa-star, sr:Favourites)
@icon(fa-star, sr:Favourites)&nbsp;
{{ $table->favourites_count ?: '' }}
</a>
@else
{{-- Logged in and does not own the table --}}
{{-- Active fork button | counter --}}
<div class="btn-group" role="group" aria-label="Fork">
@@ -55,7 +56,6 @@
@icon(fa-star-o, sr:Favourite)
</a>
@endif
<a href="" class="btn btn-outline-primary py-1 btn-sm" title="Favourite Count"
data-toggle="tooltip" data-placement="top">
{{ $table->favourites_count ?: '' }}
@@ -67,8 +67,8 @@
{{-- Comments button with counter --}}
<a href="" class="btn btn-outline-primary py-1 btn-sm" title="Comments"
data-toggle="tooltip" data-placement="top">
{{ $table->comments_count ?: '' }}&nbsp;
@icon(fa-comment, sr:Comments)
@icon(fa-comment, sr:Comments)&nbsp;
{{ $table->comments_count ?: '' }}
</a>
{{-- Active proposals button | counter --}}
@@ -77,22 +77,25 @@
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
@auth
@if(user()->ownsTable($table))
{{-- Table owner logged in --}}
<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
{{-- Not a table owner --}}
<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
@endauth
</div>
@endif
@if(user() && user()->ownsTable($table))
@if(authed() && user()->ownsTable($table))
{{-- Table opts menu for table owner --}}
<a href="{{ $table->settingsRoute }}" class="btn btn-outline-primary py-1 btn-sm"
title="Table Options" data-toggle="tooltip" data-placement="top">
@icon(fa-wrench, sr:Table Options)
+4 -2
View File
@@ -4,12 +4,13 @@
@php
/** @var object[] $columns */
/** @var \App\Models\Row[]|array[][] $rows */
/** @var \App\Models\Row[] $rows */
@endphp
<table class="table table-hover table-sm">
<thead>
<tr>
<th>#GRID</th>
@foreach($columns as $col)
<th>{{ $col->title }}</th>
@endforeach
@@ -18,8 +19,9 @@
<tbody>
@foreach($rows as $row)
<tr>
<td>{{ $row->data->_grid }}</td>
@foreach($columns as $col)
<td data-id="{{ $row->id }}">{{ $row['data']->{$col->name} }}</td>
<td data-id="{{ $row->id }}">{{ $row->data->{$col->name} }}</td>
@endforeach
</tr>
@endforeach