From 491298e1cb035a679bb0927ae66577fc03c4e968 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 25 Sep 2015 16:33:45 +0200 Subject: [PATCH] Some fixes in titles and bread crumbs. --- app/Http/Controllers/CategoryController.php | 2 +- app/Http/breadcrumbs.php | 13 +++++++++++++ resources/twig/categories/show_with_date.twig | 3 ++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.php index 29c82ef1f6..f5088208fa 100644 --- a/app/Http/Controllers/CategoryController.php +++ b/app/Http/Controllers/CategoryController.php @@ -164,7 +164,7 @@ class CategoryController extends Controller $journals = new LengthAwarePaginator($set, $count, 50, $page); $journals->setPath('categories/show/' . $category->id . '/' . $date); - return view('categories.show_with_date', compact('category', 'journals', 'hideCategory', 'subTitle')); + return view('categories.show_with_date', compact('category', 'journals', 'hideCategory', 'subTitle','carbon')); } /** diff --git a/app/Http/breadcrumbs.php b/app/Http/breadcrumbs.php index 6e7d3c6537..5d360aaf4c 100644 --- a/app/Http/breadcrumbs.php +++ b/app/Http/breadcrumbs.php @@ -154,6 +154,19 @@ Breadcrumbs::register( } ); +Breadcrumbs::register( + 'categories.show.date', function (Generator $breadcrumbs, Category $category, Carbon $date) { + + // get current period preference. + $range = Preferences::get('viewRange', '1M')->data; + + $breadcrumbs->parent('categories.index'); + $breadcrumbs->push(e($category->name), route('categories.show', [$category->id])); + $breadcrumbs->push(Navigation::periodShow($date, $range), route('categories.show.date', [$category->id, $date->format('Y-m-d')])); + +} +); + Breadcrumbs::register( 'categories.noCategory', function (Generator $breadcrumbs, $subTitle) { $breadcrumbs->parent('categories.index'); diff --git a/resources/twig/categories/show_with_date.twig b/resources/twig/categories/show_with_date.twig index 50efe41d60..0d136db2e2 100644 --- a/resources/twig/categories/show_with_date.twig +++ b/resources/twig/categories/show_with_date.twig @@ -1,10 +1,11 @@ {% extends "./layout/default.twig" %} {% block breadcrumbs %} - {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, category) }} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, category, carbon) }} {% endblock %} {% block content %} +