From ffc5a42252437281970e7a112a360dbb08796153 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Sun, 29 Jul 2018 13:31:05 +0200 Subject: [PATCH] add table count to user list, padding to help bubble, better date formatting and tooltip --- app/Http/Controllers/DashController.php | 3 ++- app/Http/Controllers/ProfileController.php | 7 ++++++- app/Models/Table.php | 3 ++- resources/assets/sass/app.scss | 6 ++++++ .../{greeter.blade.php => _greeter.blade.php} | 2 +- resources/views/form/_help-inner.blade.php | 2 +- resources/views/profile/view.blade.php | 14 ++++++++++++-- resources/views/table/view.blade.php | 14 +++++++++----- resources/views/welcome.blade.php | 17 +++++++++++++---- 9 files changed, 52 insertions(+), 16 deletions(-) rename resources/views/{greeter.blade.php => _greeter.blade.php} (94%) diff --git a/app/Http/Controllers/DashController.php b/app/Http/Controllers/DashController.php index dbf25c7..a406238 100644 --- a/app/Http/Controllers/DashController.php +++ b/app/Http/Controllers/DashController.php @@ -21,7 +21,8 @@ class DashController extends Controller } $users = User::orderBy('updated_at', 'desc') - ->paginate(15, ['id', 'title', 'name'], 'pageu'); + ->withCount(['tables']) + ->paginate(15, ['id', 'title', 'name', 'tables_count'], 'pageu'); // TODO visit counting $tables = Table::forList() diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index 6149be5..1306d12 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -19,8 +19,13 @@ class ProfileController extends Controller public function view(User $user) { $tables = $user->tables()->forList()->orderByDesc('updated_at')->paginate(10); + $tables_count = $user->tables()->count(); - return view('profile.view')->with(compact('tables', 'user')); + return view('profile.view')->with(compact( + 'tables', + 'user', + 'tables_count' + )); } /** diff --git a/app/Models/Table.php b/app/Models/Table.php index 4fac554..b3ea9ca 100644 --- a/app/Models/Table.php +++ b/app/Models/Table.php @@ -132,6 +132,7 @@ class Table extends Model public function scopeForList(Builder $query) { - return $query->with('revision:id,row_count')->withCount(['favourites', 'forks', 'revisions']); + return $query->with('revision:id,row_count')->with('owner:id,name,title') + ->withCount(['favourites', 'forks', 'revisions']); } } diff --git a/resources/assets/sass/app.scss b/resources/assets/sass/app.scss index f4e694f..e93ce8f 100644 --- a/resources/assets/sass/app.scss +++ b/resources/assets/sass/app.scss @@ -20,3 +20,9 @@ html { @import "bootstrap-customizations/button"; @import "bootstrap-customizations/responsive"; @import "bootstrap-customizations/typography"; + +.bio-table { + td { + padding-top: $sp1; + } +} diff --git a/resources/views/greeter.blade.php b/resources/views/_greeter.blade.php similarity index 94% rename from resources/views/greeter.blade.php rename to resources/views/_greeter.blade.php index 4089ba7..a67da82 100644 --- a/resources/views/greeter.blade.php +++ b/resources/views/_greeter.blade.php @@ -12,7 +12,7 @@

This website is a place for sharing useful tables of structured data. These can be cipher tables, character maps, lists of electronic components, - paper grades, page formats, or scientific datasets, such as lists of countries, + page formats, Pokémon attributes, or scientific datasets, such as lists of countries, geographic features, celestial bodies, elements, nutrition values, etc. Anything you can put in a table can be shared here, as long as it conforms to our Terms of Service. You can search, filter, and export diff --git a/resources/views/form/_help-inner.blade.php b/resources/views/form/_help-inner.blade.php index eda81fe..d2c396a 100644 --- a/resources/views/form/_help-inner.blade.php +++ b/resources/views/form/_help-inner.blade.php @@ -1,5 +1,5 @@ @if($help) - @endif - +
@if($user->website) @@ -49,9 +49,19 @@ + + + + + - +
{{ $user->handle }}
@icon(fa-table, Tables:){{ $tables_count }} table{{$tables_count!=1?'s':''}}
@icon(fa-calendar, Join date:)Joined {{ $user->created_at->diffForHumans() }} + + Joined {{ $user->created_at->diffForHumans() }} + +
diff --git a/resources/views/table/view.blade.php b/resources/views/table/view.blade.php index 64ba806..86c703e 100644 --- a/resources/views/table/view.blade.php +++ b/resources/views/table/view.blade.php @@ -82,12 +82,16 @@ {{-- Description field --}}

+ Description @if($table->description) - Description {!! Widget::collapsible($table->description, 400, '8em') !!} @if($table->origin)
{{-- spacer --}} @endif + @else +

+ No description. +

@endif @if($table->origin) @@ -119,8 +123,8 @@ Created - - {{ $table->created_at->format("M j, Y") }} + + {{ $table->created_at->diffForHumans() }} @@ -128,8 +132,8 @@ Updated - - {{ $table->updated_at->format("M j, Y") }} + + {{ $table->updated_at->diffForHumans() }} diff --git a/resources/views/welcome.blade.php b/resources/views/welcome.blade.php index 0d5aef6..21e9a27 100644 --- a/resources/views/welcome.blade.php +++ b/resources/views/welcome.blade.php @@ -4,7 +4,7 @@ @section('content') @if($showGreeter) - @include('greeter') + @include('_greeter') @endif
@@ -24,9 +24,14 @@ No users yet. @else @foreach($users as $user) - - @icon(fa-user-circle-o fa-pr){{ $user->title }}
+
+ + @icon(fa-user-circle-o fa-pr) + {{ $user->title }} + + {{ $user->tables_count }} table{{$user->tables_count!=1?'s':''}} + + {{ $user->handle }} @endforeach @@ -44,6 +49,10 @@ + + @if(authed()) + New + @endif
@include('profile._table-list', ['showAuthors' => true])