Started work on page move view and entity selector

This commit is contained in:
Dan Brown 2016-06-11 21:04:18 +01:00
parent 61596a8e21
commit 97d011ac8e
9 changed files with 100 additions and 9 deletions

View File

@ -450,6 +450,24 @@ class PageController extends Controller
]); ]);
} }
/**
* Show the view to choose a new parent to move a page into.
* @param $bookSlug
* @param $pageSlug
* @return mixed
* @throws NotFoundException
*/
public function showMove($bookSlug, $pageSlug)
{
$book = $this->bookRepo->getBySlug($bookSlug);
$page = $this->pageRepo->getBySlug($pageSlug, $book->id);
$this->checkOwnablePermission('page-update', $page);
return view('pages/move', [
'book' => $book,
'page' => $page
]);
}
/** /**
* Set the permissions for this page. * Set the permissions for this page.
* @param $bookSlug * @param $bookSlug

View File

@ -34,6 +34,7 @@ Route::group(['middleware' => 'auth'], function () {
Route::get('/{bookSlug}/page/{pageSlug}/export/html', 'PageController@exportHtml'); Route::get('/{bookSlug}/page/{pageSlug}/export/html', 'PageController@exportHtml');
Route::get('/{bookSlug}/page/{pageSlug}/export/plaintext', 'PageController@exportPlainText'); Route::get('/{bookSlug}/page/{pageSlug}/export/plaintext', 'PageController@exportPlainText');
Route::get('/{bookSlug}/page/{pageSlug}/edit', 'PageController@edit'); Route::get('/{bookSlug}/page/{pageSlug}/edit', 'PageController@edit');
Route::get('/{bookSlug}/page/{pageSlug}/move', 'PageController@showMove');
Route::get('/{bookSlug}/page/{pageSlug}/delete', 'PageController@showDelete'); Route::get('/{bookSlug}/page/{pageSlug}/delete', 'PageController@showDelete');
Route::get('/{bookSlug}/draft/{pageId}/delete', 'PageController@showDeleteDraft'); Route::get('/{bookSlug}/draft/{pageId}/delete', 'PageController@showDeleteDraft');
Route::get('/{bookSlug}/page/{pageSlug}/permissions', 'PageController@showRestrict'); Route::get('/{bookSlug}/page/{pageSlug}/permissions', 'PageController@showRestrict');

View File

@ -149,7 +149,10 @@ module.exports = function (ngApp, events) {
}; };
}]); }]);
/**
* Dropdown
* Provides some simple logic to create small dropdown menus
*/
ngApp.directive('dropdown', [function () { ngApp.directive('dropdown', [function () {
return { return {
restrict: 'A', restrict: 'A',
@ -166,6 +169,10 @@ module.exports = function (ngApp, events) {
}; };
}]); }]);
/**
* TinyMCE
* An angular wrapper around the tinyMCE editor.
*/
ngApp.directive('tinymce', ['$timeout', function ($timeout) { ngApp.directive('tinymce', ['$timeout', function ($timeout) {
return { return {
restrict: 'A', restrict: 'A',
@ -231,6 +238,10 @@ module.exports = function (ngApp, events) {
} }
}]); }]);
/**
* Markdown input
* Handles the logic for just the editor input field.
*/
ngApp.directive('markdownInput', ['$timeout', function ($timeout) { ngApp.directive('markdownInput', ['$timeout', function ($timeout) {
return { return {
restrict: 'A', restrict: 'A',
@ -263,6 +274,10 @@ module.exports = function (ngApp, events) {
} }
}]); }]);
/**
* Markdown Editor
* Handles all functionality of the markdown editor.
*/
ngApp.directive('markdownEditor', ['$timeout', function ($timeout) { ngApp.directive('markdownEditor', ['$timeout', function ($timeout) {
return { return {
restrict: 'A', restrict: 'A',
@ -342,6 +357,11 @@ module.exports = function (ngApp, events) {
} }
}]); }]);
/**
* Page Editor Toolbox
* Controls all functionality for the sliding toolbox
* on the page edit view.
*/
ngApp.directive('toolbox', [function () { ngApp.directive('toolbox', [function () {
return { return {
restrict: 'A', restrict: 'A',
@ -378,6 +398,11 @@ module.exports = function (ngApp, events) {
} }
}]); }]);
/**
* Tag Autosuggestions
* Listens to child inputs and provides autosuggestions depending on field type
* and input. Suggestions provided by server.
*/
ngApp.directive('tagAutosuggestions', ['$http', function ($http) { ngApp.directive('tagAutosuggestions', ['$http', function ($http) {
return { return {
restrict: 'A', restrict: 'A',
@ -557,6 +582,17 @@ module.exports = function (ngApp, events) {
} }
} }
}]); }]);
ngApp.directive('entitySelector', ['$http', function ($http) {
return {
restrict: 'A',
link: function (scope, element, attrs) {
scope.loading = true;
}
};
}]);
}; };

View File

@ -3,7 +3,7 @@
*/ */
h1 { h1 {
font-size: 3.625em; font-size: 3.425em;
line-height: 1.22222222em; line-height: 1.22222222em;
margin-top: 0.48888889em; margin-top: 0.48888889em;
margin-bottom: 0.48888889em; margin-bottom: 0.48888889em;
@ -33,10 +33,10 @@ h1, h2, h3, h4 {
display: block; display: block;
color: #555; color: #555;
.subheader { .subheader {
display: block; //display: block;
font-size: 0.5em; font-size: 0.5em;
line-height: 1em; line-height: 1em;
color: lighten($text-dark, 16%); color: lighten($text-dark, 32%);
} }
} }

View File

@ -1,4 +1,4 @@
<div class="book"> <div class="book" data-entity-type="book" data-entity-id="{{$book->id}}">
<h3 class="text-book"><a class="text-book" href="{{$book->getUrl()}}"><i class="zmdi zmdi-book"></i>{{$book->name}}</a></h3> <h3 class="text-book"><a class="text-book" href="{{$book->getUrl()}}"><i class="zmdi zmdi-book"></i>{{$book->name}}</a></h3>
@if(isset($book->searchSnippet)) @if(isset($book->searchSnippet))
<p class="text-muted">{!! $book->searchSnippet !!}</p> <p class="text-muted">{!! $book->searchSnippet !!}</p>

View File

@ -1,4 +1,4 @@
<div class="chapter"> <div class="chapter" data-entity-type="chapter" data-entity-id="{{$chapter->id}}">
<h3> <h3>
<a href="{{ $chapter->getUrl() }}" class="text-chapter"> <a href="{{ $chapter->getUrl() }}" class="text-chapter">
<i class="zmdi zmdi-collection-bookmark"></i>{{ $chapter->name }} <i class="zmdi zmdi-collection-bookmark"></i>{{ $chapter->name }}

View File

@ -1,4 +1,4 @@
<div class="page {{$page->draft ? 'draft' : ''}}"> <div class="page {{$page->draft ? 'draft' : ''}}" data-entity-type="page" data-entity-id="{{$page->id}}">
<h3> <h3>
<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>
@ -11,11 +11,11 @@
@if(isset($style) && $style === 'detailed') @if(isset($style) && $style === 'detailed')
<div class="row meta text-muted text-small"> <div class="row meta text-muted text-small">
<div class="col-md-4"> <div class="col-md-6">
Created {{$page->created_at->diffForHumans()}} @if($page->createdBy)by {{$page->createdBy->name}}@endif <br> 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 Last updated {{ $page->updated_at->diffForHumans() }} @if($page->updatedBy)by {{$page->updatedBy->name}} @endif
</div> </div>
<div class="col-md-8"> <div class="col-md-6">
<a class="text-book" href="{{ $page->book->getUrl() }}"><i class="zmdi zmdi-book"></i>{{ $page->book->getShortName(30) }}</a> <a class="text-book" href="{{ $page->book->getUrl() }}"><i class="zmdi zmdi-book"></i>{{ $page->book->getShortName(30) }}</a>
<br> <br>
@if($page->chapter) @if($page->chapter)

View File

@ -0,0 +1,35 @@
@extends('base')
@section('content')
<div class="faded-small toolbar">
<div class="container">
<div class="row">
<div class="col-sm-12 faded">
<div class="breadcrumbs">
<a href="{{$book->getUrl()}}" class="text-book text-button"><i class="zmdi zmdi-book"></i>{{ $book->getShortName() }}</a>
@if($page->hasChapter())
<span class="sep">&raquo;</span>
<a href="{{ $page->chapter->getUrl() }}" class="text-chapter text-button">
<i class="zmdi zmdi-collection-bookmark"></i>
{{$page->chapter->getShortName()}}
</a>
@endif
<span class="sep">&raquo;</span>
<a href="{{$page->getUrl()}}" class="text-page text-button"><i class="zmdi zmdi-file-text"></i>{{ $page->getShortName() }}</a>
</div>
</div>
</div>
</div>
</div>
<div class="container">
<h1>Move Page <small class="subheader">{{$page->name}}</small></h1>
<div class="bordered" ng-cloak entity-selector>
<input type="text" placeholder="Search">
<div class="text-center" ng-if="loading">@include('partials/loading-icon')</div>
</div>
</div>
@stop

View File

@ -30,6 +30,7 @@
@if(userCan('page-update', $page)) @if(userCan('page-update', $page))
<a href="{{$page->getUrl()}}/revisions" class="text-primary text-button"><i class="zmdi zmdi-replay"></i>Revisions</a> <a href="{{$page->getUrl()}}/revisions" class="text-primary text-button"><i class="zmdi zmdi-replay"></i>Revisions</a>
<a href="{{$page->getUrl()}}/edit" class="text-primary text-button" ><i class="zmdi zmdi-edit"></i>Edit</a> <a href="{{$page->getUrl()}}/edit" class="text-primary text-button" ><i class="zmdi zmdi-edit"></i>Edit</a>
<a href="{{$page->getUrl()}}/move" class="text-primary text-button" ><i class="zmdi zmdi-folder"></i>Move</a>
@endif @endif
@if(userCan('restrictions-manage', $page)) @if(userCan('restrictions-manage', $page))
<a href="{{$page->getUrl()}}/permissions" class="text-primary text-button"><i class="zmdi zmdi-lock-outline"></i>Permissions</a> <a href="{{$page->getUrl()}}/permissions" class="text-primary text-button"><i class="zmdi zmdi-lock-outline"></i>Permissions</a>