@@ -42,8 +42,10 @@ public function __construct(BookRepo $bookRepo, PageRepo $pageRepo, ChapterRepo
4242 public function index ()
4343 {
4444 $ books = $ this ->bookRepo ->getAllPaginated (10 );
45- $ recents = $ this ->signedIn ? $ this ->bookRepo ->getRecentlyViewed (10 , 0 ) : false ;
46- return view ('books/index ' , ['books ' => $ books , 'recents ' => $ recents ]);
45+ $ recents = $ this ->signedIn ? $ this ->bookRepo ->getRecentlyViewed (4 , 0 ) : false ;
46+ $ popular = $ this ->bookRepo ->getPopular (4 , 0 );
47+ $ this ->setPageTitle ('Books ' );
48+ return view ('books/index ' , ['books ' => $ books , 'recents ' => $ recents , 'popular ' => $ popular ]);
4749 }
4850
4951 /**
@@ -54,6 +56,7 @@ public function index()
5456 public function create ()
5557 {
5658 $ this ->checkPermission ('book-create ' );
59+ $ this ->setPageTitle ('Create New Book ' );
5760 return view ('books/create ' );
5861 }
5962
@@ -88,8 +91,9 @@ public function store(Request $request)
8891 public function show ($ slug )
8992 {
9093 $ book = $ this ->bookRepo ->getBySlug ($ slug );
91- Views::add ($ book );
9294 $ bookChildren = $ this ->bookRepo ->getChildren ($ book );
95+ Views::add ($ book );
96+ $ this ->setPageTitle ($ book ->getShortName ());
9397 return view ('books/show ' , ['book ' => $ book , 'current ' => $ book , 'bookChildren ' => $ bookChildren ]);
9498 }
9599
@@ -103,6 +107,7 @@ public function edit($slug)
103107 {
104108 $ this ->checkPermission ('book-update ' );
105109 $ book = $ this ->bookRepo ->getBySlug ($ slug );
110+ $ this ->setPageTitle ('Edit Book ' . $ book ->getShortName ());
106111 return view ('books/edit ' , ['book ' => $ book , 'current ' => $ book ]);
107112 }
108113
@@ -138,6 +143,7 @@ public function showDelete($bookSlug)
138143 {
139144 $ this ->checkPermission ('book-delete ' );
140145 $ book = $ this ->bookRepo ->getBySlug ($ bookSlug );
146+ $ this ->setPageTitle ('Delete Book ' . $ book ->getShortName ());
141147 return view ('books/delete ' , ['book ' => $ book , 'current ' => $ book ]);
142148 }
143149
@@ -152,9 +158,16 @@ public function sort($bookSlug)
152158 $ book = $ this ->bookRepo ->getBySlug ($ bookSlug );
153159 $ bookChildren = $ this ->bookRepo ->getChildren ($ book );
154160 $ books = $ this ->bookRepo ->getAll ();
161+ $ this ->setPageTitle ('Sort Book ' . $ book ->getShortName ());
155162 return view ('books/sort ' , ['book ' => $ book , 'current ' => $ book , 'books ' => $ books , 'bookChildren ' => $ bookChildren ]);
156163 }
157164
165+ /**
166+ * Shows the sort box for a single book.
167+ * Used via AJAX when loading in extra books to a sort.
168+ * @param $bookSlug
169+ * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
170+ */
158171 public function getSortItem ($ bookSlug )
159172 {
160173 $ book = $ this ->bookRepo ->getBySlug ($ bookSlug );
0 commit comments