1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2024-11-23 11:22:33 +01:00

Updated a bunch of book views

This commit is contained in:
Dan Brown 2019-01-31 20:37:12 +00:00
parent 0efed43389
commit 32603362a6
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9
16 changed files with 144 additions and 132 deletions

View File

@ -275,12 +275,12 @@ class BookController extends Controller
* @param $bookSlug
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function showRestrict($bookSlug)
public function showPermissions($bookSlug)
{
$book = $this->entityRepo->getBySlug('book', $bookSlug);
$this->checkOwnablePermission('restrictions-manage', $book);
$roles = $this->userRepo->getRestrictableRoles();
return view('books/restrictions', [
return view('books.permissions', [
'book' => $book,
'roles' => $roles
]);
@ -289,11 +289,12 @@ class BookController extends Controller
/**
* Set the restrictions for this book.
* @param $bookSlug
* @param $bookSlug
* @param Request $request
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
* @throws \BookStack\Exceptions\NotFoundException
* @throws \Throwable
*/
public function restrict($bookSlug, Request $request)
public function permissions($bookSlug, Request $request)
{
$book = $this->entityRepo->getBySlug('book', $bookSlug);
$this->checkOwnablePermission('restrictions-manage', $book);

View File

@ -175,7 +175,7 @@
background-color: #FFF;
box-shadow: $bs-card;
border-radius: 3px;
padding-bottom: $-xs;
border: 1px solid transparent;
h3 {
padding: $-m;
padding-bottom: $-xs;

View File

@ -57,6 +57,9 @@ body.flexbox {
margin-bottom: $-xl;
overflow: auto;
min-height: 60vh;
&.auto-height {
min-height: 0;
}
}
.tri-layout-container {
@ -199,6 +202,14 @@ div[class^="col-"] img {
&.third {
grid-template-columns: 1fr 1fr 1fr;
}
&.left-focus {
grid-template-columns: 2fr 1fr;
}
&.large-gap {
grid-column-gap: $-xl;
grid-row-gap: $-xl;
justify-items: start;
}
}
.grid-card {
@ -255,6 +266,9 @@ div[class^="col-"] img {
.grid.third {
grid-template-columns: 1fr 1fr;
}
.grid.left-focus {
grid-template-columns: 1fr;
}
}
@include smaller-than($s) {

View File

@ -91,6 +91,9 @@
padding-left: 1.5rem;
padding-bottom: .2rem;
}
.icon {
z-index: 2;
}
&:after, .sub-menu:after {
content: '';
display: block;
@ -100,7 +103,7 @@
bottom: 1rem;
border-left: 2px solid #DDD;
opacity: 0.6;
z-index: 1;
z-index: 0;
}
}

View File

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

View File

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

View File

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

View File

@ -1,53 +1,54 @@
@extends('simple-layout')
@section('toolbar')
<div class="col-sm-12 faded">
@include('books._breadcrumbs', ['book' => $book])
</div>
@stop
@section('body')
<div class="container">
<div class="row">
<div class="col-md-8">
<div class="card">
<h3>@icon('sort') {{ trans('entities.books_sort') }}</h3>
<div class="body">
<div id="sort-boxes">
@include('books/sort-box', ['book' => $book, 'bookChildren' => $bookChildren])
</div>
<form action="{{ $book->getUrl('/sort') }}" method="POST">
{!! csrf_field() !!}
<input type="hidden" name="_method" value="PUT">
<input type="hidden" id="sort-tree-input" name="sort-tree">
<div class="list">
<a href="{{ $book->getUrl() }}" class="button outline">{{ trans('common.cancel') }}</a>
<button class="button pos" type="submit">{{ trans('entities.books_sort_save') }}</button>
</div>
</form>
</div>
</div>
</div>
@if(count($books) > 1)
<div class="col-md-4">
<div class="card">
<h3>@icon('book') {{ trans('entities.books_sort_show_other') }}</h3>
<div class="body" id="additional-books">
@foreach($books as $otherBook)
@if($otherBook->id !== $book->id)
<div>
<a href="{{ $otherBook->getUrl('/sort-item') }}" class="text-book">@icon('book'){{ $otherBook->name }}</a>
</div>
@endif
@endforeach
</div>
</div>
</div>
@endif
<div class="my-l">
@include('partials.breadcrumbs', ['crumbs' => [
$book,
$book->getUrl('/sort') => trans('entities.books_sort')
]])
</div>
<div class="grid left-focus large-gap">
<div>
<div class="card content-wrap">
<h1 class="list-heading">{{ trans('entities.books_sort') }}</h1>
<div id="sort-boxes">
@include('books/sort-box', ['book' => $book, 'bookChildren' => $bookChildren])
</div>
<form action="{{ $book->getUrl('/sort') }}" method="POST">
{!! csrf_field() !!}
<input type="hidden" name="_method" value="PUT">
<input type="hidden" id="sort-tree-input" name="sort-tree">
<div class="list text-right">
<a href="{{ $book->getUrl() }}" class="button outline">{{ trans('common.cancel') }}</a>
<button class="button primary" type="submit">{{ trans('entities.books_sort_save') }}</button>
</div>
</form>
</div>
</div>
<div>
@if(count($books) > 1)
<div class="card content-wrap">
<h2 class="list-heading">{{ trans('entities.books_sort_show_other') }}</h2>
<div id="additional-books">
@foreach($books as $otherBook)
@if($otherBook->id !== $book->id)
<div>
<a href="{{ $otherBook->getUrl('/sort-item') }}" class="text-book">@icon('book'){{ $otherBook->name }}</a>
</div>
@endif
@endforeach
</div>
</div>
@endif
</div>
</div>
</div>
@stop

View File

@ -1,26 +1,21 @@
@extends('simple-layout')
@section('toolbar')
<div class="col-sm-12 faded">
<div class="breadcrumbs">
<a href="{{ $book->getUrl() }}" class="text-book text-button">@icon('book'){{ $book->getShortName() }}</a>
<span class="sep">&raquo;</span>
<a href="{{ $book->getUrl('/create-chapter')}}" class="text-button">@icon('add'){{ trans('entities.chapters_create') }}</a>
</div>
</div>
@stop
@section('body')
<div class="container small">
<div class="card">
<h3>@icon('add') {{ trans('entities.chapters_create') }}</h3>
<div class="body">
<form action="{{ $book->getUrl('/create-chapter') }}" method="POST">
@include('chapters/form')
</form>
</div>
</div>
</div>
<div class="my-l">
@include('partials.breadcrumbs', ['crumbs' => [
$book,
$book->getUrl('create-chapter') => trans('entities.chapters_create')
]])
</div>
<div class="content-wrap card">
<h1 class="list-heading">{{ trans('entities.chapters_create') }}</h1>
<form action="{{ $book->getUrl('/create-chapter') }}" method="POST">
@include('chapters/form')
</form>
</div>
</div>
@stop

View File

@ -1,24 +1,25 @@
@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('edit') {{ trans('entities.chapters_edit') }}</h3>
<div class="body">
<form action="{{ $chapter->getUrl() }}" method="POST">
<input type="hidden" name="_method" value="PUT">
@include('chapters/form', ['model' => $chapter])
</form>
</div>
<div class="my-l">
@include('partials.breadcrumbs', ['crumbs' => [
$book,
$chapter,
$chapter->getUrl('/edit') => trans('entities.chapters_edit')
]])
</div>
<div class="content-wrap card">
<h1 class="list-heading">{{ trans('entities.chapters_edit') }}</h1>
<form action="{{ $chapter->getUrl() }}" method="POST">
<input type="hidden" name="_method" value="PUT">
@include('chapters/form', ['model' => $chapter])
</form>
</div>
</div>
@stop

View File

@ -22,5 +22,5 @@
<div class="form-group text-right">
<a href="{{ isset($chapter) ? $chapter->getUrl() : $book->getUrl() }}" class="button outline">{{ trans('common.cancel') }}</a>
<button type="submit" class="button pos">{{ trans('entities.chapters_save') }}</button>
<button type="submit" class="button primary">{{ trans('entities.chapters_save') }}</button>
</div>

View File

@ -13,7 +13,7 @@
<div class="card">
<h3>@icon('lock') {{ trans('entities.chapters_permissions') }}</h3>
<div class="body">
@include('form/restriction-form', ['model' => $chapter])
@include('form.entity-permissions', ['model' => $chapter])
</div>
</div>
</div>

View File

@ -8,7 +8,6 @@
@include('form/checkbox', ['name' => 'restricted', 'label' => trans('entities.permissions_enable')])
</div>
<table class="table">
<tr>
<th>{{ trans('common.role') }}</th>
@ -29,6 +28,6 @@
<div class="text-right">
<a href="{{ $model->getUrl() }}" class="button outline">{{ trans('common.cancel') }}</a>
<button type="submit" class="button pos">{{ trans('entities.permissions_save') }}</button>
<button type="submit" class="button primary">{{ trans('entities.permissions_save') }}</button>
</div>
</form>

View File

@ -12,7 +12,7 @@
<div class="card">
<h3>@icon('lock') {{ trans('entities.pages_permissions') }}</h3>
<div class="body">
@include('form.restriction-form', ['model' => $page])
@include('form.entity-permissions', ['model' => $page])
</div>
</div>
</div>

View File

@ -13,7 +13,7 @@
<div class="card">
<h3>@icon('lock') {{ trans('entities.shelves_permissions') }}</h3>
<div class="body">
@include('form/restriction-form', ['model' => $shelf])
@include('form.entity-permissions', ['model' => $shelf])
</div>
</div>

View File

@ -40,8 +40,8 @@ Route::group(['middleware' => 'auth'], function () {
Route::delete('/{id}', 'BookController@destroy');
Route::get('/{slug}/sort-item', 'BookController@getSortItem');
Route::get('/{slug}', 'BookController@show');
Route::get('/{bookSlug}/permissions', 'BookController@showRestrict');
Route::put('/{bookSlug}/permissions', 'BookController@restrict');
Route::get('/{bookSlug}/permissions', 'BookController@showPermissions');
Route::put('/{bookSlug}/permissions', 'BookController@permissions');
Route::get('/{slug}/delete', 'BookController@showDelete');
Route::get('/{bookSlug}/sort', 'BookController@sort');
Route::put('/{bookSlug}/sort', 'BookController@saveSort');