mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-01-31 12:11:37 +01:00
parent
bab6fd1f2f
commit
8eb2960950
@ -278,4 +278,30 @@ class PageController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show a listing of recently created pages
|
||||||
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||||
|
*/
|
||||||
|
public function showRecentlyCreated()
|
||||||
|
{
|
||||||
|
$pages = $this->pageRepo->getRecentlyCreatedPaginated(20);
|
||||||
|
return view('pages/detailed-listing', [
|
||||||
|
'title' => 'Recently Created Pages',
|
||||||
|
'pages' => $pages
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show a listing of recently created pages
|
||||||
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||||
|
*/
|
||||||
|
public function showRecentlyUpdated()
|
||||||
|
{
|
||||||
|
$pages = $this->pageRepo->getRecentlyUpdatedPaginated(20);
|
||||||
|
return view('pages/detailed-listing', [
|
||||||
|
'title' => 'Recently Updated Pages',
|
||||||
|
'pages' => $pages
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,11 @@
|
|||||||
// Authenticated routes...
|
// Authenticated routes...
|
||||||
Route::group(['middleware' => 'auth'], function () {
|
Route::group(['middleware' => 'auth'], function () {
|
||||||
|
|
||||||
|
Route::group(['prefix' => 'pages'], function() {
|
||||||
|
Route::get('/recently-created', 'PageController@showRecentlyCreated');
|
||||||
|
Route::get('/recently-updated', 'PageController@showRecentlyUpdated');
|
||||||
|
});
|
||||||
|
|
||||||
Route::group(['prefix' => 'books'], function () {
|
Route::group(['prefix' => 'books'], function () {
|
||||||
|
|
||||||
// Books
|
// Books
|
||||||
|
@ -358,5 +358,22 @@ class PageRepo
|
|||||||
$page->delete();
|
$page->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the latest pages added to the system.
|
||||||
|
* @param $count
|
||||||
|
*/
|
||||||
|
public function getRecentlyCreatedPaginated($count = 20)
|
||||||
|
{
|
||||||
|
return $this->page->orderBy('created_at', 'desc')->paginate($count);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the latest pages added to the system.
|
||||||
|
* @param $count
|
||||||
|
*/
|
||||||
|
public function getRecentlyUpdatedPaginated($count = 20)
|
||||||
|
{
|
||||||
|
return $this->page->orderBy('updated_at', 'desc')->paginate($count);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -139,54 +139,6 @@ form.search-box {
|
|||||||
height: 43px;
|
height: 43px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dropdown-container {
|
|
||||||
display: inline-block;
|
|
||||||
vertical-align: top;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dropdown-container ul {
|
|
||||||
display: none;
|
|
||||||
position: absolute;
|
|
||||||
z-index: 999;
|
|
||||||
top: 0;
|
|
||||||
list-style: none;
|
|
||||||
right: 0;
|
|
||||||
margin: $-m 0;
|
|
||||||
background-color: #FFFFFF;
|
|
||||||
box-shadow: 0 0 2px 0 rgba(0, 0, 0, 0.1);
|
|
||||||
border-radius: 1px;
|
|
||||||
border: 1px solid #EEE;
|
|
||||||
min-width: 180px;
|
|
||||||
padding: $-xs 0;
|
|
||||||
color: #555;
|
|
||||||
text-align: left !important;
|
|
||||||
&.wide {
|
|
||||||
min-width: 220px;
|
|
||||||
}
|
|
||||||
.text-muted {
|
|
||||||
color: #999;
|
|
||||||
}
|
|
||||||
a {
|
|
||||||
display: block;
|
|
||||||
padding: $-xs $-m;
|
|
||||||
color: #555;
|
|
||||||
&:hover {
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: #EEE;
|
|
||||||
}
|
|
||||||
i {
|
|
||||||
margin-right: $-m;
|
|
||||||
padding-right: 0;
|
|
||||||
display: inline;
|
|
||||||
width: 22px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
li.border-bottom {
|
|
||||||
border-bottom: 1px solid #DDD;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.breadcrumbs span.sep {
|
.breadcrumbs span.sep {
|
||||||
color: #aaa;
|
color: #aaa;
|
||||||
padding: 0 $-xs;
|
padding: 0 $-xs;
|
||||||
|
@ -285,17 +285,30 @@ ul.pagination {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.entity-list.compact {
|
.entity-list {
|
||||||
font-size: 0.6em;
|
>div {
|
||||||
> div {
|
|
||||||
padding: $-m 0;
|
padding: $-m 0;
|
||||||
}
|
}
|
||||||
h3, a {
|
|
||||||
line-height: 1.2;
|
|
||||||
}
|
|
||||||
h3 {
|
h3 {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
p {
|
||||||
|
margin: $-xs 0 0 0;
|
||||||
|
}
|
||||||
|
hr {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.text-small.text-muted {
|
||||||
|
color: #AAA;
|
||||||
|
font-size: 0.75em;
|
||||||
|
margin-top: $-xs;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.entity-list.compact {
|
||||||
|
font-size: 0.6em;
|
||||||
|
h3, a {
|
||||||
|
line-height: 1.2;
|
||||||
|
}
|
||||||
p {
|
p {
|
||||||
display: none;
|
display: none;
|
||||||
font-size: $fs-m * 0.8;
|
font-size: $fs-m * 0.8;
|
||||||
@ -305,4 +318,52 @@ ul.pagination {
|
|||||||
hr {
|
hr {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dropdown-container {
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: top;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdown-container ul {
|
||||||
|
display: none;
|
||||||
|
position: absolute;
|
||||||
|
z-index: 999;
|
||||||
|
top: 0;
|
||||||
|
list-style: none;
|
||||||
|
right: 0;
|
||||||
|
margin: $-m 0;
|
||||||
|
background-color: #FFFFFF;
|
||||||
|
box-shadow: 0 0 2px 0 rgba(0, 0, 0, 0.1);
|
||||||
|
border-radius: 1px;
|
||||||
|
border: 1px solid #EEE;
|
||||||
|
min-width: 180px;
|
||||||
|
padding: $-xs 0;
|
||||||
|
color: #555;
|
||||||
|
text-align: left !important;
|
||||||
|
&.wide {
|
||||||
|
min-width: 220px;
|
||||||
|
}
|
||||||
|
.text-muted {
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
a {
|
||||||
|
display: block;
|
||||||
|
padding: $-xs $-m;
|
||||||
|
color: #555;
|
||||||
|
&:hover {
|
||||||
|
text-decoration: none;
|
||||||
|
background-color: #EEE;
|
||||||
|
}
|
||||||
|
i {
|
||||||
|
margin-right: $-m;
|
||||||
|
padding-right: 0;
|
||||||
|
display: inline;
|
||||||
|
width: 22px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
li.border-bottom {
|
||||||
|
border-bottom: 1px solid #DDD;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -254,10 +254,15 @@ ol {
|
|||||||
.text-bigger {
|
.text-bigger {
|
||||||
font-size: 1.1em;
|
font-size: 1.1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.text-large {
|
.text-large {
|
||||||
font-size: 1.6666em;
|
font-size: 1.6666em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.no-color {
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Grouping
|
* Grouping
|
||||||
*/
|
*/
|
||||||
|
@ -28,14 +28,15 @@
|
|||||||
@else
|
@else
|
||||||
<h3>Recent Books</h3>
|
<h3>Recent Books</h3>
|
||||||
@endif
|
@endif
|
||||||
@include('partials/entity-list', ['entities' => $recents, 'size' => 'compact'])
|
@include('partials/entity-list', ['entities' => $recents, 'style' => 'compact'])
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<h3>Recently Created Pages</h3>
|
<h3><a class="no-color" href="/pages/recently-created">Recently Created Pages</a></h3>
|
||||||
@include('partials/entity-list', ['entities' => $recentlyCreatedPages, 'size' => 'compact'])
|
@include('partials/entity-list', ['entities' => $recentlyCreatedPages, 'style' => 'compact'])
|
||||||
<h3>Recently Updated Pages</h3>
|
|
||||||
@include('partials/entity-list', ['entities' => $recentlyCreatedPages, 'size' => 'compact'])
|
<h3><a class="no-color" href="/pages/recently-updated">Recently Updated Pages</a></h3>
|
||||||
|
@include('partials/entity-list', ['entities' => $recentlyCreatedPages, 'style' => 'compact'])
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-sm-4" id="recent-activity">
|
<div class="col-sm-4" id="recent-activity">
|
||||||
|
18
resources/views/pages/detailed-listing.blade.php
Normal file
18
resources/views/pages/detailed-listing.blade.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
@extends('base')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<div class="col-sm-7">
|
||||||
|
<h1>{{ $title }}</h1>
|
||||||
|
@include('partials/entity-list', ['entities' => $pages, 'style' => 'detailed'])
|
||||||
|
{!! $pages->links() !!}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-sm-4 col-sm-offset-1"></div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@stop
|
@ -3,18 +3,29 @@
|
|||||||
<a href="{{ $page->getUrl() }}" class="text-page"><i class="zmdi zmdi-file-text"></i>{{ $page->name }}</a>
|
<a href="{{ $page->getUrl() }}" class="text-page"><i class="zmdi zmdi-file-text"></i>{{ $page->name }}</a>
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
@if(isset($showMeta) && $showMeta)
|
|
||||||
<div class="meta">
|
|
||||||
<span class="text-book"><i class="zmdi zmdi-book"></i> {{ $page->book->name }}</span>
|
|
||||||
@if($page->chapter)
|
|
||||||
<span class="text-chapter"><i class="zmdi zmdi-collection-bookmark"></i> {{ $page->chapter->name }}</span>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
@if(isset($page->searchSnippet))
|
@if(isset($page->searchSnippet))
|
||||||
<p class="text-muted">{!! $page->searchSnippet !!}</p>
|
<p class="text-muted">{!! $page->searchSnippet !!}</p>
|
||||||
@else
|
@else
|
||||||
<p class="text-muted">{{ $page->getExcerpt() }}</p>
|
<p class="text-muted">{{ $page->getExcerpt() }}</p>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
@if(isset($style) && $style === 'detailed')
|
||||||
|
<div class="row meta text-muted text-small">
|
||||||
|
<div class="col-md-4">
|
||||||
|
Created {{$page->created_at->diffForHumans()}} @if($page->createdBy)by {{$page->createdBy->name}}@endif <br>
|
||||||
|
Last updated {{ $page->updated_at->diffForHumans() }} @if($page->updatedBy)by {{$page->updatedBy->name}} @endif
|
||||||
|
</div>
|
||||||
|
<div class="col-md-8">
|
||||||
|
<a class="text-book" href="{{ $page->book->getUrl() }}"><i class="zmdi zmdi-book"></i>{{ $page->book->getExcerpt(30) }}</a>
|
||||||
|
<br>
|
||||||
|
@if($page->chapter)
|
||||||
|
<a class="text-chapter" href="{{ $page->chapter->getUrl() }}"><i class="zmdi zmdi-collection-bookmark"></i>{{ $page->chapter->getExcerpt(30) }}</a>
|
||||||
|
@else
|
||||||
|
<i class="zmdi zmdi-collection-bookmark"></i> Page is not in a chapter
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
<div class="entity-list @if(isset($size)){{ $size }}@endif">
|
<div class="entity-list @if(isset($style)){{ $style }}@endif" ng-non-bindable>
|
||||||
@if(count($entities) > 0)
|
@if(count($entities) > 0)
|
||||||
@foreach($entities as $index => $entity)
|
@foreach($entities as $index => $entity)
|
||||||
@if($entity->isA('page'))
|
@if($entity->isA('page'))
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
<div class="page-list">
|
<div class="page-list">
|
||||||
@if(count($pages) > 0)
|
@if(count($pages) > 0)
|
||||||
@foreach($pages as $page)
|
@foreach($pages as $page)
|
||||||
@include('pages/list-item', ['page' => $page, 'showMeta' => true])
|
@include('pages/list-item', ['page' => $page, 'style' => 'detailed'])
|
||||||
<hr>
|
<hr>
|
||||||
@endforeach
|
@endforeach
|
||||||
@else
|
@else
|
||||||
|
@ -250,5 +250,23 @@ class EntityTest extends TestCase
|
|||||||
->click('Revisions')->seeStatusCode(200);
|
->click('Revisions')->seeStatusCode(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_recently_created_pages_view()
|
||||||
|
{
|
||||||
|
$user = $this->getNewUser();
|
||||||
|
$content = $this->createEntityChainBelongingToUser($user);
|
||||||
|
|
||||||
|
$this->asAdmin()->visit('/pages/recently-created')
|
||||||
|
->seeInNthElement('.entity-list .page', 0, $content['page']->name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_recently_updated_pages_view()
|
||||||
|
{
|
||||||
|
$user = $this->getNewUser();
|
||||||
|
$content = $this->createEntityChainBelongingToUser($user);
|
||||||
|
|
||||||
|
$this->asAdmin()->visit('/pages/recently-updated')
|
||||||
|
->seeInNthElement('.entity-list .page', 0, $content['page']->name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user