Hide unimplemented feature buttons and indicators with feature flags
This commit is contained in:
@@ -6,6 +6,11 @@ const VALI_EMAIL = 'string|email|max:255';
|
|||||||
const VALI_TEXT = 'string|max:4095';
|
const VALI_TEXT = 'string|max:4095';
|
||||||
const VALI_LINE = 'string|max:255';
|
const VALI_LINE = 'string|max:255';
|
||||||
|
|
||||||
|
const FEATURE_FORKS = false;
|
||||||
|
const FEATURE_FAVES = false;
|
||||||
|
const FEATURE_TABLE_COMMENTS = false;
|
||||||
|
const FEATURE_PROPOSALS = false;
|
||||||
|
|
||||||
// global helpers
|
// global helpers
|
||||||
function authed() {
|
function authed() {
|
||||||
return ! \Auth::guest();
|
return ! \Auth::guest();
|
||||||
|
|||||||
@@ -24,24 +24,31 @@
|
|||||||
@icon(fa-table fa-pr){!!
|
@icon(fa-table fa-pr){!!
|
||||||
$showAuthors ? (e($table->owner->handle) . '<span class="px-1">/</span>') : ''
|
$showAuthors ? (e($table->owner->handle) . '<span class="px-1">/</span>') : ''
|
||||||
!!}<b>{{ $table->title }}</b>
|
!!}<b>{{ $table->title }}</b>
|
||||||
</span>{{--
|
</span>
|
||||||
--}}<div class="d-block col-5 small text-right">{{--
|
<div class="d-flex justify-content-end col-5 small text-right">
|
||||||
--}}<span title="Visits" class="d-inline-block pl-2" style="min-width: 50px;">
|
<span title="Visits" class="d-inline-block pl-2" style="min-width: 50px;">
|
||||||
{{ $table->visits }}@icon(fa-eye fa-pl, ~Visits~~)
|
{{ $table->visits }}@icon(fa-eye fa-pl, ~Visits~~)
|
||||||
</span>{{--
|
</span>
|
||||||
--}}{{--<span title="Forks" class="d-inline-block pl-2 {{$forks==0?'hidden':''}}" style="min-width: 50px;">
|
|
||||||
|
@if(FEATURE_FORKS)
|
||||||
|
<span title="Forks" class="d-inline-block pl-2 {{$forks==0?'hidden':''}}" style="min-width: 50px;">
|
||||||
{{ $forks }}@icon(fa-code-fork fa-pl, ~Forks~~)
|
{{ $forks }}@icon(fa-code-fork fa-pl, ~Forks~~)
|
||||||
</span>--}}{{--
|
</span>
|
||||||
--}}{{--<span title="Favourites" class="d-inline-block pl-2 {{$faves==0?'hidden':''}}" style="min-width: 50px;">
|
@endif
|
||||||
|
|
||||||
|
@if(FEATURE_FAVES)
|
||||||
|
<span title="Favourites" class="d-inline-block pl-2 {{$faves==0?'hidden':''}}" style="min-width: 50px;">
|
||||||
{{ $faves }}@icon(fa-star fa-pl, ~Favourites~~)
|
{{ $faves }}@icon(fa-star fa-pl, ~Favourites~~)
|
||||||
</span>--}}{{--
|
</span>
|
||||||
--}}{{--<span title="Revisions" class="d-inline-block pl-2" style="min-width: 50px;">
|
@endif
|
||||||
|
|
||||||
|
<span title="Revisions" class="d-inline-block pl-2" style="min-width: 50px;">
|
||||||
{{ $revs }}@icon(fa-history fa-pl, ~Revisions~~)
|
{{ $revs }}@icon(fa-history fa-pl, ~Revisions~~)
|
||||||
</span>--}}{{--
|
</span>
|
||||||
--}}<span title="Rows" class="d-inline-block pl-2" style="min-width: 50px;">
|
|
||||||
|
<span title="Rows" class="d-inline-block pl-2" style="min-width: 50px;">
|
||||||
{{ $rows }}@icon(fa-th-list fa-pl, ~Rows)
|
{{ $rows }}@icon(fa-th-list fa-pl, ~Rows)
|
||||||
</span>{{--
|
</span>
|
||||||
--}}
|
|
||||||
</div>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<table class="table table-hover table-sm">
|
<table class="table table-hover table-sm">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>#</th>
|
{{--<th>#</th>--}}
|
||||||
@foreach($columns as $col)
|
@foreach($columns as $col)
|
||||||
<th title="{{$col->name}}">{{ $col->title }}</th>
|
<th title="{{$col->name}}">{{ $col->title }}</th>
|
||||||
@endforeach
|
@endforeach
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
@foreach($rows as $row)
|
@foreach($rows as $row)
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{$row->_id}}</td>
|
{{--<td>{{$row->_id}}</td>--}}
|
||||||
@foreach($columns as $col)
|
@foreach($columns as $col)
|
||||||
<td>{{ $row->{$col->name} }}</td>
|
<td>{{ $row->{$col->name} }}</td>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|||||||
@@ -12,21 +12,26 @@
|
|||||||
@if(guest() || !user()->confirmed || user()->ownsTable($table))
|
@if(guest() || !user()->confirmed || user()->ownsTable($table))
|
||||||
{{-- Guest, unconfirmed, or a table owner --}}
|
{{-- Guest, unconfirmed, or a table owner --}}
|
||||||
|
|
||||||
|
@if(FEATURE_FORKS)
|
||||||
{{-- Passive fork buttons with counter --}}
|
{{-- Passive fork buttons with counter --}}
|
||||||
<a href="" class="btn btn-outline-primary py-1 btn-sm" @tooltip(Forks)>
|
<a href="" class="btn btn-outline-primary py-1 btn-sm" @tooltip(Forks)>
|
||||||
@icon(fa-code-fork, sr:Forks)
|
@icon(fa-code-fork, sr:Forks)
|
||||||
{{ $table->forks_count ?: '–' }}
|
{{ $table->forks_count ?: '–' }}
|
||||||
</a>
|
</a>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if(FEATURE_FAVES)
|
||||||
{{-- Passive favourite buttons with counter --}}
|
{{-- Passive favourite buttons with counter --}}
|
||||||
<a href="" class="btn btn-outline-primary py-1 btn-sm" @tooltip(Favourites)>
|
<a href="" class="btn btn-outline-primary py-1 btn-sm" @tooltip(Favourites)>
|
||||||
@icon(fa-star, sr:Favourites)
|
@icon(fa-star, sr:Favourites)
|
||||||
{{ $table->favourites_count ?: '–' }}
|
{{ $table->favourites_count ?: '–' }}
|
||||||
</a>
|
</a>
|
||||||
|
@endif
|
||||||
|
|
||||||
@else
|
@else
|
||||||
{{-- Logged in and does not own the table --}}
|
{{-- Logged in and does not own the table --}}
|
||||||
|
|
||||||
|
@if(FEATURE_FORKS)
|
||||||
{{-- Active fork button | counter --}}
|
{{-- Active fork button | counter --}}
|
||||||
<div class="btn-group" role="group" aria-label="Fork">
|
<div class="btn-group" role="group" aria-label="Fork">
|
||||||
<a href="" class="btn btn-outline-primary py-1 btn-sm btn-square" @tooltip(Fork)>
|
<a href="" class="btn btn-outline-primary py-1 btn-sm btn-square" @tooltip(Fork)>
|
||||||
@@ -36,7 +41,9 @@
|
|||||||
{{ $table->forks_count ?: '–' }}
|
{{ $table->forks_count ?: '–' }}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if(FEATURE_FAVES)
|
||||||
{{-- Active favourite button | counter --}}
|
{{-- Active favourite button | counter --}}
|
||||||
<div class="btn-group" role="group" aria-label="Favourite">
|
<div class="btn-group" role="group" aria-label="Favourite">
|
||||||
@if(user()->favouritesTable($table))
|
@if(user()->favouritesTable($table))
|
||||||
@@ -52,20 +59,25 @@
|
|||||||
{{ $table->favourites_count ?: '–' }}
|
{{ $table->favourites_count ?: '–' }}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
@if(FEATURE_TABLE_COMMENTS)
|
||||||
{{-- Comments button with counter --}}
|
{{-- Comments button with counter --}}
|
||||||
<a href="" class="btn btn-outline-primary py-1 btn-sm" @tooltip(Comments)>
|
<a href="" class="btn btn-outline-primary py-1 btn-sm" @tooltip(Comments)>
|
||||||
@icon(fa-comment, sr:Comments)
|
@icon(fa-comment, sr:Comments)
|
||||||
{{ $table->comments_count ?: '–' }}
|
{{ $table->comments_count ?: '–' }}
|
||||||
</a>
|
</a>
|
||||||
|
@endif
|
||||||
|
|
||||||
{{-- Active proposals button | counter --}}
|
{{-- Active proposals button | counter --}}
|
||||||
<div class="btn-group" role="group" aria-label="Fork">
|
<div class="btn-group" role="group" aria-label="Fork">
|
||||||
|
@if(FEATURE_PROPOSALS)
|
||||||
<a href="" class="btn btn-outline-primary py-1 btn-sm" @tooltip(Change Proposals)>
|
<a href="" class="btn btn-outline-primary py-1 btn-sm" @tooltip(Change Proposals)>
|
||||||
@icon(fa-inbox fa-pr, sr:Change Proposals){{ $table->proposals_count ?: '–' }}
|
@icon(fa-inbox fa-pr, sr:Change Proposals){{ $table->proposals_count ?: '–' }}
|
||||||
</a>
|
</a>
|
||||||
|
@endif
|
||||||
@auth
|
@auth
|
||||||
@if(user()->ownsTable($table))
|
@if(user()->ownsTable($table))
|
||||||
{{-- Table owner logged in --}}
|
{{-- Table owner logged in --}}
|
||||||
@@ -73,10 +85,12 @@
|
|||||||
@icon(fa-pencil, sr:Draft Change)
|
@icon(fa-pencil, sr:Draft Change)
|
||||||
</a>
|
</a>
|
||||||
@else
|
@else
|
||||||
|
@if(FEATURE_PROPOSALS)
|
||||||
{{-- Not a table owner --}}
|
{{-- Not a table owner --}}
|
||||||
<a href="{{ $table->draftRoute }}" class="btn btn-outline-primary py-1 btn-sm btn-square" @tooltip(Propose Change)>
|
<a href="{{ $table->draftRoute }}" class="btn btn-outline-primary py-1 btn-sm btn-square" @tooltip(Propose Change)>
|
||||||
@icon(fa-pencil, sr:Propose Change)
|
@icon(fa-pencil, sr:Propose Change)
|
||||||
</a>
|
</a>
|
||||||
|
@endif
|
||||||
@endif
|
@endif
|
||||||
@endauth
|
@endauth
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user