]> BookStack Code Mirror - bookstack/commitdiff
Fixed shelf activity display & updated book sort operation
authorDan Brown <redacted>
Sun, 5 May 2019 14:54:22 +0000 (15:54 +0100)
committerDan Brown <redacted>
Sun, 5 May 2019 14:54:22 +0000 (15:54 +0100)
app/Actions/ActivityService.php
app/Http/Controllers/BookController.php
app/Http/Controllers/BookshelfController.php
resources/assets/sass/_lists.scss
resources/assets/sass/styles.scss
resources/views/books/sort.blade.php

index 11f8b87328ceec432c4f85b62bc6872edae80118..f4f82a6f4dfbbac6b63c2fb42a15fad0631f77e9 100644 (file)
@@ -108,13 +108,17 @@ class ActivityService
         if ($entity->isA('book')) {
             $query = $this->activity->where('book_id', '=', $entity->id);
         } else {
-            $query = $this->activity->where('entity_type', '=', get_class($entity))
+            $query = $this->activity->where('entity_type', '=', $entity->getMorphClass())
                 ->where('entity_id', '=', $entity->id);
         }
         
         $activity = $this->permissionService
             ->filterRestrictedEntityRelations($query, 'activities', 'entity_id', 'entity_type')
-            ->orderBy('created_at', 'desc')->with(['entity', 'user.avatar'])->skip($count * ($page - 1))->take($count)->get();
+            ->orderBy('created_at', 'desc')
+            ->with(['entity', 'user.avatar'])
+            ->skip($count * ($page - 1))
+            ->take($count)
+            ->get();
 
         return $this->filterSimilar($activity);
     }
index 7c8ad5c2fa08eb363b6a878e2193ac653e1f6aba..a990eed9a950e4ffb45365bae858a35b279e1d43 100644 (file)
@@ -415,6 +415,7 @@ class BookController extends Controller
     {
         // Update the cover image if in request
         if ($request->has('image')) {
+            $this->imageRepo->destroyImage($book->cover);
             $newImage = $request->file('image');
             $image = $this->imageRepo->saveNew($newImage, 'cover_book', $book->id, 512, 512, true);
             $book->image_id = $image->id;
index dba2503ef67aecda957d7036529f2b1a1bec2098..bcf2e12df88a67628bdded31f2db1162ce120098 100644 (file)
@@ -124,6 +124,7 @@ class BookshelfController extends Controller
         $this->entityContextManager->setShelfContext($shelf->id);
 
         $this->setPageTitle($shelf->getShortName());
+
         return view('shelves.show', [
             'shelf' => $shelf,
             'books' => $books,
@@ -287,6 +288,7 @@ class BookshelfController extends Controller
         // Update the cover image if in request
         if ($request->has('image')) {
             $newImage = $request->file('image');
+            $this->imageRepo->destroyImage($shelf->cover);
             $image = $this->imageRepo->saveNew($newImage, 'cover_shelf', $shelf->id, 512, 512, true);
             $shelf->image_id = $image->id;
             $shelf->save();
index 565c3f0f8c92f7bd0be545e4a72dbff1ba6f74c9..9c141232ea25fd9813d4333fcec3631747f73198 100644 (file)
@@ -456,6 +456,10 @@ ul.pagination {
   position: relative;
   margin-right: $-l;
 
+  &.entity-list-item-image-wide {
+    width: 220px;
+  }
+
   .svg-icon {
     color: #FFF;
     fill: #FFF;
index 424074a0d270394bd44e70f5e615c055b792e703..3fbbcf1da949f7ba54e21914b3f07ac768a01765 100644 (file)
@@ -222,18 +222,6 @@ $btt-size: 40px;
   }
 }
 
-.center-box {
-  margin: $-xxl auto 0 auto;
-  width: 420px;
-  max-width: 100%;
-  display: inline-block;
-  text-align: left;
-  vertical-align: top;
-  input {
-    width: 100%;
-  }
-}
-
 .fullscreen {
   border:0;
   position:fixed;
index cde37de4db165ed49dd05b731c3d06e18013878c..23259a593a57bcd9b4e05e0996c9f56ab1cfb500 100644 (file)
                     return bTime - aTime;
                 },
                 updated: function(a, b) {
-                    const aTime = Number(a.getAttribute('data-update'));
-                    const bTime = Number(b.getAttribute('data-update'));
+                    const aTime = Number(a.getAttribute('data-updated'));
+                    const bTime = Number(b.getAttribute('data-updated'));
                     return bTime - aTime;
                 },
                 chaptersFirst: function(a, b) {
Morty Proxy This is a proxified and sanitized view of the page, visit original site.