Revert "Bookstack grid view."

This commit is contained in:
Abijeet 2017-07-07 17:28:34 +05:30 committed by GitHub
parent a663fc8aa8
commit 3fd61a3600
27 changed files with 29 additions and 179 deletions

View File

@ -3,7 +3,7 @@
class Book extends Entity
{
protected $fillable = ['name', 'description', 'image'];
protected $fillable = ['name', 'description'];
/**
* Get the url for this book.
@ -18,24 +18,6 @@ class Book extends Entity
return baseUrl('/books/' . urlencode($this->slug));
}
public function getBookCover($size = 120)
{
$default = baseUrl('/default.png');
$image = $this->image;
if ($image === 0 || $image === '0' || $image === null)
return $default;
try {
$cover = $this->cover ? baseUrl($this->cover->getThumb(120, 192, false)) : $default;
} catch (\Exception $err) {
$cover = $default;
}
return $cover;
}
public function cover()
{
return $this->belongsTo(Image::class, 'image');
}
/*
* Get the edit url for this book.
* @return string

View File

@ -39,9 +39,9 @@ class BookController extends Controller
$books = $this->entityRepo->getAllPaginated('book', 16);
$recents = $this->signedIn ? $this->entityRepo->getRecentlyViewed('book', 4, 0) : false;
$popular = $this->entityRepo->getPopular('book', 3, 0);
$books_display = $this->currentUser->books_display;
$display = $this->currentUser->display;
$this->setPageTitle('Books');
return view('books/index', ['books' => $books, 'recents' => $recents, 'popular' => $popular, 'books_display' => $books_display] );
return view('books/index', ['books' => $books, 'recents' => $recents, 'popular' => $popular, 'display' => $display]); //added displaly to access user display
}
/**
@ -115,9 +115,9 @@ class BookController extends Controller
'name' => 'required|string|max:255',
'description' => 'string|max:1000'
]);
$book = $this->entityRepo->updateFromInput('book', $book, $request->all());
Activity::add($book, 'book_update', $book->id);
return redirect($book->getUrl());
$book = $this->entityRepo->updateFromInput('book', $book, $request->all());
Activity::add($book, 'book_update', $book->id);
return redirect($book->getUrl());
}
/**

View File

@ -22,7 +22,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
* The attributes that are mass assignable.
* @var array
*/
protected $fillable = ['name', 'email', 'image_id', 'books_display' ];
protected $fillable = ['name', 'email', 'image_id'];
/**
* The attributes excluded from the model's JSON form.

View File

@ -1,40 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddCoverImageDisplay extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->string('books_display',10)->default('grid');
});
Schema::table('books', function (Blueprint $table) {
$table->integer('image');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('books_display');
});
Schema::table('books', function (Blueprint $table) {
$table->dropColumn('image');
});
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -153,13 +153,6 @@ $('[data-action="expand-entity-list-details"]').click(function() {
$('.entity-list.compact').find('p').not('.empty-text').slideToggle(240);
});
// Toggle thumbnails
$(document).ready(function(){
$('[data-action="expand-thumbnail"]').click(function(){
$('.galleryItem').toggleClass("collapse").find('img').slideToggle(50);
});
});
// Popup close
$('.popup-close').click(function() {
$(this).closest('.overlay').fadeOut(240);

View File

@ -63,11 +63,6 @@ body.dragging, body.dragging * {
&.square {
border-radius: 3px;
}
&.cover {
height: 192px;
width: 120px;
border-radius: 3px;
}
}
// System wide notifications
@ -279,25 +274,5 @@ $btt-size: 40px;
}
}
.galleryItem {
margin-bottom: 32px;
height: 330px;
overflow: hidden;
border: 1px solid #9e9e9e;
h3 {
font-size: 1.2em;
text-align: center;
}
p {
font-size: 0.8em;
text-align: center;
}
img {
height: 192px;
width: 120px;
margin-top: 5%;
}
&.collapse {
height: 130px;
}
}

View File

@ -17,7 +17,6 @@ return [
'name' => 'Name',
'description' => 'Beschreibung',
'role' => 'Rolle',
'cover_image' => 'Titelbild',
/**
* Actions
@ -44,7 +43,7 @@ return [
'no_items' => 'Keine Eintr&auml;ge gefunden.',
'back_to_top' => 'nach oben',
'toggle_details' => 'Details zeigen/verstecken',
'toggle_thumbnails' => 'Thumbnails zeigen/verstecken',
/**
* Header
*/

View File

@ -91,7 +91,6 @@ return [
'users_external_auth_id' => 'Externe Authentifizierungs-ID',
'users_password_warning' => 'F&uuml;llen Sie die folgenden Felder nur aus, wenn Sie Ihr Passwort &auml;ndern m&ouml;chten:',
'users_system_public' => 'Dieser Benutzer repr&auml;sentiert alle Gast-Benutzer, die diese Seite betrachten. Er kann nicht zum Anmelden benutzt werden, sondern wird automatisch zugeordnet.',
'users_books_display_type' => 'Wählen Sie die Art der Ansicht aus',
'users_delete' => 'Benutzer l&ouml;schen',
'users_delete_named' => 'Benutzer :userName l&ouml;schen',
'users_delete_warning' => 'Sie m&ouml;chten den Benutzer \':userName\' g&auml;nzlich aus dem System l&ouml;schen.',

View File

@ -17,7 +17,6 @@ return [
'name' => 'Name',
'description' => 'Description',
'role' => 'Role',
'cover_image' => 'Cover image',
/**
* Actions
@ -45,7 +44,6 @@ return [
'no_items' => 'No items available',
'back_to_top' => 'Back to top',
'toggle_details' => 'Toggle Details',
'toggle_thumbnails' => 'Toggle Thumbnails',
/**
* Header

View File

@ -91,7 +91,6 @@ return [
'users_external_auth_id' => 'External Authentication ID',
'users_password_warning' => 'Only fill the below if you would like to change your password:',
'users_system_public' => 'This user represents any guest users that visit your instance. It cannot be used to log in but is assigned automatically.',
'users_books_display_type' => 'Select the type of view',
'users_delete' => 'Delete User',
'users_delete_named' => 'Delete user :userName',
'users_delete_warning' => 'This will fully delete this user with the name \':userName\' from the system.',

View File

@ -17,7 +17,7 @@ return [
'name' => 'Nombre',
'description' => 'Descripción',
'role' => 'Rol',
'cover_image' => 'Imagen de portada',
/**
* Actions
*/
@ -43,7 +43,6 @@ return [
'no_items' => 'No hay items disponibles',
'back_to_top' => 'Volver arriba',
'toggle_details' => 'Alternar detalles',
'toggle_thumbnails' => 'Alternar miniaturas',
/**
* Header

View File

@ -91,7 +91,6 @@ return [
'users_external_auth_id' => 'ID externo de autenticación',
'users_password_warning' => 'Solo rellene a continuación si desea cambiar su password:',
'users_system_public' => 'Este usuario representa cualquier usuario invitado que visita la aplicación. No puede utilizarse para hacer login sio que es asignado automáticamente.',
'users_books_display_type' => 'Seleccione el tipo de vista',
'users_delete' => 'Borrar usuario',
'users_delete_named' => 'Borrar usuario :userName',
'users_delete_warning' => 'Se borrará completamente el usuario con el nombre \':userName\' del sistema.',

View File

@ -17,7 +17,7 @@ return [
'name' => 'Nom',
'description' => 'Description',
'role' => 'Rôle',
'cover_image' => 'Image de couverture',
/**
* Actions
*/
@ -43,7 +43,6 @@ return [
'no_items' => 'Aucun élément',
'back_to_top' => 'Retour en haut',
'toggle_details' => 'Afficher les détails',
'toggle_thumbnails' => 'Afficher les vignettes',
/**
* Header

View File

@ -91,7 +91,6 @@ return [
'users_external_auth_id' => 'Identifiant d\'authentification externe',
'users_password_warning' => 'Remplissez ce fomulaire uniquement si vous souhaitez changer de mot de passe:',
'users_system_public' => 'Cet utilisateur représente les invités visitant votre instance. Il est assigné automatiquement aux invités.',
'users_books_display_type' => 'Sélectionnez le type de vue',
'users_delete' => 'Supprimer un utilisateur',
'users_delete_named' => 'Supprimer l\'utilisateur :userName',
'users_delete_warning' => 'Ceci va supprimer \':userName\' du système.',

View File

@ -17,7 +17,7 @@ return [
'name' => 'Naam',
'description' => 'Beschrijving',
'role' => 'Rol',
'cover_image' => 'Omslagfoto',
/**
* Actions
*/
@ -43,7 +43,6 @@ return [
'no_items' => 'Geen items beschikbaar',
'back_to_top' => 'Terug naar boven',
'toggle_details' => 'Details Weergeven',
'toggle_thumbnails' => 'Thumbnails Weergeven',
/**
* Header

View File

@ -91,7 +91,6 @@ return [
'users_external_auth_id' => 'External Authentication ID',
'users_password_warning' => 'Vul onderstaande formulier alleen in als je het wachtwoord wilt aanpassen:',
'users_system_public' => 'De eigenschappen van deze gebruiker worden voor elke gastbezoeker gebruikt. Er kan niet mee ingelogd worden en wordt automatisch toegewezen.',
'users_books_display_type' => 'Selecteer het type weergave',
'users_delete' => 'Verwijder gebruiker',
'users_delete_named' => 'Verwijder gebruiker :userName',
'users_delete_warning' => 'Dit zal de gebruiker \':userName\' volledig uit het systeem verwijderen.',

View File

@ -17,7 +17,7 @@ return [
'name' => 'Nome',
'description' => 'Descrição',
'role' => 'Regra',
'cover_image' => 'Imagem de capa',
/**
* Actions
*/
@ -43,7 +43,6 @@ return [
'no_items' => 'Nenhum item disponível',
'back_to_top' => 'Voltar ao topo',
'toggle_details' => 'Alternar Detalhes',
'toggle_thumbnails' => 'Alternar Miniaturas',
/**
* Header

View File

@ -91,7 +91,6 @@ return [
'users_external_auth_id' => 'ID de Autenticação Externa',
'users_password_warning' => 'Preencha os dados abaixo caso queira modificar a sua senha:',
'users_system_public' => 'Esse usuário representa quaisquer convidados que visitam o aplicativo. Ele não pode ser usado para login.',
'users_books_display_type' => 'Selecione o tipo de exibição',
'users_delete' => 'Excluir Usuário',
'users_delete_named' => 'Excluir :userName',
'users_delete_warning' => 'A ação vai excluir completamente o usuário de nome \':userName\' do sistema.',

View File

@ -17,7 +17,7 @@ return [
'name' => 'Meno',
'description' => 'Popis',
'role' => 'Rola',
'cover_image' => 'Obal knihy',
/**
* Actions
*/
@ -43,7 +43,6 @@ return [
'no_items' => 'Žiadne položky nie sú dostupné',
'back_to_top' => 'Späť nahor',
'toggle_details' => 'Prepnúť detaily',
'toggle_thumbnails' => 'Prepnúť náhľady',
/**
* Header

View File

@ -91,7 +91,6 @@ return [
'users_external_auth_id' => 'Externé autentifikačné ID',
'users_password_warning' => 'Pole nižšie vyplňte iba ak chcete zmeniť heslo:',
'users_system_public' => 'Tento účet reprezentuje každého hosťovského používateľa, ktorý navštívi Vašu inštanciu. Nedá sa pomocou neho prihlásiť a je priradený automaticky.',
'users_books_display_type' => 'Vyberte typ zobrazenia',
'users_delete' => 'Zmazať používateľa',
'users_delete_named' => 'Zmazať používateľa :userName',
'users_delete_warning' => ' Toto úplne odstráni používateľa menom \':userName\' zo systému.',

View File

@ -4,10 +4,9 @@
<div class="container small" ng-non-bindable>
<h1>{{ trans('entities.books_create') }}</h1>
<form action="{{ baseUrl("/books") }}" method="POST" enctype="multipart/form-data">
<form action="{{ baseUrl("/books") }}" method="POST">
@include('books/form')
</form>
</div>
<p class="margin-top large"><br></p>
@include('components.image-manager', ['imageType' => 'cover'])
@stop

View File

@ -19,5 +19,5 @@
@include('books/form', ['model' => $book])
</form>
</div>
@include('components.image-manager', ['imageType' => 'cover'])
@stop

View File

@ -9,21 +9,7 @@
<label for="description">{{ trans('common.description') }}</label>
@include('form/textarea', ['name' => 'description'])
</div>
<div class="form-group" id="logo-control">
<label for="user-avatar">{{ trans('common.cover_image') }}</label>
<p class="small">{{ trans('common.cover_image_description') }}</p>
@include('components.image-picker', [
'resizeHeight' => '192',
'resizeWidth' => '120',
'showRemove' => true,
'defaultImage' => baseUrl('/default.png'),
'currentImage' => @isset($model) ? $model->getBookCover(80) : baseUrl('/default.png') ,
'currentId' => @isset($model) ? $model->image : 0,
'name' => 'image',
'imageClass' => 'avatar cover'
])
</div>
<div class="form-group">
<a href="{{ isset($book) ? $book->getUrl() : baseUrl('/books') }}" class="button muted">{{ trans('common.cancel') }}</a>
<button type="submit" class="button pos">{{ trans('entities.books_save') }}</button>

View File

@ -1,15 +0,0 @@
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3" data-entity-type="book" data-entity-id="{{$book->id}}">
<div class="galleryItem">
<h3>
<a class="text-book entity-list-item-link" href="{{$book->getUrl()}}"><i class="zmdi zmdi-book"></i><span class="entity-list-item-name">{{$book->name}}</span>
<br>
<img src="{{$book->getBookCover(192)}}" alt="{{$book->name}}">
</a>
</h3>
@if(isset($book->searchSnippet))
<p class="text-muted">{!! $book->searchSnippet !!}</p>
@else
<p class="text-muted">{{ $book->getExcerpt() }}</p>
@endif
</div>
</div>

View File

@ -5,13 +5,13 @@
<div class="faded-small toolbar">
<div class="container">
<div class="row">
<div class="col-xs-12 faded">
<div class="action-buttons text-left">
<a data-action="expand-thumbnail" class="text-primary text-button"><i class="zmdi zmdi-wrap-text"></i>{{ trans('common.toggle_thumbnails') }}</a>
<div class="col-xs-1"></div>
<div class="col-xs-11 faded">
<div class="action-buttons">
@if($currentUser->can('book-create-all'))
<a href="{{ baseUrl("/books/create") }}" class="text-pos text-button"><i class="zmdi zmdi-plus"></i>{{ trans('entities.books_create') }}</a>
@endif
</div>
</div>
</div>
</div>
</div>
@ -20,22 +20,14 @@
<div class="container" ng-non-bindable>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-9">
<div class="col-sm-7">
<h1>{{ trans('entities.books') }}</h1>
@if(count($books) > 0)
@if($books_display=='grid')
@foreach($books as $book)
@include('books/grid-item', ['book' => $book])
@endforeach
<div class="col-xs-12">
{!! $books->render() !!}
</div>
@else
@foreach($books as $book)
@include('books/list-item', ['book' => $book])
@endforeach
{!! $books->render() !!}
@endif
@foreach($books as $book)
@include('books/list-item', ['book' => $book])
<hr>
@endforeach
{!! $books->render() !!}
@else
<p class="text-muted">{{ trans('entities.books_empty') }}</p>
@if(userCan('books-create-all'))
@ -43,7 +35,7 @@
@endif
@endif
</div>
<div class="col-xs-12 col-sm-12 col-md-3">
<div class="col-sm-4 col-sm-offset-1">
<div id="recents">
@if($recents)
<div class="margin-top">&nbsp;</div>

View File

@ -49,13 +49,6 @@
@endforeach
</select>
</div>
<div class="form-group">
<label for="books_display">{{ trans('settings.users_books_display_type') }}</label>
<select name="books_display" id="books_display">
<option @if($user->books_display === 'grid') selected @endif value="grid">Grid</option>
<option @if($user->books_display === 'list') selected @endif value="list">List</option>
</select>
</div>
</div>
</div>
<div class="form-group">