mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-11-26 10:13:38 +08:00
Aligned book and shelf grid item views
Updated the titles so they are limited via CSS rather than by a estimated hardcoded limit. For #1469
This commit is contained in:
parent
2b603b0488
commit
4b4642c8ea
|
@ -92,6 +92,6 @@
|
|||
.bg-chapter {
|
||||
background-color: var(--color-chapter);
|
||||
}
|
||||
.bg-shelf {
|
||||
.bg-bookshelf {
|
||||
background-color: var(--color-bookshelf);
|
||||
}
|
||||
|
|
|
@ -352,12 +352,21 @@ li > ol, li > ul {
|
|||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
.limit-text {
|
||||
.text-limit-lines-1 {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.text-limit-lines-2 {
|
||||
// -webkit use here is actually standardised cross-browser:
|
||||
// https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-line-clamp
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/**
|
||||
* Grouping
|
||||
*/
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
<a href="{{$book->getUrl()}}" class="grid-card" data-entity-type="book" data-entity-id="{{$book->id}}">
|
||||
<div class="bg-book featured-image-container-wrap">
|
||||
<div class="featured-image-container" @if($book->cover) style="background-image: url('{{ $book->getBookCover() }}')"@endif>
|
||||
</div>
|
||||
@icon('book')
|
||||
</div>
|
||||
<div class="grid-card-content">
|
||||
<h2>{{$book->getShortName(35)}}</h2>
|
||||
@if(isset($book->searchSnippet))
|
||||
<p class="text-muted">{!! $book->searchSnippet !!}</p>
|
||||
@else
|
||||
<p class="text-muted">{{ $book->getExcerpt(130) }}</p>
|
||||
@endif
|
||||
</div>
|
||||
<div class="grid-card-footer text-muted ">
|
||||
<p>@icon('star')<span title="{{$book->created_at->toDayDateTimeString()}}">{{ trans('entities.meta_created', ['timeLength' => $book->created_at->diffForHumans()]) }}</span></p>
|
||||
<p>@icon('edit')<span title="{{ $book->updated_at->toDayDateTimeString() }}">{{ trans('entities.meta_updated', ['timeLength' => $book->updated_at->diffForHumans()]) }}</span></p>
|
||||
</div>
|
||||
</a>
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
<main class="content-wrap mt-m card">
|
||||
<div class="grid half v-center no-row-gap">
|
||||
<h1 class="list-heading">{{ trans('entities.books') }}</h1>
|
||||
|
@ -22,7 +21,7 @@
|
|||
@else
|
||||
<div class="grid third">
|
||||
@foreach($books as $key => $book)
|
||||
@include('books.grid-item', ['book' => $book])
|
||||
@include('partials.entity-grid-item', ['entity' => $book])
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
<div class="sidebar-page-nav menu">
|
||||
@foreach($pageNav as $navItem)
|
||||
<li class="page-nav-item h{{ $navItem['level'] }}">
|
||||
<a href="{{ $navItem['link'] }}" class="limit-text block">{{ $navItem['text'] }}</a>
|
||||
<a href="{{ $navItem['link'] }}" class="text-limit-lines-1 block">{{ $navItem['text'] }}</a>
|
||||
<div class="primary-background sidebar-page-nav-bullet"></div>
|
||||
</li>
|
||||
@endforeach
|
||||
|
|
16
resources/views/partials/entity-grid-item.blade.php
Normal file
16
resources/views/partials/entity-grid-item.blade.php
Normal file
|
@ -0,0 +1,16 @@
|
|||
<a href="{{ $entity->getUrl() }}" class="grid-card"
|
||||
data-entity-type="{{ $entity->getType() }}" data-entity-id="{{ $entity->id }}">
|
||||
<div class="bg-{{ $entity->getType() }} featured-image-container-wrap">
|
||||
<div class="featured-image-container" @if($entity->cover) style="background-image: url('{{ $entity->getBookCover() }}')"@endif>
|
||||
</div>
|
||||
@icon($entity->getType())
|
||||
</div>
|
||||
<div class="grid-card-content">
|
||||
<h2 class="text-limit-lines-2">{{ $entity->name }}</h2>
|
||||
<p class="text-muted">{{ $entity->getExcerpt(130) }}</p>
|
||||
</div>
|
||||
<div class="grid-card-footer text-muted ">
|
||||
<p>@icon('star')<span title="{{ $entity->created_at->toDayDateTimeString() }}">{{ trans('entities.meta_created', ['timeLength' => $entity->created_at->diffForHumans()]) }}</span></p>
|
||||
<p>@icon('edit')<span title="{{ $entity->updated_at->toDayDateTimeString() }}">{{ trans('entities.meta_updated', ['timeLength' => $entity->updated_at->diffForHumans()]) }}</span></p>
|
||||
</div>
|
||||
</a>
|
|
@ -1,21 +0,0 @@
|
|||
<a href="{{$shelf->getUrl()}}" class="bookshelf-grid-item grid-card"
|
||||
data-entity-type="bookshelf" data-entity-id="{{$shelf->id}}">
|
||||
<div class="bg-shelf featured-image-container-wrap">
|
||||
<div class="featured-image-container" @if($shelf->cover) style="background-image: url('{{ $shelf->getBookCover() }}')"@endif>
|
||||
</div>
|
||||
@icon('bookshelf')
|
||||
</div>
|
||||
<div class="grid-card-content">
|
||||
<h2>{{$shelf->getShortName(35)}}</h2>
|
||||
@if(isset($shelf->searchSnippet))
|
||||
<p class="text-muted">{!! $shelf->searchSnippet !!}</p>
|
||||
@else
|
||||
<p class="text-muted">{{ $shelf->getExcerpt(130) }}</p>
|
||||
@endif
|
||||
</div>
|
||||
<div class="grid-card-footer text-muted text-small">
|
||||
@icon('star')<span title="{{$shelf->created_at->toDayDateTimeString()}}">{{ trans('entities.meta_created', ['timeLength' => $shelf->created_at->diffForHumans()]) }}</span>
|
||||
<br>
|
||||
@icon('edit')<span title="{{ $shelf->updated_at->toDayDateTimeString() }}">{{ trans('entities.meta_updated', ['timeLength' => $shelf->updated_at->diffForHumans()]) }}</span>
|
||||
</div>
|
||||
</a>
|
|
@ -1,5 +1,5 @@
|
|||
<a href="{{ $shelf->getUrl() }}" class="shelf entity-list-item" data-entity-type="bookshelf" data-entity-id="{{$shelf->id}}">
|
||||
<div class="entity-list-item-image bg-shelf @if($shelf->image_id) has-image @endif" style="background-image: url('{{ $shelf->getBookCover() }}')">
|
||||
<div class="entity-list-item-image bg-bookshelf @if($shelf->image_id) has-image @endif" style="background-image: url('{{ $shelf->getBookCover() }}')">
|
||||
@icon('bookshelf')
|
||||
</div>
|
||||
<div class="content py-xs">
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
@else
|
||||
<div class="grid third">
|
||||
@foreach($shelves as $key => $shelf)
|
||||
@include('shelves.grid-item', ['shelf' => $shelf])
|
||||
@include('partials.entity-grid-item', ['entity' => $shelf])
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
@else
|
||||
<div class="grid third">
|
||||
@foreach($shelf->visibleBooks as $key => $book)
|
||||
@include('books.grid-item', ['book' => $book])
|
||||
@include('partials.entity-grid-item', ['entity' => $book])
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
|
|
Loading…
Reference in New Issue
Block a user