Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
6557fbb
commit
nileshdeepak Jun 28, 2017
8924618
test
nileshdeepak Jun 28, 2017
af72f0d
Bookstack grid view.
nileshdeepak Jun 29, 2017
fdf139e
Changing column size for responsiveness
nileshdeepak Jul 4, 2017
bce5fdd
Merge branch 'master' into issue-181
nileshdeepak Jul 4, 2017
947c58f
Applied required changes in BookStack.
nileshdeepak Jul 5, 2017
d99fd1f
Applied required changes
nileshdeepak Jul 5, 2017
bb2d859
Removed duplicated styles.
nileshdeepak Jul 5, 2017
d089eaf
Changes in User edit profile page.
nileshdeepak Jul 5, 2017
e10d4b9
styles.scss
nileshdeepak Jul 5, 2017
026de8c
Thumbnail toggle function.
nileshdeepak Jul 5, 2017
6eccb3d
Adding new migration.
nileshdeepak Jul 5, 2017
e88a062
Updated toggle thumbnails function.
nileshdeepak Jul 5, 2017
cc553cc
Added labels for 'Thumbnail toggle' and 'Cover image' in different la…
nileshdeepak Jul 5, 2017
5b736c3
Updated views to support different languages.
nileshdeepak Jul 5, 2017
6ad24a6
Changed public getImageURL function to private.
nileshdeepak Jul 5, 2017
f51db4b
Resolved responsiveness issues
nileshdeepak Jul 5, 2017
16a09e8
Deletion of image file on book deletion.
nileshdeepak Jul 6, 2017
c5f11e4
Fixed pagination on change of display type.
nileshdeepak Jul 6, 2017
144a6e4
Updated cover image upload and delete function.
nileshdeepak Jul 7, 2017
d84315f
Indentation correction.
nileshdeepak Jul 7, 2017
a663fc8
Merge pull request #1 from OsmosysSoftware/issue-181
nileshdeepak Jul 7, 2017
3fd61a3
Revert "Bookstack grid view."
AbijeetP Jul 7, 2017
0ed3023
Merge pull request #3 from OsmosysSoftware/revert-1-issue-181
AbijeetP Jul 7, 2017
f0d914a
Merge pull request #5 from BookStackApp/master
AbijeetP Jul 12, 2017
844976c
Revert "Revert "Bookstack grid view.""
AbijeetP Jul 12, 2017
f3b2e0f
Merge pull request #7 from OsmosysSoftware/revert-3-revert-1-issue-181
AbijeetP Jul 12, 2017
7a724f9
Updated modifications.
nileshdeepak Jul 12, 2017
d37b398
Updates styles.
nileshdeepak Jul 12, 2017
24ee78c
Update.
nileshdeepak Jul 12, 2017
f375090
Merge pull request #8 from OsmosysSoftware/feature-181
AbijeetP Jul 12, 2017
e919cab
1. Thumbnail size when creating or editing book.
nileshdeepak Jul 13, 2017
b0ba1a4
2. Added classed col-xs-6 col-sm-4 col-md-4 col-lg-3 in grid-item.bla…
nileshdeepak Jul 13, 2017
ab6ff5f
3. New default.png
nileshdeepak Jul 13, 2017
afc1eca
4. Changed the border color of the gallery item to #ccc
nileshdeepak Jul 13, 2017
7f8351e
Removed avatar class from form.blade.php
nileshdeepak Jul 13, 2017
21a8df7
Merge pull request #9 from OsmosysSoftware/feature-181
AbijeetP Jul 13, 2017
8f3adcd
Cover image test case
nileshdeepak Jul 14, 2017
1fe8f13
Cover image test case
nileshdeepak Jul 14, 2017
6a6516d
Test for layout selection.
nileshdeepak Jul 15, 2017
1278a0b
Test for layout selection.
nileshdeepak Jul 15, 2017
fd36978
Test for layout selection.
nileshdeepak Jul 15, 2017
1ed74b8
Test for grid and list layout selection.
nileshdeepak Jul 15, 2017
3435dcc
Merge pull request #10 from OsmosysSoftware/test-issue-181
AbijeetP Jul 15, 2017
832f8ea
Fixes the test case related to UserProfileTest.
AbijeetP Jul 15, 2017
85fbe82
Adding getHeadingExcerpt to get heading.
nileshdeepak Jul 15, 2017
e5dc0e6
Merge branch 'master' of https://github.com/OsmosysSoftware/BookStack
nileshdeepak Jul 15, 2017
dd4d2f4
Resolves book heading issues in grid view.
nileshdeepak Jul 15, 2017
9872767
Test for cover image upload
nileshdeepak Jul 15, 2017
b4044e6
Resolves heading issues in grid view
nileshdeepak Jul 15, 2017
770f30c
Test books display options.
nileshdeepak Jul 15, 2017
0c70416
Test books display options.
nileshdeepak Jul 15, 2017
922964e
Changes grid container size
nileshdeepak Jul 15, 2017
6d66c38
Fixes issues with the test case, now creating a user with the require…
AbijeetP Jul 15, 2017
a488ef6
Test for cover image.
nileshdeepak Jul 15, 2017
39b924f
Merge branch 'master' of https://github.com/OsmosysSoftware/BookStack
nileshdeepak Jul 15, 2017
3d808ac
Test for cover image
nileshdeepak Jul 15, 2017
854fd52
Resolving test cases
nileshdeepak Jul 15, 2017
a149e87
Resolving test cases
nileshdeepak Jul 15, 2017
a7d2cfd
Resolving test cases
nileshdeepak Jul 15, 2017
3079a9f
Reverted required changes.
nileshdeepak Jul 15, 2017
7f902e4
Resolved conflicts
Aug 24, 2017
6200948
Merge branch 'master' of git://github.com/BookStackApp/BookStack into…
Aug 29, 2017
c1a1bc0
Books grid view
Sep 4, 2017
1c88d21
Fixed books cover image ratio.
Sep 4, 2017
e02fcbe
Added Book cover image description in all languages.
Sep 5, 2017
5034f21
Added migration file.
Sep 5, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 50 additions & 2 deletions app/Book.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class Book extends Entity
{

protected $fillable = ['name', 'description'];
protected $fillable = ['name', 'description', 'image_id'];

/**
* Get the url for this book.
Expand All @@ -17,7 +17,46 @@ public function getUrl($path = false)
}
return baseUrl('/books/' . urlencode($this->slug));
}


/**
* Returns book cover image, if book cover not exists return default cover image.
* @param int $height - Height of the image
* @param type $width - Width of the image
* @return type string
*/
public function getBookCover($height = 170, $width = 300)
{
$default = baseUrl('/book_default_cover.png');
$image = $this->image_id;
if ($image === 0 || $image === '0' || $image === null)
return $default;
try {
$cover = $this->cover ? baseUrl($this->cover->getThumb($width, $height, false)) : $default;
} catch (\Exception $err) {
$cover = $default;
}
return $cover;
}

/**
* Get an excerpt of this book's name to the specified length or less.
* @param int $length
* @return string
*/
public function getHeadingExcerpt($length = 35)
{
$bookHeading = $this->name;
return strlen($bookHeading) > $length ? substr($bookHeading, 0, $length-3) . '...' : $bookHeading;
}

/**
* Get the cover image of the book
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function cover()
{
return $this->belongsTo(Image::class, 'image_id');
}
/*
* Get the edit url for this book.
* @return string
Expand Down Expand Up @@ -64,5 +103,14 @@ public function entityRawQuery()
{
return "'BookStack\\\\Book' as entity_type, id, id as entity_id, slug, name, {$this->textField} as text,'' as html, '0' as book_id, '0' as priority, '0' as chapter_id, '0' as draft, created_by, updated_by, updated_at, created_at";
}

/**
* Get the user that created the page revision
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function createdBy()
{
return $this->belongsTo(User::class, 'created_by');
}

}
10 changes: 6 additions & 4 deletions app/Http/Controllers/BookController.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,14 @@ public function index()
$recents = $this->signedIn ? $this->entityRepo->getRecentlyViewed('book', 4, 0) : false;
$popular = $this->entityRepo->getPopular('book', 4, 0);
$new = $this->entityRepo->getRecentlyCreated('book', 4, 0);
$booksViewType = $this->currentUser->books_view_type;
$this->setPageTitle('Books');
return view('books/index', [
'books' => $books,
'recents' => $recents,
'popular' => $popular,
'new' => $new
'new' => $new,
'booksViewType' => $booksViewType
]);
}

Expand Down Expand Up @@ -125,9 +127,9 @@ public function update(Request $request, $slug)
'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());
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
protected $fillable = ['name', 'email', 'image_id', 'books_view_type' ];

/**
* The attributes excluded from the model's JSON form.
Expand Down
40 changes: 40 additions & 0 deletions database/migrations/2017_08_29_102650_add_cover_image_display.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?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_view_type',10)->default('grid');
});

Schema::table('books', function (Blueprint $table) {
$table->integer('image_id');
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('books_view_type');
});

Schema::table('books', function (Blueprint $table) {
$table->dropColumn('image_id');
});
}
}
Binary file added public/book_default_cover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions resources/assets/js/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,19 @@ jQuery.expr[":"].contains = $.expr.createPseudo(function (arg) {
};
});

// Common jQuery actions
$('[data-action="expand-entity-list-details"]').click(function() {
$('.entity-list.compact').find('p').not('.empty-text').slideToggle(240);
});

// Toggle thumbnail::hide image and reduce grid size
$(document).ready(function(){
$('[data-action="expand-thumbnail"]').click(function(){
$('.gallery-item').toggleClass("collapse").find('img').slideToggle(50);
});
});


// Detect IE for css
if(navigator.userAgent.indexOf('MSIE')!==-1
|| navigator.appVersion.indexOf('Trident/') > 0
Expand Down
68 changes: 68 additions & 0 deletions resources/assets/sass/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -228,5 +228,73 @@ $btt-size: 40px;
}
}

// styles for Books grid view
.cover {
width: 290px;
border-radius: 3px;
}

.featured-image-container {
position: relative;
overflow: hidden;
background: #F2F2F2;
border: 1px solid #ddd;
border-bottom: 0px;
}

.featured-image-container img {
display: block;
max-width: 100%;
height: auto;
-webkit-transition: all .5s ease;
-moz-transition: all .5s ease;
-ms-transition: all .5s ease;
-o-transition: all .5s ease;
transition: all .5s ease;
}

.book-content {
padding: 30px;
border: 1px solid #ddd;
border-top: 0px;
border-bottom-width: 2px;
}
.book-content h2 {
font-size: 1.5em;
line-height: 1.2;
margin: 0 0 10px;
}

.book-content h2 a {
display: block;
color: #009688;;
text-decoration: none;
}

.book-content p {
font-size: .85em;
margin: 0 0 10px;
line-height: 1.6em;
}

.featured-image-container img:hover {
-webkit-transform: scale(1.15);
-moz-transform: scale(1.15);
-ms-transform: scale(1.15);
-o-transform: scale(1.15);
transform: scale(1.15);
opacity: .5;
}
.books-grid-div {
margin-bottom : 20px;
}

@media (min-width:992px){
.row.auto-clear .col-md-4:nth-child(3n+1){clear:left;}
}
@media (min-width:992px){
.row.auto-clear .col-md-4:nth-child(3n+1){clear:left;}
}
@media (max-width:991px){
.row.auto-clear .col-xs-6:nth-child(2n+1){clear:left;}
}
4 changes: 3 additions & 1 deletion resources/lang/de/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
'name' => 'Name',
'description' => 'Beschreibung',
'role' => 'Rolle',
'cover_image' => 'Titelbild',
'cover_image_description' => 'Das Bild sollte eine Auflösung von 300x170px haben.',

/**
* Actions
Expand All @@ -43,7 +45,7 @@
'no_items' => 'Keine Einträge gefunden.',
'back_to_top' => 'nach oben',
'toggle_details' => 'Details zeigen/verstecken',

'toggle_thumbnails' => 'Thumbnails zeigen/verstecken',
/**
* Header
*/
Expand Down
1 change: 1 addition & 0 deletions resources/lang/de/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
'users_delete_warning' => 'Der Benutzer ":userName" wird aus dem System gelöscht.',
'users_delete_confirm' => 'Sind Sie sicher, dass Sie diesen Benutzer löschen möchten?',
'users_delete_success' => 'Benutzer erfolgreich gelöscht.',
'users_books_view_type' => 'Bevorzugtes Display-Layout für Bücher',
'users_edit' => 'Benutzer bearbeiten',
'users_edit_profile' => 'Profil bearbeiten',
'users_edit_success' => 'Benutzer erfolgreich aktualisisert',
Expand Down
6 changes: 4 additions & 2 deletions resources/lang/en/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
'name' => 'Name',
'description' => 'Description',
'role' => 'Role',

'cover_image' => 'Cover image',
'cover_image_description' => 'This image should be approx 300x170px.',

/**
* Actions
*/
Expand All @@ -44,8 +46,8 @@
'no_items' => 'No items available',
'back_to_top' => 'Back to top',
'toggle_details' => 'Toggle Details',
'toggle_thumbnails' => 'Toggle Thumbnails',
'details' => 'Details',

/**
* Header
*/
Expand Down
1 change: 1 addition & 0 deletions resources/lang/en/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
'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_view_type' => 'Preferred layout for books viewing',
'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.',
Expand Down
4 changes: 3 additions & 1 deletion resources/lang/es/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
'name' => 'Nombre',
'description' => 'Descripción',
'role' => 'Rol',

'cover_image' => 'Imagen de portada',
'cover_image_description' => 'Esta imagen debe ser aproximadamente 300x170px.',
/**
* Actions
*/
Expand All @@ -43,6 +44,7 @@
'no_items' => 'No hay items disponibles',
'back_to_top' => 'Volver arriba',
'toggle_details' => 'Alternar detalles',
'toggle_thumbnails' => 'Alternar miniaturas',

/**
* Header
Expand Down
1 change: 1 addition & 0 deletions resources/lang/es/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
'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_view_type' => 'Diseño de pantalla preferido para libros',
'users_delete' => 'Borrar usuario',
'users_delete_named' => 'Borrar usuario :userName',
'users_delete_warning' => 'Se borrará completamente el usuario con el nombre \':userName\' del sistema.',
Expand Down
4 changes: 3 additions & 1 deletion resources/lang/fr/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
'name' => 'Nom',
'description' => 'Description',
'role' => 'Rôle',

'cover_image' => 'Image de couverture',
'cover_image_description' => 'Cette image doit être environ 300x170px.',
/**
* Actions
*/
Expand All @@ -43,6 +44,7 @@
'no_items' => 'Aucun élément',
'back_to_top' => 'Retour en haut',
'toggle_details' => 'Afficher les détails',
'toggle_thumbnails' => 'Afficher les vignettes',

/**
* Header
Expand Down
1 change: 1 addition & 0 deletions resources/lang/fr/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
'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_view_type' => 'Disposition d\'affichage préférée pour les livres',
'users_delete' => 'Supprimer un utilisateur',
'users_delete_named' => 'Supprimer l\'utilisateur :userName',
'users_delete_warning' => 'Ceci va supprimer \':userName\' du système.',
Expand Down
2 changes: 1 addition & 1 deletion resources/lang/ja/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
'name' => '名称',
'description' => '概要',
'role' => '権限',

'cover_image_description' => 'この画像は約 300x170px をする必要があります。',
/**
* Actions
*/
Expand Down
4 changes: 3 additions & 1 deletion resources/lang/nl/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
'name' => 'Naam',
'description' => 'Beschrijving',
'role' => 'Rol',

'cover_image' => 'Omslagfoto',
'cover_image_description' => 'Deze afbeelding moet ongeveer 300x170px zijn.',
/**
* Actions
*/
Expand All @@ -43,6 +44,7 @@
'no_items' => 'Geen items beschikbaar',
'back_to_top' => 'Terug naar boven',
'toggle_details' => 'Details Weergeven',
'toggle_thumbnails' => 'Thumbnails Weergeven',

/**
* Header
Expand Down
1 change: 1 addition & 0 deletions resources/lang/nl/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
'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_view_type' => 'Voorkeursuitleg voor het weergeven van boeken',
'users_delete' => 'Verwijder gebruiker',
'users_delete_named' => 'Verwijder gebruiker :userName',
'users_delete_warning' => 'Dit zal de gebruiker \':userName\' volledig uit het systeem verwijderen.',
Expand Down
4 changes: 3 additions & 1 deletion resources/lang/pl/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
'name' => 'Nazwa',
'description' => 'Opis',
'role' => 'Rola',

'cover_image' => 'Zdjęcie z okładki',
'cover_image_description' => 'Ten obraz powinien wynosić około 300 x 170 piksli.',

/**
* Actions
*/
Expand Down
Loading