]> BookStack Code Mirror - bookstack/commitdiff
Cleaned styles further and added loading icon to search
authorDan Brown <redacted>
Thu, 3 Sep 2015 18:05:45 +0000 (19:05 +0100)
committerDan Brown <redacted>
Thu, 3 Sep 2015 18:05:45 +0000 (19:05 +0100)
15 files changed:
resources/assets/js/global.js
resources/assets/sass/_animations.scss
resources/assets/sass/_header.scss
resources/assets/sass/_lists.scss
resources/assets/sass/_variables.scss
resources/assets/sass/styles.scss
resources/views/books/list-item.blade.php
resources/views/books/show.blade.php
resources/views/chapters/list-item.blade.php [new file with mode: 0644]
resources/views/chapters/show.blade.php
resources/views/home.blade.php
resources/views/pages/list-item.blade.php [new file with mode: 0644]
resources/views/partials/loading-icon.blade.php [new file with mode: 0644]
resources/views/search/all.blade.php
resources/views/search/book.blade.php

index 884727e452c17ffa2fd67b71fc57984717e0d780..41002f4f5d1af0ccd5e7b1ae97fe50a376eb2ff5 100644 (file)
@@ -1,5 +1,6 @@
 $(function () {
 
+    // Notification hiding
     $('.notification').click(function () {
         $(this).fadeOut(100);
     });
@@ -7,4 +8,11 @@ $(function () {
     // Dropdown toggles
     $('[data-dropdown]').dropDown();
 
+    // Chapter page list toggles
+    $('.chapter-toggle').click(function(e) {
+        e.preventDefault();
+        $(this).toggleClass('open');
+        $(this).closest('.book-child').find('.inset-list').slideToggle(180);
+    });
+
 });
\ No newline at end of file
index cc1d42be976e1ebbd3951b47dcf89461072440b1..f2434b482c0b384cb32ed112b132de34224590d6 100644 (file)
@@ -22,7 +22,7 @@
   animation-name: searchResult;
   animation-duration: 220ms;
   animation-fill-mode: forwards;
-  animation-timing-function: cubic-bezier(.62,.28,.23,.99);
+  animation-timing-function: cubic-bezier(.62, .28, .23, .99);
 }
 
 @keyframes searchResult {
 }
 
 @keyframes menuIn {
-  from { opacity: 0;transform: scale3d(0, 0, 1);}
+  from {
+    opacity: 0;
+    transform: scale3d(0, 0, 1);
+  }
 
-  to { opacity: 1; transform: scale3d(1, 1, 1);}
+  to {
+    opacity: 1;
+    transform: scale3d(1, 1, 1);
+  }
 }
 
 .anim.menuIn {
-  transform-origin: 0% 0%;
+  transform-origin: 100% 0%;
   animation-name: menuIn;
   animation-duration: 120ms;
   animation-delay: 0s;
-  animation-timing-function: cubic-bezier(.62,.28,.23,.99);
-}
\ No newline at end of file
+  animation-timing-function: cubic-bezier(.62, .28, .23, .99);
+}
+
+@keyframes loadingBob {
+  0% {
+    transform: translate3d(0, 0, 0);
+  }
+  30% {
+    transform: translate3d(0, 0, 0);
+  }
+  50% {
+    transform: translate3d(0, -10px, 0);
+  }
+  70% {
+    transform: translate3d(0, 0, 0);
+  }
+  100% {
+    transform: translate3d(0, 0, 0);
+  }
+}
index 14a9626ed1de08c9ea71eeff4927351442bb9ec0..b011fe129b99ef17723faacc79b7112853f352e9 100644 (file)
@@ -99,7 +99,7 @@ form.search-box {
   position: absolute;
   z-index: 999;
   top: 0;
-  left: 0;
+  right: 0;
   margin: $-m 0;
   background-color: #FFFFFF;
   list-style: none;
index 05dadce868c5028cc9a8bb46ea277d4afaec2382..2f75ea3425ee2f4273fd2e58b00fd8057cf8e90e 100644 (file)
   hr {
     margin-top: 0;
   }
-  .book-child {
+  .page, .chapter, .book {
     padding-left: $-l;
-    &.page {
-      border-left: 5px solid $color-page;
-    }
-    &.chapter {
-      border-left: 5px solid $color-chapter;
-    }
+  }
+  .page {
+    border-left: 5px solid $color-page;
+  }
+  .chapter {
+    border-left: 5px solid $color-chapter;
+  }
+  .book {
+    border-left: 5px solid $color-book;
   }
 }
 .chapter-toggle {
index b2a88cb511c5378ae5a37824d0fe1bfc171bb29a..80277b9a5351c4bd9caf2659239b218722ff0bab 100644 (file)
@@ -41,7 +41,7 @@ $negative: #D32F2F;
 
 // Item Colors
 $color-book: #009688;
-$color-chapter: #EF6C00;
+$color-chapter: #ef7c3c;
 $color-page: $primary;
 
 // Text colours
index 350dea5cec2118455f432420be11a6d0b06f5802..beea1c1b438e74f037e6f6dcbf034f951a5feedf 100644 (file)
@@ -64,6 +64,41 @@ body.dragging, body.dragging * {
   }
 }
 
+// Loading icon
+$loadingSize: 10px;
+.loading-container {
+  position: relative;
+  display: block;
+  height: $loadingSize;
+  margin: $-xl auto;
+  > div {
+    width: $loadingSize;
+    height: $loadingSize;
+    border-radius: $loadingSize;
+    display: inline-block;
+    vertical-align: top;
+    transform: translate3d(0, 0, 0);
+    animation-name: loadingBob;
+    animation-duration: 1.4s;
+    animation-iteration-count: infinite;
+    animation-timing-function: cubic-bezier(.62, .28, .23, .99);
+    margin-right: 4px;
+    background-color: $color-page;
+    animation-delay: 0.3s;
+  }
+  > div:first-child {
+      left: -($loadingSize+$-xs);
+      background-color: $color-book;
+      animation-delay: 0s;
+  }
+  > div:last-child {
+    left: $loadingSize+$-xs;
+    background-color: $color-chapter;
+    animation-delay: 0.6s;
+  }
+}
+
+
 // Search results
 .search-results > h3 a {
   font-size: 0.66em;
index 64f014331ee8685307b60c022b70b8378c75e571..5807bf4611edd8ba04086dee47f49a28736f4dae 100644 (file)
@@ -1,4 +1,8 @@
 <div class="book">
     <h3 class="text-book"><a class="text-book" href="{{$book->getUrl()}}"><i class="zmdi zmdi-book"></i>{{$book->name}}</a></h3>
-    <p class="text-muted">{{$book->description}}</p>
+    @if(isset($book->searchSnippet))
+        <p class="text-muted">{!! $book->searchSnippet !!}</p>
+    @else
+        <p class="text-muted">{{ $book->getExcerpt() }}</p>
+    @endif
 </div>
\ No newline at end of file
index faf352f681ae9d4f18f9cb30cb536f89ad1b094b..d8001b19a8e5f1062a97d625df2235aba4459e1a 100644 (file)
                         <hr>
                         @if(count($book->children()) > 0)
                             @foreach($book->children() as $childElement)
-                                <div class="book-child {{ $childElement->getName() }}">
-                                    <h3>
-                                        <a href="{{ $childElement->getUrl() }}" class="{{ $childElement->getName() }}">
-                                            <i class="zmdi {{ $childElement->isA('chapter') ? 'zmdi-collection-bookmark':'zmdi-file-text'}}"></i>{{ $childElement->name }}
-                                        </a>
-                                    </h3>
-                                    <p class="text-muted">
-                                        {{$childElement->getExcerpt()}}
-                                    </p>
-
-                                    @if($childElement->isA('chapter') && count($childElement->pages) > 0)
-                                        <p class="text-muted chapter-toggle open"><i class="zmdi zmdi-caret-right"></i> {{ count($childElement->pages) }} Pages</p>
-                                        <div class="inset-list">
-                                            @foreach($childElement->pages as $page)
-                                                <h4><a href="{{$page->getUrl()}}"><i class="zmdi zmdi-file-text"></i>{{$page->name}}</a></h4>
-                                            @endforeach
-                                        </div>
-                                    @endif
-                                </div>
+                                @if($childElement->isA('chapter'))
+                                    @include('chapters/list-item', ['chapter' => $childElement])
+                                @else
+                                    @include('pages/list-item', ['page' => $childElement])
+                                @endif
                                 <hr>
                             @endforeach
                         @else
@@ -78,6 +64,9 @@
                 </div>
                 <div class="search-results" v-if="searching">
                     <h3 class="text-muted">Search Results <a v-if="searching" v-on="click: clearSearch" class="text-small"><i class="zmdi zmdi-close"></i>Clear Search</a></h3>
+                    <div v-if="!searchResults">
+                        @include('partials/loading-icon')
+                    </div>
                     <div v-html="searchResults"></div>
                 </div>
 
@@ -86,7 +75,6 @@
 
             <div class="col-md-4 col-md-offset-1">
                 <div class="margin-top large"></div>
-                {{--<h3>Search This Book</h3>--}}
                 <div class="search-box">
                     <form v-on="submit: searchBook, input: checkSearchForm" v-el="form" action="/search/book/{{ $book->id }}">
                         {!! csrf_field() !!}
         </div>
     </div>
 
-
-
-    <script>
-        $(function() {
-
-            $('.chapter-toggle').click(function(e) {
-                e.preventDefault();
-                $(this).toggleClass('open');
-                $(this).closest('.book-child').find('.inset-list').slideToggle(180);
-            });
-
-        });
-    </script>
-
-    <script src="/js/book-sidebar.js"></script>
+    <script src="/js/book-dashboard.js"></script>
 
 @stop
\ No newline at end of file
diff --git a/resources/views/chapters/list-item.blade.php b/resources/views/chapters/list-item.blade.php
new file mode 100644 (file)
index 0000000..f4673c5
--- /dev/null
@@ -0,0 +1,21 @@
+<div class="chapter">
+    <h3>
+        <a href="{{ $chapter->getUrl() }}" class="text-chapter">
+            <i class="zmdi zmdi-collection-bookmark"></i>{{ $chapter->name }}
+        </a>
+    </h3>
+    @if(isset($chapter->searchSnippet))
+        <p class="text-muted">{!! $chapter->searchSnippet !!}</p>
+    @else
+        <p class="text-muted">{{ $chapter->getExcerpt() }}</p>
+    @endif
+
+    @if(count($chapter->pages) > 0 && !isset($hidePages))
+        <p class="text-muted chapter-toggle open"><i class="zmdi zmdi-caret-right"></i> {{ count($chapter->pages) }} Pages</p>
+        <div class="inset-list">
+            @foreach($chapter->pages as $page)
+                <h4><a href="{{$page->getUrl()}}"><i class="zmdi zmdi-file-text"></i>{{$page->name}}</a></h4>
+            @endforeach
+        </div>
+    @endif
+</div>
\ No newline at end of file
index 82083de9d69075d0c498773ecc8a7d9083114a59..60965d0f6afd3003937505e5fd7470fc208b4615 100644 (file)
                     <div class="page-list">
                         <hr>
                         @foreach($chapter->pages as $page)
-                            <div >
-                                <h3>
-                                    <a href="{{ $page->getUrl() }}">
-                                        <i class="zmdi zmdi-file-text"></i>{{ $page->name }}
-                                    </a>
-                                </h3>
-                                <p class="text-muted">
-                                    {{$page->getExcerpt(180)}}
-                                </p>
-                            </div>
+                            @include('pages/list-item', ['page' => $page])
                             <hr>
                         @endforeach
                     </div>
@@ -68,9 +59,9 @@
                     Last Updated {{$chapter->updated_at->diffForHumans()}} @if($chapter->createdBy) by {{$chapter->updatedBy->name}} @endif
                 </p>
             </div>
-        </div>
-        <div class="col-md-3 col-md-offset-1">
-            @include('pages/sidebar-tree-list', ['book' => $book])
+            <div class="col-md-3 col-md-offset-1">
+                @include('pages/sidebar-tree-list', ['book' => $book])
+            </div>
         </div>
     </div>
 
index b91820fe39ba2d44a347c702abcfb1a0bd4f095d..32bfbd028e14d66852729c8bbd64bceb4ead1e1b 100644 (file)
@@ -2,7 +2,6 @@
 
 @section('content')
 
-
     <div class="container">
         <div class="row">
             <div class="col-md-7">
diff --git a/resources/views/pages/list-item.blade.php b/resources/views/pages/list-item.blade.php
new file mode 100644 (file)
index 0000000..891a5f7
--- /dev/null
@@ -0,0 +1,10 @@
+<div class="page">
+    <h3>
+        <a href="{{ $page->getUrl() }}" class="text-page"><i class="zmdi zmdi-file-text"></i>{{ $page->name }}</a>
+    </h3>
+    @if(isset($page->searchSnippet))
+        <p class="text-muted">{!! $page->searchSnippet !!}</p>
+    @else
+        <p class="text-muted">{{ $page->getExcerpt() }}</p>
+    @endif
+</div>
\ No newline at end of file
diff --git a/resources/views/partials/loading-icon.blade.php b/resources/views/partials/loading-icon.blade.php
new file mode 100644 (file)
index 0000000..481d9b3
--- /dev/null
@@ -0,0 +1,5 @@
+<div class="loading-container">
+    <div></div>
+    <div></div>
+    <div></div>
+</div>
\ No newline at end of file
index 3cb61b761c42bbeddc5c7ac088079b994d9ec8b2..122366610c564aeaa8ccca5c3155f1580135bf17 100644 (file)
                 <div class="page-list">
                     @if(count($pages) > 0)
                         @foreach($pages as $page)
-                            <div class="book-child">
-                                <h3>
-                                    <a href="{{$page->getUrl() . '#' . $searchTerm}}" class="page">
-                                        <i class="zmdi zmdi-file-text"></i>{{$page->name}}
-                                    </a>
-                                </h3>
-                                <p class="text-muted">
-                                    {!! $page->searchSnippet !!}
-                                </p>
-                                <hr>
-                            </div>
+                            @include('pages/list-item', ['page' => $page])
+                            <hr>
                         @endforeach
                     @else
                         <p class="text-muted">No pages matched this search</p>
                     <h3>Matching Books</h3>
                     <div class="page-list">
                         @foreach($books as $book)
-                            <div class="book-child">
-                                <h3>
-                                    <a href="{{$book->getUrl()}}" class="text-book">
-                                        <i class="zmdi zmdi-book"></i>{{$book->name}}
-                                    </a>
-                                </h3>
-                                <p class="text-muted">
-                                    {!! $book->searchSnippet !!}
-                                </p>
-                                <hr>
-                            </div>
+                            @include('books/list-item', ['book' => $book])
+                            <hr>
                         @endforeach
                     </div>
                 @endif
                     <h3>Matching Chapters</h3>
                     <div class="page-list">
                         @foreach($chapters as $chapter)
-                            <div class="book-child">
-                                <h3>
-                                    <a href="{{$chapter->getUrl()}}" class="text-chapter">
-                                        <i class="zmdi zmdi-collection-bookmark"></i>{{$chapter->name}}
-                                    </a>
-                                </h3>
-                                <p class="text-muted">
-                                    {!! $chapter->searchSnippet !!}
-                                </p>
-                                <hr>
-                            </div>
+                            @include('chapters/list-item', ['chapter' => $chapter, 'hidePages' => true])
                         @endforeach
                     </div>
                 @endif
index 329c3889ea128abc55f0a446ae5ea76f65e83a81..5af2c4d063c74104f86ac6cbd6afec486b6a52ab 100644 (file)
@@ -1,17 +1,8 @@
-
 <div class="page-list">
     @if(count($pages) > 0)
-        @foreach($pages as $page)
-            <div class="book-child anim searchResult">
-                <h3>
-                    <a href="{{$page->getUrl() . '#' . $searchTerm}}" class="page">
-                        <i class="zmdi zmdi-file-text"></i>{{$page->name}}
-                    </a>
-                </h3>
-
-                <p class="text-muted">
-                    {!! $page->searchSnippet !!}
-                </p>
+        @foreach($pages as $pageIndex => $page)
+            <div class="anim searchResult" style="animation-delay: {{$pageIndex*50 . 'ms'}};">
+                @include('pages/list-item', ['page' => $page])
                 <hr>
             </div>
         @endforeach
 
 @if(count($chapters) > 0)
     <div class="page-list">
-        @foreach($chapters as $chapter)
-            <div class="book-child anim searchResult">
-                <h3>
-                    <a href="{{$chapter->getUrl()}}" class="text-chapter">
-                        <i class="zmdi zmdi-collection-bookmark"></i>{{$chapter->name}}
-                    </a>
-                </h3>
-
-                <p class="text-muted">
-                    {!! $chapter->searchSnippet !!}
-                </p>
+        @foreach($chapters as $chapterIndex => $chapter)
+            <div class="anim searchResult" style="animation-delay: {{($chapterIndex+count($pages))*50 . 'ms'}};">
+                @include('chapters/list-item', ['chapter' => $chapter, 'hidePages' => true])
                 <hr>
             </div>
         @endforeach