mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-01 01:36:00 -04:00
Expanded chapters interface and improved book/page deletion
This commit is contained in:
parent
b9df3c647a
commit
fd1a0dceb2
@ -78,8 +78,7 @@ class BookController extends Controller
|
||||
public function show($slug)
|
||||
{
|
||||
$book = $this->bookRepo->getBySlug($slug);
|
||||
$pageTree = $this->pageRepo->getTreeByBookId($book->id);
|
||||
return view('books/show', ['book' => $book, 'pageTree' => $pageTree]);
|
||||
return view('books/show', ['book' => $book]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -118,15 +117,26 @@ class BookController extends Controller
|
||||
return redirect($book->getUrl());
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the page to confirm deletion
|
||||
* @param $bookSlug
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function showDelete($bookSlug)
|
||||
{
|
||||
$book = $this->bookRepo->getBySlug($bookSlug);
|
||||
return view('books/delete', ['book' => $book]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified book from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @param $bookSlug
|
||||
* @return Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
public function destroy($bookSlug)
|
||||
{
|
||||
$this->bookRepo->destroyById($id);
|
||||
$this->bookRepo->destroyBySlug($bookSlug);
|
||||
return redirect('/books');
|
||||
}
|
||||
}
|
||||
|
@ -25,20 +25,10 @@ class ChapterController extends Controller
|
||||
$this->bookRepo = $bookRepo;
|
||||
$this->chapterRepo = $chapterRepo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* Show the form for creating a new chapter.
|
||||
*
|
||||
* @param $bookSlug
|
||||
* @return Response
|
||||
@ -50,7 +40,7 @@ class ChapterController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* Store a newly created chapter in storage.
|
||||
*
|
||||
* @param $bookSlug
|
||||
* @param Request $request
|
||||
@ -65,52 +55,88 @@ class ChapterController extends Controller
|
||||
$book = $this->bookRepo->getBySlug($bookSlug);
|
||||
$chapter = $this->chapterRepo->newFromInput($request->all());
|
||||
$chapter->slug = $this->chapterRepo->findSuitableSlug($chapter->name, $book->id);
|
||||
$chapter->priority = $this->bookRepo->getNewPriority($book);
|
||||
$book->chapters()->save($chapter);
|
||||
return redirect($book->getUrl());
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
* Display the specified chapter.
|
||||
*
|
||||
* @param int $id
|
||||
* @param $bookSlug
|
||||
* @param $chapterSlug
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id)
|
||||
public function show($bookSlug, $chapterSlug)
|
||||
{
|
||||
//
|
||||
$book = $this->bookRepo->getBySlug($bookSlug);
|
||||
$chapter = $this->chapterRepo->getBySlug($chapterSlug, $book->id);
|
||||
return view('chapters/show', ['book' => $book, 'chapter' => $chapter]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* Show the form for editing the specified chapter.
|
||||
*
|
||||
* @param int $id
|
||||
* @param $bookSlug
|
||||
* @param $chapterSlug
|
||||
* @return Response
|
||||
*/
|
||||
public function edit($id)
|
||||
public function edit($bookSlug, $chapterSlug)
|
||||
{
|
||||
//
|
||||
$book = $this->bookRepo->getBySlug($bookSlug);
|
||||
$chapter = $this->chapterRepo->getBySlug($chapterSlug, $book->id);
|
||||
return view('chapters/edit', ['book' => $book, 'chapter' => $chapter]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* Update the specified chapter in storage.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param int $id
|
||||
* @param Request $request
|
||||
* @param $bookSlug
|
||||
* @param $chapterSlug
|
||||
* @return Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
public function update(Request $request, $bookSlug, $chapterSlug)
|
||||
{
|
||||
//
|
||||
$book = $this->bookRepo->getBySlug($bookSlug);
|
||||
$chapter = $this->chapterRepo->getBySlug($chapterSlug, $book->id);
|
||||
$chapter->fill($request->all());
|
||||
$chapter->slug = $this->chapterRepo->findSuitableSlug($chapter->name, $book->id, $chapter->id);
|
||||
$chapter->save();
|
||||
return redirect($chapter->getUrl());
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* Shows the page to confirm deletion of this chapter.
|
||||
* @param $bookSlug
|
||||
* @param $chapterSlug
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function showDelete($bookSlug, $chapterSlug)
|
||||
{
|
||||
$book = $this->bookRepo->getBySlug($bookSlug);
|
||||
$chapter = $this->chapterRepo->getBySlug($chapterSlug, $book->id);
|
||||
return view('chapters/delete', ['book' => $book, 'chapter' => $chapter]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified chapter from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @param $bookSlug
|
||||
* @param $chapterSlug
|
||||
* @return Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
public function destroy($bookSlug, $chapterSlug)
|
||||
{
|
||||
//
|
||||
$book = $this->bookRepo->getBySlug($bookSlug);
|
||||
$chapter = $this->chapterRepo->getBySlug($chapterSlug, $book->id);
|
||||
if(count($chapter->pages) > 0) {
|
||||
foreach($chapter->pages as $page) {
|
||||
$page->chapter_id = 0;
|
||||
$page->save();
|
||||
}
|
||||
}
|
||||
$chapter->delete();
|
||||
return redirect($book->getUrl());
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,6 @@ class PageController extends Controller
|
||||
$this->validate($request, [
|
||||
'name' => 'required|string|max:255',
|
||||
'html' => 'required|string',
|
||||
'priority' => 'integer',
|
||||
'parent' => 'integer|exists:pages,id'
|
||||
]);
|
||||
$book = $this->bookRepo->getBySlug($bookSlug);
|
||||
@ -72,7 +71,8 @@ class PageController extends Controller
|
||||
while($this->pageRepo->countBySlug($slug, $book->id) > 0) {
|
||||
$slug .= '1';
|
||||
}
|
||||
$page->slug =$slug;
|
||||
$page->slug = $slug;
|
||||
$page->priority = $this->bookRepo->getNewPriority($book);
|
||||
|
||||
if($request->has('parent')) {
|
||||
$page->page_id = $request->get('parent');
|
||||
@ -96,9 +96,8 @@ class PageController extends Controller
|
||||
$book = $this->bookRepo->getBySlug($bookSlug);
|
||||
$page = $this->pageRepo->getBySlug($pageSlug, $book->id);
|
||||
$breadCrumbs = $this->pageRepo->getBreadCrumbs($page);
|
||||
$sidebarBookTree = $this->bookRepo->getTree($book, $page->id);
|
||||
//dd($sidebarBookTree);
|
||||
return view('pages/show', ['page' => $page, 'breadCrumbs' => $breadCrumbs, 'book' => $book, 'sidebarBookTree' => $sidebarBookTree]);
|
||||
return view('pages/show', ['page' => $page, 'breadCrumbs' => $breadCrumbs, 'book' => $book]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -187,14 +186,26 @@ class PageController extends Controller
|
||||
return redirect($book->getUrl());
|
||||
}
|
||||
|
||||
public function showDelete($bookSlug, $pageSlug)
|
||||
{
|
||||
$book = $this->bookRepo->getBySlug($bookSlug);
|
||||
$page = $this->pageRepo->getBySlug($pageSlug, $book->id);
|
||||
return view('pages/delete', ['book' => $book, 'page' => $page]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @param $bookSlug
|
||||
* @param $pageSlug
|
||||
* @return Response
|
||||
* @internal param int $id
|
||||
*/
|
||||
public function destroy($id)
|
||||
public function destroy($bookSlug, $pageSlug)
|
||||
{
|
||||
//
|
||||
$book = $this->bookRepo->getBySlug($bookSlug);
|
||||
$page = $this->pageRepo->getBySlug($pageSlug, $book->id);
|
||||
$page->delete();
|
||||
return redirect($book->getUrl());
|
||||
}
|
||||
}
|
||||
|
@ -19,8 +19,9 @@ Route::group(['prefix' => 'books'], function() {
|
||||
Route::post('/', 'BookController@store');
|
||||
Route::get('/{slug}/edit', 'BookController@edit');
|
||||
Route::put('/{slug}', 'BookController@update');
|
||||
Route::delete('/{id}/destroy', 'BookController@destroy');
|
||||
Route::delete('/{id}', 'BookController@destroy');
|
||||
Route::get('/{slug}', 'BookController@show');
|
||||
Route::get('/{slug}/delete', 'BookController@showDelete');
|
||||
|
||||
Route::get('/{bookSlug}/page/create', 'PageController@create');
|
||||
Route::post('/{bookSlug}/page', 'PageController@store');
|
||||
@ -29,10 +30,17 @@ Route::group(['prefix' => 'books'], function() {
|
||||
Route::get('/{bookSlug}/page/{pageSlug}', 'PageController@show');
|
||||
Route::get('/{bookSlug}/page/{pageSlug}/create', 'PageController@create');
|
||||
Route::get('/{bookSlug}/page/{pageSlug}/edit', 'PageController@edit');
|
||||
Route::get('/{bookSlug}/page/{pageSlug}/delete', 'PageController@showDelete');
|
||||
Route::put('/{bookSlug}/page/{pageSlug}', 'PageController@update');
|
||||
Route::delete('/{bookSlug}/page/{pageSlug}', 'PageController@destroy');
|
||||
|
||||
Route::get('/{bookSlug}/chapter/create', 'ChapterController@create');
|
||||
Route::post('/{bookSlug}/chapter/create', 'ChapterController@store');
|
||||
Route::get('/{bookSlug}/chapter/{chapterSlug}', 'ChapterController@show');
|
||||
Route::put('/{bookSlug}/chapter/{chapterSlug}', 'ChapterController@update');
|
||||
Route::get('/{bookSlug}/chapter/{chapterSlug}/edit', 'ChapterController@edit');
|
||||
Route::get('/{bookSlug}/chapter/{chapterSlug}/delete', 'ChapterController@showDelete');
|
||||
Route::delete('/{bookSlug}/chapter/{chapterSlug}', 'ChapterController@destroy');
|
||||
|
||||
});
|
||||
|
||||
|
@ -22,11 +22,6 @@ class Page extends Model
|
||||
return $this->belongsTo('Oxbow\Book');
|
||||
}
|
||||
|
||||
public function children()
|
||||
{
|
||||
return $this->hasMany('Oxbow\Page')->orderBy('priority', 'ASC');
|
||||
}
|
||||
|
||||
public function parent()
|
||||
{
|
||||
return $this->belongsTo('Oxbow\Page', 'page_id');
|
||||
|
@ -44,21 +44,19 @@ class BookRepo
|
||||
return $this->book->where('slug', '=', $slug)->count();
|
||||
}
|
||||
|
||||
public function destroyById($id)
|
||||
public function destroyBySlug($bookSlug)
|
||||
{
|
||||
$book = $this->getById($id);
|
||||
foreach($book->pages as $page) {
|
||||
$this->pageRepo->destroyById($page->id);
|
||||
$book = $this->getBySlug($bookSlug);
|
||||
foreach($book->children() as $child) {
|
||||
$child->delete();
|
||||
}
|
||||
$book->delete();
|
||||
}
|
||||
|
||||
public function getTree($book, $currentPageId = false)
|
||||
public function getNewPriority($book)
|
||||
{
|
||||
$tree = $book->toArray();
|
||||
$tree['pages'] = $this->pageRepo->getTreeByBookId($book->id, $currentPageId);
|
||||
$tree['hasChildren'] = count($tree['pages']) > 0;
|
||||
return $tree;
|
||||
$lastElem = $book->children()->pop();
|
||||
return $lastElem ? $lastElem->priority + 1 : 0;
|
||||
}
|
||||
|
||||
}
|
@ -53,10 +53,10 @@ class ChapterRepo
|
||||
return $query->count() > 0;
|
||||
}
|
||||
|
||||
public function findSuitableSlug($name, $bookId)
|
||||
public function findSuitableSlug($name, $bookId, $currentId = false)
|
||||
{
|
||||
$slug = Str::slug($name);
|
||||
while($this->doesSlugExist($slug, $bookId)) {
|
||||
while($this->doesSlugExist($slug, $bookId, $currentId)) {
|
||||
$slug .= '-' . substr(md5(rand(1, 500)), 0, 3);
|
||||
}
|
||||
return $slug;
|
||||
|
@ -70,44 +70,6 @@ class PageRepo
|
||||
return count($tree) > 0 ? array_reverse($tree) : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a tree of child pages, Nested by their
|
||||
* set parent pages.
|
||||
* @param $bookId
|
||||
* @param bool $currentPageId
|
||||
* @return array
|
||||
*/
|
||||
public function getTreeByBookId($bookId, $currentPageId = false)
|
||||
{
|
||||
$topLevelPages = $this->getTopLevelPages($bookId);
|
||||
$pageTree = [];
|
||||
|
||||
foreach($topLevelPages as $key => $topPage) {
|
||||
$pageTree[$key] = $this->toArrayTree($topPage, $currentPageId);
|
||||
}
|
||||
|
||||
return $pageTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a page tree array with the supplied page
|
||||
* as the parent of the tree.
|
||||
* @param $page
|
||||
* @param bool $currentPageId
|
||||
* @return mixed
|
||||
*/
|
||||
private function toArrayTree($page, $currentPageId = false)
|
||||
{
|
||||
$cPage = $page->toSimpleArray();
|
||||
$cPage['current'] = ($currentPageId !== false && $cPage['id'] === $currentPageId);
|
||||
$cPage['pages'] = [];
|
||||
foreach($page->children as $key => $childPage) {
|
||||
$cPage['pages'][$key] = $this->toArrayTree($childPage, $currentPageId);
|
||||
}
|
||||
$cPage['hasChildren'] = count($cPage['pages']) > 0;
|
||||
return $cPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the pages at the top of the page hierarchy.
|
||||
* @param $bookId
|
||||
|
@ -21,10 +21,21 @@
|
||||
box-shadow: 0 0 4px 2px rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
|
||||
|
||||
.edit-area {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.page-style.editor {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.mce-tinymce {
|
||||
.mce-panel {
|
||||
background-color: #FFF;
|
||||
}
|
||||
.mce-btn {
|
||||
background-color: #FFF;
|
||||
}
|
||||
}
|
22
resources/views/books/delete.blade.php
Normal file
22
resources/views/books/delete.blade.php
Normal file
@ -0,0 +1,22 @@
|
||||
@extends('base')
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="page-content">
|
||||
<h1>Delete Book</h1>
|
||||
<p>This will delete the book with the name '{{$book->name}}', All pages and chapters will be removed.</p>
|
||||
<p class="text-neg">Are you sure you want to delete this book?</p>
|
||||
|
||||
<form action="{{$book->getUrl()}}" method="POST">
|
||||
{!! csrf_field() !!}
|
||||
<input type="hidden" name="_method" value="DELETE">
|
||||
<button type="submit" class="button neg">Confirm</button>
|
||||
<a href="{{$book->getUrl()}}" class="button">Cancel</a>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@stop
|
||||
|
||||
@section('bottom')
|
||||
@include('pages/image-manager')
|
||||
@stop
|
@ -8,12 +8,6 @@
|
||||
<input type="hidden" name="_method" value="PUT">
|
||||
@include('books/form', ['model' => $book])
|
||||
</form>
|
||||
<hr class="margin-top large">
|
||||
<div class="margin-top large shaded padded">
|
||||
<h2 class="margin-top">Delete this book</h2>
|
||||
<p>This will delete this book and all it's pages.</p>
|
||||
@include('form/delete-button', ['url' => '/books/' . $book->id . '/destroy', 'text' => 'Delete'])
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@stop
|
@ -5,9 +5,10 @@
|
||||
<div class="row faded-small">
|
||||
<div class="col-md-6"></div>
|
||||
<div class="col-md-6">
|
||||
<div class="action-buttons">
|
||||
<a href="{{$book->getEditUrl()}}"><i class="fa fa-pencil"></i>Edit Book</a>
|
||||
<a href="{{ $book->getUrl() }}/sort"><i class="fa fa-sort"></i>Sort Pages</a>
|
||||
<div class="action-buttons faded">
|
||||
<a href="{{$book->getEditUrl()}}"><i class="fa fa-pencil"></i>Edit</a>
|
||||
<a href="{{ $book->getUrl() }}/sort"><i class="fa fa-sort"></i>Sort</a>
|
||||
<a href="{{ $book->getUrl() }}/delete"><i class="fa fa-trash"></i>Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -24,16 +25,21 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-list">
|
||||
<div>
|
||||
@foreach($book->children() as $childElement)
|
||||
<div class="page-list-item">
|
||||
@if(is_a($childElement, 'Oxbow\Chapter'))
|
||||
<i class="fa fa-archive"></i>
|
||||
@else
|
||||
<i class="fa fa-file"></i>
|
||||
@endif
|
||||
{{$childElement->name}}
|
||||
<div >
|
||||
<h3>
|
||||
<a href="{{ $childElement->getUrl() }}">
|
||||
@if(is_a($childElement, 'Oxbow\Chapter'))
|
||||
<i class="fa fa-archive"></i>
|
||||
@else
|
||||
<i class="fa fa-file"></i>
|
||||
@endif
|
||||
{{ $childElement->name }}
|
||||
</a>
|
||||
</h3>
|
||||
</div>
|
||||
<hr>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
|
23
resources/views/chapters/delete.blade.php
Normal file
23
resources/views/chapters/delete.blade.php
Normal file
@ -0,0 +1,23 @@
|
||||
@extends('base')
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="page-content">
|
||||
<h1>Delete Chapter</h1>
|
||||
<p>This will delete the chapter with the name '{{$chapter->name}}', All pages will be removed
|
||||
and added directly to the book.</p>
|
||||
<p class="text-neg">Are you sure you want to delete this chapter?</p>
|
||||
|
||||
<form action="{{$chapter->getUrl()}}" method="POST">
|
||||
{!! csrf_field() !!}
|
||||
<input type="hidden" name="_method" value="DELETE">
|
||||
<button type="submit" class="button neg">Confirm</button>
|
||||
<a href="{{$chapter->getUrl()}}" class="button">Cancel</a>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@stop
|
||||
|
||||
@section('bottom')
|
||||
@include('pages/image-manager')
|
||||
@stop
|
13
resources/views/chapters/edit.blade.php
Normal file
13
resources/views/chapters/edit.blade.php
Normal file
@ -0,0 +1,13 @@
|
||||
@extends('base')
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="page-content">
|
||||
<h1>Edit Chapter</h1>
|
||||
<form action="{{$chapter->getUrl()}}" method="POST">
|
||||
<input type="hidden" name="_method" value="PUT">
|
||||
@include('chapters/form', ['model' => $chapter])
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@stop
|
38
resources/views/chapters/show.blade.php
Normal file
38
resources/views/chapters/show.blade.php
Normal file
@ -0,0 +1,38 @@
|
||||
@extends('base')
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="row faded-small">
|
||||
<div class="col-md-6"></div>
|
||||
<div class="col-md-6 faded">
|
||||
<div class="action-buttons">
|
||||
<a href="{{$chapter->getUrl() . '/edit'}}" ><i class="fa fa-pencil"></i>Edit</a>
|
||||
<a href="{{$chapter->getUrl() . '/delete'}}"><i class="fa fa-trash"></i>Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="page-content">
|
||||
<h1>{{ $chapter->name }}</h1>
|
||||
<p class="text-muted">{{ $chapter->description }}</p>
|
||||
@if(count($chapter->pages) > 0)
|
||||
<h4 class="text-muted">Pages</h4>
|
||||
<div class="page-list">
|
||||
@foreach($chapter->pages as $page)
|
||||
<div >
|
||||
<h3>
|
||||
<a href="{{ $page->getUrl() }}">
|
||||
<i class="fa fa-file"></i>
|
||||
{{ $page->name }}
|
||||
</a>
|
||||
</h3>
|
||||
</div>
|
||||
<hr>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
|
||||
@stop
|
21
resources/views/pages/delete.blade.php
Normal file
21
resources/views/pages/delete.blade.php
Normal file
@ -0,0 +1,21 @@
|
||||
@extends('base')
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="page-content">
|
||||
<h1>Delete Page</h1>
|
||||
<p>Are you sure you want to delete this page?</p>
|
||||
|
||||
<form action="{{$page->getUrl()}}" method="POST">
|
||||
{!! csrf_field() !!}
|
||||
<input type="hidden" name="_method" value="DELETE">
|
||||
<button type="submit" class="button neg">Confirm</button>
|
||||
<a href="{{$page->getUrl()}}" class="button">Cancel</a>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@stop
|
||||
|
||||
@section('bottom')
|
||||
@include('pages/image-manager')
|
||||
@stop
|
@ -31,9 +31,10 @@
|
||||
body_class: 'page-content',
|
||||
relative_urls: false,
|
||||
statusbar: false,
|
||||
height: 600,
|
||||
plugins: "image table textcolor paste link imagetools",
|
||||
toolbar: "undo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | table image link | fontsizeselect full",
|
||||
menubar: false,
|
||||
height: 700,
|
||||
plugins: "image table textcolor paste link imagetools fullscreen",
|
||||
toolbar: "undo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | table image link | fontsizeselect fullscreen",
|
||||
content_style: "body {padding-left: 15px !important; padding-right: 15px !important; margin:0!important; margin-left:auto!important;margin-right:auto!important;}",
|
||||
file_browser_callback: function(field_name, url, type, win) {
|
||||
ImageManager.show('#image-manager', function(image) {
|
||||
@ -46,20 +47,20 @@
|
||||
win.document.getElementById(field_name).fireEvent("onchange");
|
||||
}
|
||||
});
|
||||
},
|
||||
setup: function(editor) {
|
||||
editor.addButton('full', {
|
||||
title: 'Expand Editor',
|
||||
icon: 'fullscreen',
|
||||
onclick: function() {
|
||||
var container = $(editor.getContainer()).toggleClass('fullscreen');
|
||||
var isFull = container.hasClass('fullscreen');
|
||||
var iframe = container.find('iframe').first();
|
||||
var height = isFull ? $(window).height()-110 : 600;
|
||||
iframe.css('height', height + 'px');
|
||||
}
|
||||
});
|
||||
}
|
||||
// setup: function(editor) {
|
||||
// editor.addButton('full', {
|
||||
// title: 'Expand Editor',
|
||||
// icon: 'fullscreen',
|
||||
// onclick: function() {
|
||||
// var container = $(editor.getContainer()).toggleClass('fullscreen');
|
||||
// var isFull = container.hasClass('fullscreen');
|
||||
// var iframe = container.find('iframe').first();
|
||||
// var height = isFull ? $(window).height()-110 : 600;
|
||||
// iframe.css('height', height + 'px');
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
});
|
||||
|
||||
|
||||
|
@ -2,10 +2,8 @@
|
||||
|
||||
@section('sidebar')
|
||||
<div class="book-tree">
|
||||
<h4><a href="/books/{{$sidebarBookTree['slug']}}"><i class="fa fa-book"></i>{{$sidebarBookTree['name']}}</a></h4>
|
||||
@if($sidebarBookTree['hasChildren'])
|
||||
@include('pages/sidebar-tree-list', ['pageTree' => $sidebarBookTree['pages']])
|
||||
@endif
|
||||
<h4><a href="{{$book->getUrl()}}"><i class="fa fa-book"></i>{{$book->name}}</a></h4>
|
||||
@include('pages/sidebar-tree-list', ['book' => $book])
|
||||
</div>
|
||||
@stop
|
||||
|
||||
@ -25,8 +23,8 @@
|
||||
</div>
|
||||
<div class="col-md-6 faded">
|
||||
<div class="action-buttons">
|
||||
<a href="{{$page->getUrl() . '/edit'}}" ><i class="fa fa-pencil"></i>Edit this page</a>
|
||||
<a href="{{$page->getUrl() . '/create'}}"><i class="fa fa-file-o"></i>Create Sub-page</a>
|
||||
<a href="{{$page->getUrl() . '/edit'}}" ><i class="fa fa-pencil"></i>Edit</a>
|
||||
<a href="{{$page->getUrl() . '/delete'}}"><i class="fa fa-trash"></i>Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,11 +1,15 @@
|
||||
{{--Requires an array of pages to be passed as $pageTree--}}
|
||||
|
||||
<ul class="sidebar-page-list">
|
||||
@foreach($pageTree as $subPage)
|
||||
<li @if($subPage['hasChildren'])class="has-children"@endif>
|
||||
<a href="{{$subPage['url']}}" @if($subPage['current'])class="bold"@endif>{{$subPage['name']}}</a>
|
||||
@if($subPage['hasChildren'])
|
||||
@include('pages/sidebar-tree-list', ['pageTree' => $subPage['pages']])
|
||||
@foreach($book->children() as $bookChild)
|
||||
<li>
|
||||
{{ $bookChild->name }}
|
||||
@if(is_a($bookChild, 'Oxbow\Chapter') && count($bookChild->pages) > 0)
|
||||
<ul>
|
||||
@foreach($pages as $page)
|
||||
<li>{{ $page->name }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
@endif
|
||||
</li>
|
||||
@endforeach
|
||||
|
Loading…
Reference in New Issue
Block a user