Migrated a whole load more page/chapter/shelf views

This commit is contained in:
Dan Brown 2019-02-02 11:41:41 +00:00
parent 32603362a6
commit 20988962fe
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9
26 changed files with 369 additions and 338 deletions

View File

@ -62,4 +62,5 @@ class PageRevision extends Model
{
return $type === 'revision';
}
}

View File

@ -40,15 +40,15 @@ class BookshelfController extends Controller
$recents = $this->signedIn ? $this->entityRepo->getRecentlyViewed('bookshelf', 4, 0) : false;
$popular = $this->entityRepo->getPopular('bookshelf', 4, 0);
$new = $this->entityRepo->getRecentlyCreated('bookshelf', 4, 0);
$shelvesViewType = setting()->getUser($this->currentUser, 'bookshelves_view_type', config('app.views.bookshelves', 'grid'));
$view = setting()->getUser($this->currentUser, 'bookshelves_view_type', config('app.views.bookshelves', 'grid'));
$this->setPageTitle(trans('entities.shelves'));
return view('shelves/index', [
return view('shelves.index', [
'shelves' => $shelves,
'recents' => $recents,
'popular' => $popular,
'new' => $new,
'shelvesViewType' => $shelvesViewType
'view' => $view
]);
}
@ -61,7 +61,7 @@ class BookshelfController extends Controller
$this->checkPermission('bookshelf-create-all');
$books = $this->entityRepo->getAll('book', false, 'update');
$this->setPageTitle(trans('entities.shelves_create'));
return view('shelves/create', ['books' => $books]);
return view('shelves.create', ['books' => $books]);
}
/**
@ -100,7 +100,7 @@ class BookshelfController extends Controller
Views::add($bookshelf);
$this->setPageTitle($bookshelf->getShortName());
return view('shelves/show', [
return view('shelves.show', [
'shelf' => $bookshelf,
'books' => $books,
'activity' => Activity::entityActivity($bookshelf, 20, 0)
@ -126,7 +126,7 @@ class BookshelfController extends Controller
});
$this->setPageTitle(trans('entities.shelves_edit_named', ['name' => $bookshelf->getShortName()]));
return view('shelves/edit', [
return view('shelves.edit', [
'shelf' => $bookshelf,
'books' => $books,
'shelfBooks' => $shelfBooks,
@ -170,7 +170,7 @@ class BookshelfController extends Controller
$this->checkOwnablePermission('bookshelf-delete', $bookshelf);
$this->setPageTitle(trans('entities.shelves_delete_named', ['name' => $bookshelf->getShortName()]));
return view('shelves/delete', ['shelf' => $bookshelf]);
return view('shelves.delete', ['shelf' => $bookshelf]);
}
/**

View File

@ -214,13 +214,14 @@ class ChapterController extends Controller
* @param $bookSlug
* @param $chapterSlug
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
* @throws \BookStack\Exceptions\NotFoundException
*/
public function showRestrict($bookSlug, $chapterSlug)
public function showPermissions($bookSlug, $chapterSlug)
{
$chapter = $this->entityRepo->getBySlug('chapter', $chapterSlug, $bookSlug);
$this->checkOwnablePermission('restrictions-manage', $chapter);
$roles = $this->userRepo->getRestrictableRoles();
return view('chapters/restrictions', [
return view('chapters.permissions', [
'chapter' => $chapter,
'roles' => $roles
]);
@ -232,8 +233,10 @@ class ChapterController extends Controller
* @param $chapterSlug
* @param Request $request
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
* @throws \BookStack\Exceptions\NotFoundException
* @throws \Throwable
*/
public function restrict($bookSlug, $chapterSlug, Request $request)
public function permissions($bookSlug, $chapterSlug, Request $request)
{
$chapter = $this->entityRepo->getBySlug('chapter', $chapterSlug, $bookSlug);
$this->checkOwnablePermission('restrictions-manage', $chapter);

View File

@ -61,7 +61,7 @@ class PageController extends Controller
// Otherwise show the edit view if they're a guest
$this->setPageTitle(trans('entities.pages_new'));
return view('pages/guest-create', ['parent' => $parent]);
return view('pages.guest-create', ['parent' => $parent]);
}
/**
@ -110,7 +110,7 @@ class PageController extends Controller
$this->setPageTitle(trans('entities.pages_edit_draft'));
$draftsEnabled = $this->signedIn;
return view('pages/edit', [
return view('pages.edit', [
'page' => $draft,
'book' => $draft->book,
'isDraft' => true,
@ -184,7 +184,7 @@ class PageController extends Controller
Views::add($page);
$this->setPageTitle($page->getShortName());
return view('pages/show', [
return view('pages.show', [
'page' => $page,'book' => $page->book,
'current' => $page,
'sidebarTree' => $sidebarTree,
@ -239,7 +239,7 @@ class PageController extends Controller
}
$draftsEnabled = $this->signedIn;
return view('pages/edit', [
return view('pages.edit', [
'page' => $page,
'book' => $page->book,
'current' => $page,
@ -317,7 +317,7 @@ class PageController extends Controller
$page = $this->pageRepo->getPageBySlug($pageSlug, $bookSlug);
$this->checkOwnablePermission('page-delete', $page);
$this->setPageTitle(trans('entities.pages_delete_named', ['pageName'=>$page->getShortName()]));
return view('pages/delete', ['book' => $page->book, 'page' => $page, 'current' => $page]);
return view('pages.delete', ['book' => $page->book, 'page' => $page, 'current' => $page]);
}
@ -333,7 +333,7 @@ class PageController extends Controller
$page = $this->pageRepo->getById('page', $pageId, true);
$this->checkOwnablePermission('page-update', $page);
$this->setPageTitle(trans('entities.pages_delete_draft_named', ['pageName'=>$page->getShortName()]));
return view('pages/delete', ['book' => $page->book, 'page' => $page, 'current' => $page]);
return view('pages.delete', ['book' => $page->book, 'page' => $page, 'current' => $page]);
}
/**
@ -377,12 +377,13 @@ class PageController extends Controller
* @param string $bookSlug
* @param string $pageSlug
* @return \Illuminate\View\View
* @throws NotFoundException
*/
public function showRevisions($bookSlug, $pageSlug)
{
$page = $this->pageRepo->getPageBySlug($pageSlug, $bookSlug);
$this->setPageTitle(trans('entities.pages_revisions_named', ['pageName'=>$page->getShortName()]));
return view('pages/revisions', ['page' => $page, 'book' => $page->book, 'current' => $page]);
return view('pages.revisions', ['page' => $page, 'current' => $page]);
}
/**
@ -403,9 +404,10 @@ class PageController extends Controller
$page->fill($revision->toArray());
$this->setPageTitle(trans('entities.pages_revision_named', ['pageName' => $page->getShortName()]));
return view('pages/revision', [
return view('pages.revision', [
'page' => $page,
'book' => $page->book,
'diff' => null,
'revision' => $revision
]);
}
@ -432,7 +434,7 @@ class PageController extends Controller
$page->fill($revision->toArray());
$this->setPageTitle(trans('entities.pages_revision_named', ['pageName'=>$page->getShortName()]));
return view('pages/revision', [
return view('pages.revision', [
'page' => $page,
'book' => $page->book,
'diff' => $diff,
@ -482,12 +484,12 @@ class PageController extends Controller
// Check if its the latest revision, cannot delete latest revision.
if (intval($currentRevision->id) === intval($revId)) {
session()->flash('error', trans('entities.revision_cannot_delete_latest'));
return response()->view('pages/revisions', ['page' => $page, 'book' => $page->book, 'current' => $page], 400);
return response()->view('pages.revisions', ['page' => $page, 'book' => $page->book, 'current' => $page], 400);
}
$revision->delete();
session()->flash('success', trans('entities.revision_delete_success'));
return view('pages/revisions', ['page' => $page, 'book' => $page->book, 'current' => $page]);
return view('pages.revisions', ['page' => $page, 'book' => $page->book, 'current' => $page]);
}
/**
@ -538,8 +540,9 @@ class PageController extends Controller
*/
public function showRecentlyCreated()
{
// TODO - Still exist?
$pages = $this->pageRepo->getRecentlyCreatedPaginated('page', 20)->setPath(baseUrl('/pages/recently-created'));
return view('pages/detailed-listing', [
return view('pages.detailed-listing', [
'title' => trans('entities.recently_created_pages'),
'pages' => $pages
]);
@ -551,30 +554,14 @@ class PageController extends Controller
*/
public function showRecentlyUpdated()
{
// TODO - Still exist?
$pages = $this->pageRepo->getRecentlyUpdatedPaginated('page', 20)->setPath(baseUrl('/pages/recently-updated'));
return view('pages/detailed-listing', [
return view('pages.detailed-listing', [
'title' => trans('entities.recently_updated_pages'),
'pages' => $pages
]);
}
/**
* Show the Restrictions view.
* @param string $bookSlug
* @param string $pageSlug
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function showRestrict($bookSlug, $pageSlug)
{
$page = $this->pageRepo->getPageBySlug($pageSlug, $bookSlug);
$this->checkOwnablePermission('restrictions-manage', $page);
$roles = $this->userRepo->getRestrictableRoles();
return view('pages/restrictions', [
'page' => $page,
'roles' => $roles
]);
}
/**
* Show the view to choose a new parent to move a page into.
* @param string $bookSlug
@ -587,7 +574,7 @@ class PageController extends Controller
$page = $this->pageRepo->getPageBySlug($pageSlug, $bookSlug);
$this->checkOwnablePermission('page-update', $page);
$this->checkOwnablePermission('page-delete', $page);
return view('pages/move', [
return view('pages.move', [
'book' => $page->book,
'page' => $page
]);
@ -645,7 +632,7 @@ class PageController extends Controller
$page = $this->pageRepo->getPageBySlug($pageSlug, $bookSlug);
$this->checkOwnablePermission('page-update', $page);
session()->flashInput(['name' => $page->name]);
return view('pages/copy', [
return view('pages.copy', [
'book' => $page->book,
'page' => $page
]);
@ -690,6 +677,24 @@ class PageController extends Controller
return redirect($pageCopy->getUrl());
}
/**
* Show the Permissions view.
* @param string $bookSlug
* @param string $pageSlug
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
* @throws NotFoundException
*/
public function showPermissions($bookSlug, $pageSlug)
{
$page = $this->pageRepo->getPageBySlug($pageSlug, $bookSlug);
$this->checkOwnablePermission('restrictions-manage', $page);
$roles = $this->userRepo->getRestrictableRoles();
return view('pages.permissions', [
'page' => $page,
'roles' => $roles
]);
}
/**
* Set the permissions for this page.
* @param string $bookSlug
@ -697,8 +702,9 @@ class PageController extends Controller
* @param Request $request
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
* @throws NotFoundException
* @throws \Throwable
*/
public function restrict($bookSlug, $pageSlug, Request $request)
public function permissions($bookSlug, $pageSlug, Request $request)
{
$page = $this->pageRepo->getPageBySlug($pageSlug, $bookSlug);
$this->checkOwnablePermission('restrictions-manage', $page);

View File

@ -205,6 +205,9 @@ div[class^="col-"] img {
&.left-focus {
grid-template-columns: 2fr 1fr;
}
&.right-focus {
grid-template-columns: 1fr 2fr;
}
&.large-gap {
grid-column-gap: $-xl;
grid-row-gap: $-xl;
@ -266,7 +269,7 @@ div[class^="col-"] img {
.grid.third {
grid-template-columns: 1fr 1fr;
}
.grid.left-focus {
.grid.left-focus, .grid.right-focus {
grid-template-columns: 1fr;
}
}

View File

@ -202,6 +202,8 @@ return [
'pages_revisions_created_by' => 'Created By',
'pages_revisions_date' => 'Revision Date',
'pages_revisions_number' => '#',
'pages_revisions_numbered' => 'Revision #:id',
'pages_revisions_numbered_changes' => 'Revision #:id Changes',
'pages_revisions_changelog' => 'Changelog',
'pages_revisions_changes' => 'Changes',
'pages_revisions_current' => 'Current Version',

View File

@ -44,7 +44,7 @@
<span>{{ trans('entities.books_create') }}</span>
</a>
@endif
@include('books.view-toggle', ['view' => $view])
@include('partials.view-toggle', ['view' => $view, 'type' => 'book'])
</div>
</div>

View File

@ -1,29 +1,32 @@
@extends('simple-layout')
@section('toolbar')
<div class="col-sm-12 faded">
@include('chapters._breadcrumbs', ['chapter' => $chapter])
</div>
@stop
@section('body')
<div class="container small">
<p>&nbsp;</p>
<div class="card">
<h3>@icon('delete') {{ trans('entities.chapters_delete') }}</h3>
<div class="body">
<p>{{ trans('entities.chapters_delete_explain', ['chapterName' => $chapter->name]) }}</p>
<p class="text-neg">{{ trans('entities.chapters_delete_confirm') }}</p>
<div class="my-l">
@include('partials.breadcrumbs', ['crumbs' => [
$chapter->book,
$chapter,
$chapter->getUrl('/delete') => trans('entities.chapters_delete')
]])
</div>
<form action="{{ $chapter->getUrl() }}" method="POST">
{!! csrf_field() !!}
<input type="hidden" name="_method" value="DELETE">
<div class="card content-wrap auto-height">
<h1 class="list-heading">{{ trans('entities.chapters_delete') }}</h1>
<p>{{ trans('entities.chapters_delete_explain', ['chapterName' => $chapter->name]) }}</p>
<p class="text-neg"><strong>{{ trans('entities.chapters_delete_confirm') }}</strong></p>
<form action="{{ $chapter->getUrl() }}" method="POST">
{!! csrf_field() !!}
<input type="hidden" name="_method" value="DELETE">
<div class="text-right">
<a href="{{ $chapter->getUrl() }}" class="button outline">{{ trans('common.cancel') }}</a>
<button type="submit" class="button neg">{{ trans('common.confirm') }}</button>
</form>
</div>
<button type="submit" class="button primary">{{ trans('common.confirm') }}</button>
</div>
</form>
</div>
</div>

View File

@ -1,30 +1,33 @@
@extends('simple-layout')
@section('toolbar')
<div class="col-sm-12 faded">
@include('chapters._breadcrumbs', ['chapter' => $chapter])
</div>
@stop
@section('body')
<div class="container small">
<div class="card">
<h3>@icon('folder') {{ trans('entities.chapters_move') }}</h3>
<div class="body">
<form action="{{ $chapter->getUrl('/move') }}" method="POST">
{!! csrf_field() !!}
<input type="hidden" name="_method" value="PUT">
<div class="my-l">
@include('partials.breadcrumbs', ['crumbs' => [
$chapter->book,
$chapter,
$chapter->getUrl('/move') => trans('entities.chapters_move')
]])
</div>
@include('components.entity-selector', ['name' => 'entity_selection', 'selectorSize' => 'large', 'entityTypes' => 'book', 'entityPermission' => 'chapter-create'])
<div class="card content-wrap">
<h1 class="list-heading">{{ trans('entities.chapters_move') }}</h1>
<form action="{{ $chapter->getUrl('/move') }}" method="POST">
{!! csrf_field() !!}
<input type="hidden" name="_method" value="PUT">
@include('components.entity-selector', ['name' => 'entity_selection', 'selectorSize' => 'large', 'entityTypes' => 'book', 'entityPermission' => 'chapter-create'])
<div class="form-group text-right">
<a href="{{ $chapter->getUrl() }}" class="button outline">{{ trans('common.cancel') }}</a>
<button type="submit" class="button primary">{{ trans('entities.chapters_move') }}</button>
</div>
</form>
<div class="form-group text-right">
<a href="{{ $chapter->getUrl() }}" class="button outline">{{ trans('common.cancel') }}</a>
<button type="submit" class="button pos">{{ trans('entities.chapters_move') }}</button>
</div>
</form>
</div>
</div>

View File

@ -0,0 +1,21 @@
@extends('simple-layout')
@section('body')
<div class="container">
<div class="my-l">
@include('partials.breadcrumbs', ['crumbs' => [
$chapter->book,
$chapter,
$chapter->getUrl('/permissions') => trans('entities.chapters_permissions')
]])
</div>
<div class="card content-wrap">
<h1 class="list-heading">{{ trans('entities.chapters_permissions') }}</h1>
@include('form.entity-permissions', ['model' => $chapter])
</div>
</div>
@stop

View File

@ -1,21 +0,0 @@
@extends('simple-layout')
@section('toolbar')
<div class="col-sm-12 faded">
@include('chapters._breadcrumbs', ['chapter' => $chapter])
</div>
@stop
@section('body')
<div class="container">
<p>&nbsp;</p>
<div class="card">
<h3>@icon('lock') {{ trans('entities.chapters_permissions') }}</h3>
<div class="body">
@include('form.entity-permissions', ['model' => $chapter])
</div>
</div>
</div>
@stop

View File

@ -5,4 +5,5 @@
<div class="text-center loading" entity-selector-loading>@include('partials.loading-icon')</div>
<div entity-selector-results></div>
</div>
</div>
</div>
{{--TODO--}}

View File

@ -1,42 +1,45 @@
@extends('simple-layout')
@section('toolbar')
<div class="col-sm-12 faded">
@include('pages._breadcrumbs', ['page' => $page])
</div>
@stop
@section('body')
<div class="container small">
<p>&nbsp;</p>
<div class="card">
<h3>@icon('copy') {{ trans('entities.pages_copy') }}</h3>
<div class="body">
<form action="{{ $page->getUrl('/copy') }}" method="POST">
{!! csrf_field() !!}
<div class="form-group title-input">
<label for="name">{{ trans('common.name') }}</label>
@include('form/text', ['name' => 'name'])
<div class="my-l">
@include('partials.breadcrumbs', ['crumbs' => [
$page->book,
$page->chapter,
$page,
$page->getUrl('/copy') => trans('entities.pages_copy')
]])
</div>
<div class="card content-wrap auto-height">
<h1 class="list-heading">{{ trans('entities.pages_copy') }}</h1>
<form action="{{ $page->getUrl('/copy') }}" method="POST">
{!! csrf_field() !!}
<div class="form-group title-input">
<label for="name">{{ trans('common.name') }}</label>
@include('form/text', ['name' => 'name'])
</div>
<div class="form-group" collapsible>
<div class="collapse-title text-primary" collapsible-trigger>
<label for="entity_selection">{{ trans('entities.pages_copy_desination') }}</label>
</div>
<div class="form-group" collapsible>
<div class="collapse-title text-primary" collapsible-trigger>
<label for="entity_selection">{{ trans('entities.pages_copy_desination') }}</label>
</div>
<div class="collapse-content" collapsible-content>
@include('components.entity-selector', ['name' => 'entity_selection', 'selectorSize' => 'large', 'entityTypes' => 'book,chapter', 'entityPermission' => 'page-create'])
</div>
<div class="collapse-content" collapsible-content>
@include('components.entity-selector', ['name' => 'entity_selection', 'selectorSize' => 'large', 'entityTypes' => 'book,chapter', 'entityPermission' => 'page-create'])
</div>
</div>
<div class="form-group text-right">
<a href="{{ $page->getUrl() }}" class="button outline">{{ trans('common.cancel') }}</a>
<button type="submit" class="button primary">{{ trans('entities.pages_copy') }}</button>
</div>
</form>
<div class="form-group text-right">
<a href="{{ $page->getUrl() }}" class="button outline">{{ trans('common.cancel') }}</a>
<button type="submit" class="button pos">{{ trans('entities.pages_copy') }}</button>
</div>
</form>
</div>
</div>
</div>

View File

@ -1,29 +1,39 @@
@extends('simple-layout')
@section('toolbar')
<div class="col-sm-12 faded">
@include('pages._breadcrumbs', ['page' => $page])
</div>
@stop
@section('body')
<div class="container small">
<p>&nbsp;</p>
<div class="card">
<h3>@icon('delete') {{ $page->draft ? trans('entities.pages_delete_draft') : trans('entities.pages_delete') }}</h3>
<div class="body">
<p class="text-neg">{{ $page->draft ? trans('entities.pages_delete_draft_confirm'): trans('entities.pages_delete_confirm') }}</p>
<form action="{{ $page->getUrl() }}" method="POST">
{!! csrf_field() !!}
<input type="hidden" name="_method" value="DELETE">
<div class="form-group">
<a href="{{ $page->getUrl() }}" class="button outline">{{ trans('common.cancel') }}</a>
<button type="submit" class="button neg">{{ trans('common.confirm') }}</button>
</div>
</form>
</div>
<div class="my-l">
@include('partials.breadcrumbs', ['crumbs' => [
$page->book,
$page->chapter,
$page,
$page->getUrl('/delete') => trans('entities.pages_delete')
]])
</div>
<div class="card content-wrap auto-height">
<h1 class="list-heading">{{ $page->draft ? trans('entities.pages_delete_draft') : trans('entities.pages_delete') }}</h1>
<p class="text-neg">
<strong>
{{ $page->draft ? trans('entities.pages_delete_draft_confirm'): trans('entities.pages_delete_confirm') }}
</strong>
</p>
{{--TODO - Looks strange--}}
<form action="{{ $page->getUrl() }}" method="POST">
{!! csrf_field() !!}
<input type="hidden" name="_method" value="DELETE">
<div class="form-group text-right">
<a href="{{ $page->getUrl() }}" class="button outline">{{ trans('common.cancel') }}</a>
<button type="submit" class="button primary">{{ trans('common.confirm') }}</button>
</div>
</form>
</div>
</div>

View File

@ -1,30 +1,33 @@
@extends('simple-layout')
@section('toolbar')
<div class="col-sm-12 faded">
@include('pages._breadcrumbs', ['page' => $page])
</div>
@stop
@section('body')
<div class="container small">
<p>&nbsp;</p>
<div class="card">
<h3>@icon('folder') {{ trans('entities.pages_move') }}</h3>
<div class="body">
<form action="{{ $page->getUrl('/move') }}" method="POST">
{!! csrf_field() !!}
<input type="hidden" name="_method" value="PUT">
@include('components.entity-selector', ['name' => 'entity_selection', 'selectorSize' => 'large', 'entityTypes' => 'book,chapter', 'entityPermission' => 'page-create'])
<div class="my-l">
@include('partials.breadcrumbs', ['crumbs' => [
$page->book,
$page->chapter,
$page,
$page->getUrl('/move') => trans('entities.pages_move')
]])
</div>
<div class="card content-wrap">
<h1 class="list-heading">{{ trans('entities.pages_move') }}</h1>
<form action="{{ $page->getUrl('/move') }}" method="POST">
{!! csrf_field() !!}
<input type="hidden" name="_method" value="PUT">
@include('components.entity-selector', ['name' => 'entity_selection', 'selectorSize' => 'large', 'entityTypes' => 'book,chapter', 'entityPermission' => 'page-create'])
<div class="form-group text-right">
<a href="{{ $page->getUrl() }}" class="button outline">{{ trans('common.cancel') }}</a>
<button type="submit" class="button primary">{{ trans('entities.pages_move') }}</button>
</div>
</form>
<div class="form-group text-right">
<a href="{{ $page->getUrl() }}" class="button outline">{{ trans('common.cancel') }}</a>
<button type="submit" class="button pos">{{ trans('entities.pages_move') }}</button>
</div>
</form>
</div>
</div>
</div>

View File

@ -0,0 +1,22 @@
@extends('simple-layout')
@section('body')
<div class="container">
<div class="my-l">
@include('partials.breadcrumbs', ['crumbs' => [
$page->book,
$page->chapter,
$page,
$page->getUrl('/permissions') => trans('entities.pages_permissions')
]])
</div>
<div class="card content-wrap">
<h1 class="list-heading">{{ trans('entities.pages_permissions') }}</h1>
@include('form.entity-permissions', ['model' => $page])
</div>
</div>
@stop

View File

@ -1,19 +0,0 @@
@extends('simple-layout')
@section('toolbar')
<div class="col-sm-12 faded">
@include('pages._breadcrumbs', ['page' => $page])
</div>
@stop
@section('body')
<div class="container">
<p>&nbsp;</p>
<div class="card">
<h3>@icon('lock') {{ trans('entities.pages_permissions') }}</h3>
<div class="body">
@include('form.entity-permissions', ['model' => $page])
</div>
</div>
</div>
@stop

View File

@ -1,8 +1,8 @@
@extends('sidebar-layout')
@extends('tri-layout')
@section('sidebar')
<div class="card">
<h3>@icon('info') {{ trans('common.details') }}</h3>
@section('left')
<div id="revision-details" class="entity-details mb-xl">
<h5>{{ trans('common.details') }}</h5>
<div class="body text-small text-muted">
@include('partials.entity-meta', ['entity' => $revision])
</div>
@ -11,20 +11,21 @@
@section('body')
<div class="container">
<div class="row">
<div class="col-md-9">
<div class="page-content page-revision">
@include('pages.page-display')
</div>
</div>
<div class="mb-m">
@include('partials.breadcrumbs', ['crumbs' => [
$page->$book,
$page->chapter,
$page,
$page->getUrl('/revisions') => trans('entities.pages_revisions'),
$revision->getUrl('/changes') => $diff ? trans('entities.pages_revisions_numbered_changes', ['id' => $revision->id]) : null,
$revision->getUrl() => !$diff ? trans('entities.pages_revisions_numbered', ['id' => $revision->id]) : null,
]])
</div>
<div class="card content-wrap">
<div class="page-content page-revision">
@include('pages.page-display')
</div>
</div>
@stop
@section('scripts')
<script>
setupPageShow(null);
</script>
@stop

View File

@ -1,76 +1,76 @@
@extends('simple-layout')
@section('toolbar')
<div class="col-sm-12 faded">
@include('pages._breadcrumbs', ['page' => $page])
</div>
@stop
@section('body')
<div class="container">
<p>&nbsp;</p>
<div class="card">
<h3>@icon('history') {{ trans('entities.pages_revisions') }}</h3>
<div class="body">
@if(count($page->revisions) > 0)
<div class="my-l">
@include('partials.breadcrumbs', ['crumbs' => [
$page->book,
$page->chapter,
$page,
$page->getUrl('/revisions') => trans('entities.pages_revisions')
]])
</div>
<table class="table">
<div class="card content-wrap">
<h1 class="list-heading">{{ trans('entities.pages_revisions') }}</h1>
@if(count($page->revisions) > 0)
<table class="table">
<tr>
<th width="3%">{{ trans('entities.pages_revisions_number') }}</th>
<th width="23%">{{ trans('entities.pages_name') }}</th>
<th colspan="2" width="8%">{{ trans('entities.pages_revisions_created_by') }}</th>
<th width="15%">{{ trans('entities.pages_revisions_date') }}</th>
<th width="25%">{{ trans('entities.pages_revisions_changelog') }}</th>
<th width="20%">{{ trans('common.actions') }}</th>
</tr>
@foreach($page->revisions as $index => $revision)
<tr>
<th width="3%">{{ trans('entities.pages_revisions_number') }}</th>
<th width="23%">{{ trans('entities.pages_name') }}</th>
<th colspan="2" width="8%">{{ trans('entities.pages_revisions_created_by') }}</th>
<th width="15%">{{ trans('entities.pages_revisions_date') }}</th>
<th width="25%">{{ trans('entities.pages_revisions_changelog') }}</th>
<th width="20%">{{ trans('common.actions') }}</th>
</tr>
@foreach($page->revisions as $index => $revision)
<tr>
<td>{{ $revision->revision_number == 0 ? '' : $revision->revision_number }}</td>
<td>{{ $revision->name }}</td>
<td style="line-height: 0;">
@if($revision->createdBy)
<img class="avatar" src="{{ $revision->createdBy->getAvatar(30) }}" alt="{{ $revision->createdBy->name }}">
@endif
</td>
<td> @if($revision->createdBy) {{ $revision->createdBy->name }} @else {{ trans('common.deleted_user') }} @endif</td>
<td><small>{{ $revision->created_at->format('jS F, Y H:i:s') }} <br> ({{ $revision->created_at->diffForHumans() }})</small></td>
<td>{{ $revision->summary }}</td>
<td class="actions">
<a href="{{ $revision->getUrl('changes') }}" target="_blank">{{ trans('entities.pages_revisions_changes') }}</a>
<td>{{ $revision->revision_number == 0 ? '' : $revision->revision_number }}</td>
<td>{{ $revision->name }}</td>
<td style="line-height: 0;">
@if($revision->createdBy)
<img class="avatar" src="{{ $revision->createdBy->getAvatar(30) }}" alt="{{ $revision->createdBy->name }}">
@endif
</td>
<td> @if($revision->createdBy) {{ $revision->createdBy->name }} @else {{ trans('common.deleted_user') }} @endif</td>
<td><small>{{ $revision->created_at->format('jS F, Y H:i:s') }} <br> ({{ $revision->created_at->diffForHumans() }})</small></td>
<td>{{ $revision->summary }}</td>
<td class="actions">
<a href="{{ $revision->getUrl('changes') }}" target="_blank">{{ trans('entities.pages_revisions_changes') }}</a>
<span class="text-muted">&nbsp;|&nbsp;</span>
@if ($index === 0)
<a target="_blank" href="{{ $page->getUrl() }}"><i>{{ trans('entities.pages_revisions_current') }}</i></a>
@else
<a href="{{ $revision->getUrl() }}" target="_blank">{{ trans('entities.pages_revisions_preview') }}</a>
<span class="text-muted">&nbsp;|&nbsp;</span>
<a href="{{ $revision->getUrl('restore') }}">{{ trans('entities.pages_revisions_restore') }}</a>
<span class="text-muted">&nbsp;|&nbsp;</span>
<div dropdown class="dropdown-container">
<a dropdown-toggle>{{ trans('common.delete') }}</a>
<ul>
<li class="padded"><small class="text-muted">{{trans('entities.revision_delete_confirm')}}</small></li>
<li>
<form action="{{ $revision->getUrl('/delete/') }}" method="POST">
{!! csrf_field() !!}
<input type="hidden" name="_method" value="DELETE">
<button type="submit" class="text-button neg">@icon('delete'){{ trans('common.delete') }}</button>
</form>
</li>
</ul>
</div>
@endif
</td>
</tr>
@endforeach
</table>
@if ($index === 0)
<a target="_blank" href="{{ $page->getUrl() }}"><i>{{ trans('entities.pages_revisions_current') }}</i></a>
@else
<a href="{{ $revision->getUrl() }}" target="_blank">{{ trans('entities.pages_revisions_preview') }}</a>
<span class="text-muted">&nbsp;|&nbsp;</span>
<a href="{{ $revision->getUrl('restore') }}">{{ trans('entities.pages_revisions_restore') }}</a>
<span class="text-muted">&nbsp;|&nbsp;</span>
<div dropdown class="dropdown-container">
<a dropdown-toggle>{{ trans('common.delete') }}</a>
<ul>
<li class="padded"><small class="text-muted">{{trans('entities.revision_delete_confirm')}}</small></li>
<li>
<form action="{{ $revision->getUrl('/delete/') }}" method="POST">
{!! csrf_field() !!}
<input type="hidden" name="_method" value="DELETE">
<button type="submit" class="text-button neg">@icon('delete'){{ trans('common.delete') }}</button>
</form>
</li>
</ul>
</div>
@endif
</td>
</tr>
@endforeach
</table>
@else
<p>{{ trans('entities.pages_revisions_none') }}</p>
@endif
</div>
@else
<p>{{ trans('entities.pages_revisions_none') }}</p>
@endif
</div>
</div>

View File

@ -1,5 +1,5 @@
<div>
<form action="{{ baseUrl("/settings/users/{$currentUser->id}/switch-book-view") }}" method="POST" class="inline">
<form action="{{ baseUrl("/settings/users/{$currentUser->id}/switch-${type}-view") }}" method="POST" class="inline">
{!! csrf_field() !!}
{!! method_field('PATCH') !!}
<input type="hidden" value="{{ $view === 'list'? 'grid' : 'list' }}" name="view_type">

View File

@ -1,30 +1,24 @@
@extends('simple-layout')
@section('toolbar')
<div class="col-sm-8 faded">
<div class="breadcrumbs">
<a href="{{ baseUrl('/shelves') }}" class="text-button">@icon('bookshelf'){{ trans('entities.shelves') }}</a>
<span class="sep">&raquo;</span>
<a href="{{ baseUrl('/create-shelf') }}" class="text-button">@icon('add'){{ trans('entities.shelves_create') }}</a>
</div>
</div>
@stop
@section('body')
<div class="container small">
<p>&nbsp;</p>
<div class="card">
<h3>@icon('add') {{ trans('entities.shelves_create') }}</h3>
<div class="body">
<form action="{{ baseUrl("/shelves") }}" method="POST" enctype="multipart/form-data">
@include('shelves/form', ['shelf' => null, 'books' => $books])
</form>
</div>
</div>
</div>
<p class="margin-top large"><br></p>
<div class="my-l">
@include('partials.breadcrumbs', ['crumbs' => [
'/shelves' => trans('entities.shelves'),
'/create-shelf' => trans('entities.shelves_create')
]])
</div>
<div class="card content-wrap">
<h1 class="list-heading">{{ trans('entities.shelves_create') }}</h1>
<form action="{{ baseUrl("/shelves") }}" method="POST" enctype="multipart/form-data">
@include('shelves.form', ['shelf' => null, 'books' => $books])
</form>
</div>
</div>
@include('components.image-manager', ['imageType' => 'cover'])

View File

@ -1,5 +1,5 @@
{{ csrf_field() }}
<div class="form-group title-input">
<label for="name">{{ trans('common.name') }}</label>
@include('form/text', ['name' => 'name'])
@ -80,5 +80,5 @@
<div class="form-group text-right">
<a href="{{ isset($shelf) ? $shelf->getUrl() : baseUrl('/shelves') }}" class="button outline">{{ trans('common.cancel') }}</a>
<button type="submit" class="button pos">{{ trans('entities.shelves_save') }}</button>
<button type="submit" class="button primary">{{ trans('entities.shelves_save') }}</button>
</div>

View File

@ -1,48 +1,51 @@
@extends('sidebar-layout')
@extends('tri-layout')
@section('toolbar')
<div class="col-xs-6 faded">
<div class="action-buttons text-left">
@include('shelves/view-toggle', ['shelvesViewType' => $shelvesViewType])
</div>
@section('body')
<div class="content-wrap card">
@include('shelves.list', ['shelves' => $shelves, 'view' => $view])
</div>
<div class="col-xs-6 faded">
<div class="action-buttons">
@stop
@section('right')
<div class="actions mb-xl">
<h5>{{ trans('common.actions') }}</h5>
<div class="icon-list text-primary">
@include('partials.view-toggle', ['view' => $view, 'type' => 'shelf'])
@if($currentUser->can('bookshelf-create-all'))
<a href="{{ baseUrl("/create-shelf") }}" class="text-pos text-button">@icon('add'){{ trans('entities.shelves_create') }}</a>
<a href="{{ baseUrl("/create-shelf") }}" class="icon-list-item">
<span class="icon">@icon('add')</span>
<span>{{ trans('entities.shelves_create') }}</span>
</a>
@endif
</div>
</div>
@stop
@section('sidebar')
@section('left')
@if($recents)
<div id="recents" class="card">
<h3>@icon('view') {{ trans('entities.recently_viewed') }}</h3>
@include('partials/entity-list', ['entities' => $recents, 'style' => 'compact'])
<div id="recents-shelves">
<h5>{{ trans('entities.recently_viewed') }}</h5>
@include('partials.entity-list', ['entities' => $recents, 'style' => 'compact'])
</div>
@endif
<div id="popular" class="card">
<h3>@icon('popular') {{ trans('entities.shelves_popular') }}</h3>
<div id="popular-shelves">
<h5>{{ trans('entities.shelves_popular') }}</h5>
@if(count($popular) > 0)
@include('partials/entity-list', ['entities' => $popular, 'style' => 'compact'])
@include('partials.entity-list', ['entities' => $popular, 'style' => 'compact'])
@else
<div class="body text-muted">{{ trans('entities.shelves_popular_empty') }}</div>
<div class="text-muted">{{ trans('entities.shelves_popular_empty') }}</div>
@endif
</div>
<div id="new" class="card">
<h3>@icon('star-circle') {{ trans('entities.shelves_new') }}</h3>
<div id="new-shelves">
<h5>{{ trans('entities.shelves_new') }}</h5>
@if(count($new) > 0)
@include('partials/entity-list', ['entities' => $new, 'style' => 'compact'])
@include('partials.entity-list', ['entities' => $new, 'style' => 'compact'])
@else
<div class="body text-muted">{{ trans('entities.shelves_new_empty') }}</div>
<div class="text-muted">{{ trans('entities.shelves_new_empty') }}</div>
@endif
</div>
@stop
@section('body')
@include('shelves/list', ['shelves' => $shelves, 'shelvesViewType' => $shelvesViewType])
<p><br></p>
@stop

View File

@ -1,8 +1,10 @@
<div class="container{{ $shelvesViewType === 'list' ? ' small' : '' }}">
<div class="container{{ $view === 'list' ? ' small' : '' }}">
{{--TODO - Align with books page, Have sorting operations--}}
{{--TODO - Create unique list item--}}
<h1>{{ trans('entities.shelves') }}</h1>
@if(count($shelves) > 0)
@if($shelvesViewType === 'grid')
@if($view === 'grid')
<div class="grid third">
@foreach($shelves as $key => $shelf)
@include('shelves/grid-item', ['bookshelf' => $shelf])

View File

@ -1,10 +0,0 @@
<form action="{{ baseUrl("/settings/users/{$currentUser->id}/switch-shelf-view") }}" method="POST" class="inline">
{!! csrf_field() !!}
{!! method_field('PATCH') !!}
<input type="hidden" value="{{ $shelvesViewType === 'list'? 'grid' : 'list' }}" name="view_type">
@if ($shelvesViewType === 'list')
<button type="submit" class="text-pos text-button">@icon('grid'){{ trans('common.grid_view') }}</button>
@else
<button type="submit" class="text-pos text-button">@icon('list'){{ trans('common.list_view') }}</button>
@endif
</form>

View File

@ -65,8 +65,8 @@ Route::group(['middleware' => 'auth'], function () {
Route::post('/{bookSlug}/page/{pageSlug}/copy', 'PageController@copy');
Route::get('/{bookSlug}/page/{pageSlug}/delete', 'PageController@showDelete');
Route::get('/{bookSlug}/draft/{pageId}/delete', 'PageController@showDeleteDraft');
Route::get('/{bookSlug}/page/{pageSlug}/permissions', 'PageController@showRestrict');
Route::put('/{bookSlug}/page/{pageSlug}/permissions', 'PageController@restrict');
Route::get('/{bookSlug}/page/{pageSlug}/permissions', 'PageController@showPermissions');
Route::put('/{bookSlug}/page/{pageSlug}/permissions', 'PageController@permissions');
Route::put('/{bookSlug}/page/{pageSlug}', 'PageController@update');
Route::delete('/{bookSlug}/page/{pageSlug}', 'PageController@destroy');
Route::delete('/{bookSlug}/draft/{pageId}', 'PageController@destroyDraft');
@ -88,11 +88,11 @@ Route::group(['middleware' => 'auth'], function () {
Route::get('/{bookSlug}/chapter/{chapterSlug}/move', 'ChapterController@showMove');
Route::put('/{bookSlug}/chapter/{chapterSlug}/move', 'ChapterController@move');
Route::get('/{bookSlug}/chapter/{chapterSlug}/edit', 'ChapterController@edit');
Route::get('/{bookSlug}/chapter/{chapterSlug}/permissions', 'ChapterController@showRestrict');
Route::get('/{bookSlug}/chapter/{chapterSlug}/permissions', 'ChapterController@showPermissions');
Route::get('/{bookSlug}/chapter/{chapterSlug}/export/pdf', 'ChapterController@exportPdf');
Route::get('/{bookSlug}/chapter/{chapterSlug}/export/html', 'ChapterController@exportHtml');
Route::get('/{bookSlug}/chapter/{chapterSlug}/export/plaintext', 'ChapterController@exportPlainText');
Route::put('/{bookSlug}/chapter/{chapterSlug}/permissions', 'ChapterController@restrict');
Route::put('/{bookSlug}/chapter/{chapterSlug}/permissions', 'ChapterController@permissions');
Route::get('/{bookSlug}/chapter/{chapterSlug}/delete', 'ChapterController@showDelete');
Route::delete('/{bookSlug}/chapter/{chapterSlug}', 'ChapterController@destroy');
});