add table count to user list, padding to help bubble, better date formatting and tooltip

pull/26/head
Ondřej Hruška 6 years ago
parent 550cf30654
commit ffc5a42252
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 3
      app/Http/Controllers/DashController.php
  2. 7
      app/Http/Controllers/ProfileController.php
  3. 3
      app/Models/Table.php
  4. 6
      resources/assets/sass/app.scss
  5. 2
      resources/views/_greeter.blade.php
  6. 2
      resources/views/form/_help-inner.blade.php
  7. 14
      resources/views/profile/view.blade.php
  8. 14
      resources/views/table/view.blade.php
  9. 17
      resources/views/welcome.blade.php

@ -21,7 +21,8 @@ class DashController extends Controller
} }
$users = User::orderBy('updated_at', 'desc') $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 // TODO visit counting
$tables = Table::forList() $tables = Table::forList()

@ -19,8 +19,13 @@ class ProfileController extends Controller
public function view(User $user) public function view(User $user)
{ {
$tables = $user->tables()->forList()->orderByDesc('updated_at')->paginate(10); $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'
));
} }
/** /**

@ -132,6 +132,7 @@ class Table extends Model
public function scopeForList(Builder $query) 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']);
} }
} }

@ -20,3 +20,9 @@ html {
@import "bootstrap-customizations/button"; @import "bootstrap-customizations/button";
@import "bootstrap-customizations/responsive"; @import "bootstrap-customizations/responsive";
@import "bootstrap-customizations/typography"; @import "bootstrap-customizations/typography";
.bio-table {
td {
padding-top: $sp1;
}
}

@ -12,7 +12,7 @@
<p> <p>
This website is a place for sharing useful tables of structured data. This website is a place for sharing useful tables of structured data.
These can be cipher tables, character maps, lists of electronic components, 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. 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 Anything you can put in a table can be shared here, as long as it conforms to our
<a href="{{route('terms')}}">Terms of Service</a>. You can search, filter, and export <a href="{{route('terms')}}">Terms of Service</a>. You can search, filter, and export

@ -1,5 +1,5 @@
@if($help) @if($help)
<i class="fa-question-circle form-help" <i class="fa-question-circle form-help pr-1"
data-toggle="tooltip" data-toggle="tooltip"
data-placement="right" data-placement="right"
@if(false!==strpos($help, '<')) @if(false!==strpos($help, '<'))

@ -35,7 +35,7 @@
</div> </div>
@endif @endif
<table> <table class="bio-table">
<tbody> <tbody>
@if($user->website) @if($user->website)
<tr> <tr>
@ -49,9 +49,19 @@
<td>{{ $user->handle }}</td> <td>{{ $user->handle }}</td>
</tr> </tr>
<tr>
<td class="text-center pr-2">@icon(fa-table, Tables:)</td>
<td>{{ $tables_count }} table{{$tables_count!=1?'s':''}}</td>
</tr>
<tr> <tr>
<td class="text-center pr-2">@icon(fa-calendar, Join date:)</td> <td class="text-center pr-2">@icon(fa-calendar, Join date:)</td>
<td>Joined {{ $user->created_at->diffForHumans() }}</td> <td>
<span class="pr-1" data-toggle="tooltip" data-placement="right"
title="{{ $user->created_at->format('M n, Y \\a\\t G:i') }}">
Joined {{ $user->created_at->diffForHumans() }}
</span>
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

@ -82,12 +82,16 @@
{{-- Description field --}} {{-- Description field --}}
<div class="col-md-8 pl-md-0"> <div class="col-md-8 pl-md-0">
@if($table->description)
<b>Description</b> <b>Description</b>
@if($table->description)
{!! Widget::collapsible($table->description, 400, '8em') !!} {!! Widget::collapsible($table->description, 400, '8em') !!}
@if($table->origin) @if($table->origin)
<div class="mt-2"></div>{{-- spacer --}} <div class="mt-2"></div>{{-- spacer --}}
@endif @endif
@else
<p>
<i>No description.</i>
</p>
@endif @endif
@if($table->origin) @if($table->origin)
@ -119,8 +123,8 @@
<tr> <tr>
<th class="text-right pr-2">Created</th> <th class="text-right pr-2">Created</th>
<td> <td>
<span data-toggle="tooltip" data-placement="right" title="{{ $table->created_at->format("G:i:s") }}"> <span class="pr-1" data-toggle="tooltip" data-placement="right" title="{{ $table->created_at->format("M n, Y \\a\\t G:i") }}">
{{ $table->created_at->format("M j, Y") }} {{ $table->created_at->diffForHumans() }}
</span> </span>
</td> </td>
</tr> </tr>
@ -128,8 +132,8 @@
<tr> <tr>
<th class="text-right pr-2">Updated</th> <th class="text-right pr-2">Updated</th>
<td> <td>
<span data-toggle="tooltip" data-placement="right" title="{{ $table->updated_at->format("G:i:s") }}"> <span class="pr-1" data-toggle="tooltip" data-placement="right" title="{{ $table->updated_at->format("M n, Y \\a\\t G:i") }}">
{{ $table->updated_at->format("M j, Y") }} {{ $table->updated_at->diffForHumans() }}
</span> </span>
</td> </td>
</tr> </tr>

@ -4,7 +4,7 @@
@section('content') @section('content')
@if($showGreeter) @if($showGreeter)
@include('greeter') @include('_greeter')
@endif @endif
<div class="row justify-content-center"> <div class="row justify-content-center">
@ -24,9 +24,14 @@
<span class="list-group-item">No users yet.</span> <span class="list-group-item">No users yet.</span>
@else @else
@foreach($users as $user) @foreach($users as $user)
<a class="list-group-item list-group-item-action" <a class="list-group-item list-group-item-action" href="{{ route('profile.view', $user->name) }}">
href="{{ route('profile.view', $user->name) }}"> <span class="d-flex">
@icon(fa-user-circle-o fa-pr){{ $user->title }}<br> @icon(fa-user-circle-o fa-pr)
<span class="flex-grow-1">{{ $user->title }}</span>
<span>
{{ $user->tables_count }} table{{$user->tables_count!=1?'s':''}}
</span>
</span>
<small>{{ $user->handle }}</small> <small>{{ $user->handle }}</small>
</a> </a>
@endforeach @endforeach
@ -44,6 +49,10 @@
<nav class="ml-auto" aria-label="Pages of the table list"> <nav class="ml-auto" aria-label="Pages of the table list">
{{ $tables->links(null, ['ulClass' => 'pagination-sm mb-0 pagination-outline-light']) }} {{ $tables->links(null, ['ulClass' => 'pagination-sm mb-0 pagination-outline-light']) }}
</nav> </nav>
@if(authed())
<a href="{{route('table.create')}}" class="btn ml-3" aria-label="New Table">New</a>
@endif
</div> </div>
@include('profile._table-list', ['showAuthors' => true]) @include('profile._table-list', ['showAuthors' => true])

Loading…
Cancel
Save