Hide unimplemented feature buttons and indicators with feature flags

pull/35/head
Ondřej Hruška 6 years ago
parent aceb0453fc
commit c642774316
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 5
      app/helpers.php
  2. 33
      resources/views/profile/_table-list.blade.php
  3. 4
      resources/views/table/_rows.blade.php
  4. 14
      resources/views/table/_view-action-buttons.blade.php

@ -6,6 +6,11 @@ const VALI_EMAIL = 'string|email|max:255';
const VALI_TEXT = 'string|max:4095';
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
function authed() {
return ! \Auth::guest();

@ -24,24 +24,31 @@
@icon(fa-table fa-pr){!!
$showAuthors ? (e($table->owner->handle) . '<span class="px-1">/</span>') : ''
!!}<b>{{ $table->title }}</b>
</span>{{--
--}}<div class="d-block col-5 small text-right">{{--
--}}<span title="Visits" class="d-inline-block pl-2" style="min-width: 50px;">
</span>
<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;">
{{ $table->visits }}@icon(fa-eye fa-pl, ~Visits~~)
</span>{{--
--}}{{--<span title="Forks" class="d-inline-block pl-2 {{$forks==0?'hidden':''}}" style="min-width: 50px;">
</span>
@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~~)
</span>--}}{{--
--}}{{--<span title="Favourites" class="d-inline-block pl-2 {{$faves==0?'hidden':''}}" style="min-width: 50px;">
</span>
@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~~)
</span>--}}{{--
--}}{{--<span title="Revisions" class="d-inline-block pl-2" style="min-width: 50px;">
</span>
@endif
<span title="Revisions" class="d-inline-block pl-2" style="min-width: 50px;">
{{ $revs }}@icon(fa-history fa-pl, ~Revisions~~)
</span>--}}{{--
--}}<span title="Rows" class="d-inline-block pl-2" style="min-width: 50px;">
</span>
<span title="Rows" class="d-inline-block pl-2" style="min-width: 50px;">
{{ $rows }}@icon(fa-th-list fa-pl, ~Rows)
</span>{{--
--}}
</span>
</div>
</span>

@ -11,7 +11,7 @@
<table class="table table-hover table-sm">
<thead>
<tr>
<th>#</th>
{{--<th>#</th>--}}
@foreach($columns as $col)
<th title="{{$col->name}}">{{ $col->title }}</th>
@endforeach
@ -20,7 +20,7 @@
<tbody>
@foreach($rows as $row)
<tr>
<td>{{$row->_id}}</td>
{{--<td>{{$row->_id}}</td>--}}
@foreach($columns as $col)
<td>{{ $row->{$col->name} }}</td>
@endforeach

@ -12,21 +12,26 @@
@if(guest() || !user()->confirmed || user()->ownsTable($table))
{{-- Guest, unconfirmed, or a table owner --}}
@if(FEATURE_FORKS)
{{-- Passive fork buttons with counter --}}
<a href="" class="btn btn-outline-primary py-1 btn-sm" @tooltip(Forks)>
@icon(fa-code-fork, sr:Forks)&nbsp;
{{ $table->forks_count ?: '–' }}
</a>
@endif
@if(FEATURE_FAVES)
{{-- Passive favourite buttons with counter --}}
<a href="" class="btn btn-outline-primary py-1 btn-sm" @tooltip(Favourites)>
@icon(fa-star, sr:Favourites)&nbsp;
{{ $table->favourites_count ?: '–' }}
</a>
@endif
@else
{{-- Logged in and does not own the table --}}
@if(FEATURE_FORKS)
{{-- Active fork button | counter --}}
<div class="btn-group" role="group" aria-label="Fork">
<a href="" class="btn btn-outline-primary py-1 btn-sm btn-square" @tooltip(Fork)>
@ -36,7 +41,9 @@
{{ $table->forks_count ?: '–' }}
</a>
</div>
@endif
@if(FEATURE_FAVES)
{{-- Active favourite button | counter --}}
<div class="btn-group" role="group" aria-label="Favourite">
@if(user()->favouritesTable($table))
@ -52,20 +59,25 @@
{{ $table->favourites_count ?: '–' }}
</a>
</div>
@endif
@endif
@if(FEATURE_TABLE_COMMENTS)
{{-- Comments button with counter --}}
<a href="" class="btn btn-outline-primary py-1 btn-sm" @tooltip(Comments)>
@icon(fa-comment, sr:Comments)&nbsp;
{{ $table->comments_count ?: '–' }}
</a>
@endif
{{-- Active proposals button | counter --}}
<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)>
@icon(fa-inbox fa-pr, sr:Change Proposals){{ $table->proposals_count ?: '–' }}
</a>
@endif
@auth
@if(user()->ownsTable($table))
{{-- Table owner logged in --}}
@ -73,10 +85,12 @@
@icon(fa-pencil, sr:Draft Change)
</a>
@else
@if(FEATURE_PROPOSALS)
{{-- Not a table owner --}}
<a href="{{ $table->draftRoute }}" class="btn btn-outline-primary py-1 btn-sm btn-square" @tooltip(Propose Change)>
@icon(fa-pencil, sr:Propose Change)
</a>
@endif
@endif
@endauth
</div>

Loading…
Cancel
Save