]> BookStack Code Mirror - bookstack/commitdiff
Started work on page move view and entity selector
authorDan Brown <redacted>
Sat, 11 Jun 2016 20:04:18 +0000 (21:04 +0100)
committerDan Brown <redacted>
Sat, 11 Jun 2016 20:04:18 +0000 (21:04 +0100)
app/Http/Controllers/PageController.php
app/Http/routes.php
resources/assets/js/directives.js
resources/assets/sass/_text.scss
resources/views/books/list-item.blade.php
resources/views/chapters/list-item.blade.php
resources/views/pages/list-item.blade.php
resources/views/pages/move.blade.php [new file with mode: 0644]
resources/views/pages/show.blade.php

index 23006888418e490521c51620f92c850ca5a1a683..52de19b5b0faa6a0d70b7e6248cec57e745701ac 100644 (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.
      * @param $bookSlug
index 9f226efd725d47086aea4b7aae98caef7a75a9fd..90bcd593f800028ec9d13b308f29dd1d14aa3031 100644 (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/plaintext', 'PageController@exportPlainText');
         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}/draft/{pageId}/delete', 'PageController@showDeleteDraft');
         Route::get('/{bookSlug}/page/{pageSlug}/permissions', 'PageController@showRestrict');
index 43d55f092eab39e6e370c26e6039c7dbb53ae261..54df2d2bfea8a5e7d777c561fc1ba12f09193e84 100644 (file)
@@ -149,7 +149,10 @@ module.exports = function (ngApp, events) {
         };
     }]);
 
-
+    /**
+     * Dropdown
+     * Provides some simple logic to create small dropdown menus
+     */
     ngApp.directive('dropdown', [function () {
         return {
             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) {
         return {
             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) {
         return {
             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) {
         return {
             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 () {
         return {
             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) {
         return {
             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;
+                
+            }
+        };
+    }]);
 };
 
 
index 0095b91cbf792adaa5764101732cfc8201c9f4bb..493933135d911290f271cf0ba9e07916e2c9cbb1 100644 (file)
@@ -3,7 +3,7 @@
  */
 
 h1 {
-  font-size: 3.625em;
+  font-size: 3.425em;
   line-height: 1.22222222em;
   margin-top: 0.48888889em;
   margin-bottom: 0.48888889em;
@@ -33,10 +33,10 @@ h1, h2, h3, h4 {
   display: block;
   color: #555;
   .subheader {
-    display: block;
+    //display: block;
     font-size: 0.5em;
     line-height: 1em;
-    color: lighten($text-dark, 16%);
+    color: lighten($text-dark, 32%);
   }
 }
 
index 5807bf4611edd8ba04086dee47f49a28736f4dae..d3e0ef56bfba30f2f340152ba75f3ed964c664f1 100644 (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>
     @if(isset($book->searchSnippet))
         <p class="text-muted">{!! $book->searchSnippet !!}</p>
index d5ac46338c772ff830865562c9378fdef633a87a..71225e9879c34f5bb627c8ed50c1dacdaba95025 100644 (file)
@@ -1,4 +1,4 @@
-<div class="chapter">
+<div class="chapter" data-entity-type="chapter" data-entity-id="{{$chapter->id}}">
     <h3>
         <a href="{{ $chapter->getUrl() }}" class="text-chapter">
             <i class="zmdi zmdi-collection-bookmark"></i>{{ $chapter->name }}
index 87a7eabe55c4608d51cbb74fab54cb5a327cf83e..100c1de48a6095f07405113e942b0c64f4a90edd 100644 (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>
         <a href="{{ $page->getUrl() }}" class="text-page"><i class="zmdi zmdi-file-text"></i>{{ $page->name }}</a>
     </h3>
 
     @if(isset($style) && $style === 'detailed')
         <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>
                 Last updated {{ $page->updated_at->diffForHumans() }} @if($page->updatedBy)by {{$page->updatedBy->name}} @endif
             </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>
                 <br>
                 @if($page->chapter)
diff --git a/resources/views/pages/move.blade.php b/resources/views/pages/move.blade.php
new file mode 100644 (file)
index 0000000..2ccbdb4
--- /dev/null
@@ -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
index 4dbab0e29d864ecd1db41d1c3b4c2738d7617d2f..8b9b6349280fe7a471ee887ebc2a105c1522f148 100644 (file)
@@ -30,6 +30,7 @@
                         @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()}}/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
                         @if(userCan('restrictions-manage', $page))
                             <a href="{{$page->getUrl()}}/permissions" class="text-primary text-button"><i class="zmdi zmdi-lock-outline"></i>Permissions</a>