]> BookStack Code Mirror - bookstack/commitdiff
Merge branch 'feature_change_view_in_shelves_show' of git://github.com/philjak/BookSt...
authorDan Brown <redacted>
Fri, 10 Apr 2020 11:21:56 +0000 (12:21 +0100)
committerDan Brown <redacted>
Fri, 10 Apr 2020 11:21:56 +0000 (12:21 +0100)
1  2 
app/Http/Controllers/BookshelfController.php

index a0e9b719939727feebe89020606638bf34217963,5c9da762fb3499341c4be851bacc455cd13dad2c..c46cac27738fddc85a3e9fbafe3931e2360784ec
@@@ -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());
      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);
          $this->setPageTitle($shelf->getShortName());
          return view('shelves.show', [
              'shelf' => $shelf,
+             'view' => $view,
              'activity' => Activity::entityActivity($shelf, 20, 1)
          ]);
      }
          $this->validate($request, [
              'name' => 'required|string|max:255',
              'description' => 'string|max:1000',
 -            'image' => $this->imageRepo->getImageValidationRules(),
 +            'image' => 'nullable|' . $this->getImageValidationRules(),
          ]);