From 72b5895217effa33646577562534b5f424a62008 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 25 Sep 2015 16:25:17 +0200 Subject: [PATCH] Added a subtitle to the category view. --- app/Http/Controllers/CategoryController.php | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.php index 10725adce6..29c82ef1f6 100644 --- a/app/Http/Controllers/CategoryController.php +++ b/app/Http/Controllers/CategoryController.php @@ -150,20 +150,21 @@ class CategoryController extends Controller */ public function showWithDate(CategoryRepositoryInterface $repository, Category $category, $date) { - $carbon = new Carbon($date); - $range = Preferences::get('viewRange', '1M')->data; - $start = Navigation::startOfPeriod($carbon, $range); - $end = Navigation::endOfPeriod($carbon, $range); + $carbon = new Carbon($date); + $range = Preferences::get('viewRange', '1M')->data; + $start = Navigation::startOfPeriod($carbon, $range); + $end = Navigation::endOfPeriod($carbon, $range); + $subTitle = $category->name; $hideCategory = true; // used in list. $page = intval(Input::get('page')); - $set = $repository->getJournalsInRange($category, $page, $start, $end); - $count = $repository->countJournalsInRange($category, $start, $end); - $journals = new LengthAwarePaginator($set, $count, 50, $page); + $set = $repository->getJournalsInRange($category, $page, $start, $end); + $count = $repository->countJournalsInRange($category, $start, $end); + $journals = new LengthAwarePaginator($set, $count, 50, $page); $journals->setPath('categories/show/' . $category->id . '/' . $date); - return view('categories.show_with_date', compact('category', 'journals', 'hideCategory')); + return view('categories.show_with_date', compact('category', 'journals', 'hideCategory', 'subTitle')); } /** @@ -180,6 +181,7 @@ class CategoryController extends Controller $count = $repository->countJournals($category); $totalSum = $repository->journalsSum($category); $periodSum = $repository->journalsSum($category, Session::get('start'), Session::get('end')); + $subTitle = $category->name; $journals = new LengthAwarePaginator($set, $count, 50, $page); $journals->setPath('categories/show/' . $category->id); @@ -219,7 +221,7 @@ class CategoryController extends Controller $cache->store($entries); } - return view('categories.show', compact('category', 'journals', 'entries', 'hideCategory', 'totalSum', 'periodSum')); + return view('categories.show', compact('category', 'journals', 'entries', 'hideCategory', 'totalSum', 'periodSum', 'subTitle')); } /**