From: Dan Brown Date: Fri, 10 Apr 2020 11:21:56 +0000 (+0100) Subject: Merge branch 'feature_change_view_in_shelves_show' of git://github.com/philjak/BookSt... X-Git-Tag: v0.29.0~1^2~11 X-Git-Url: http://source.bookstackapp.com/bookstack/commitdiff_plain/b8c16b15a9f945b72d2ca4fe0c0172ba422199bc?hp=-c Merge branch 'feature_change_view_in_shelves_show' of git://github.com/philjak/BookStack into philjak-feature_change_view_in_shelves_show --- b8c16b15a9f945b72d2ca4fe0c0172ba422199bc diff --combined app/Http/Controllers/BookshelfController.php index a0e9b7199,5c9da762f..c46cac277 --- a/app/Http/Controllers/BookshelfController.php +++ b/app/Http/Controllers/BookshelfController.php @@@ -85,12 -85,12 +85,12 @@@ class BookshelfController extends Contr $this->validate($request, [ 'name' => 'required|string|max:255', 'description' => 'string|max:1000', - 'image' => $this->getImageValidationRules(), + 'image' => 'nullable|' . $this->getImageValidationRules(), ]); $bookIds = explode(',', $request->get('books', '')); $shelf = $this->bookshelfRepo->create($request->all(), $bookIds); - $this->bookshelfRepo->updateCoverImage($shelf); + $this->bookshelfRepo->updateCoverImage($shelf, $request->file('image', null)); Activity::add($shelf, 'bookshelf_create'); return redirect($shelf->getUrl()); @@@ -103,6 -103,7 +103,7 @@@ public function show(string $slug) { $shelf = $this->bookshelfRepo->getBySlug($slug); + $view = setting()->getForCurrentUser('books_view_type', config('app.views.books')); $this->checkOwnablePermission('book-view', $shelf); Views::add($shelf); @@@ -111,6 -112,7 +112,7 @@@ $this->setPageTitle($shelf->getShortName()); return view('shelves.show', [ 'shelf' => $shelf, + 'view' => $view, 'activity' => Activity::entityActivity($shelf, 20, 1) ]); } @@@ -146,7 -148,7 +148,7 @@@ $this->validate($request, [ 'name' => 'required|string|max:255', 'description' => 'string|max:1000', - 'image' => $this->imageRepo->getImageValidationRules(), + 'image' => 'nullable|' . $this->getImageValidationRules(), ]);