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')
->paginate(15, ['id', 'title', 'name'], 'pageu');
->withCount(['tables'])
->paginate(15, ['id', 'title', 'name', 'tables_count'], 'pageu');
// TODO visit counting
$tables = Table::forList()

@ -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'
));
}
/**

@ -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']);
}
}

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

@ -12,7 +12,7 @@
<p>
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
<a href="{{route('terms')}}">Terms of Service</a>. You can search, filter, and export

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

@ -35,7 +35,7 @@
</div>
@endif
<table>
<table class="bio-table">
<tbody>
@if($user->website)
<tr>
@ -49,9 +49,19 @@
<td>{{ $user->handle }}</td>
</tr>
<tr>
<td class="text-center pr-2">@icon(fa-table, Tables:)</td>
<td>{{ $tables_count }} table{{$tables_count!=1?'s':''}}</td>
</tr>
<tr>
<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>
</tbody>
</table>

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

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

Loading…
Cancel
Save