From 1e310f0da51e92dce586895493e7db0063b1baa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Kv=C3=A1=C4=8Dek?= Date: Tue, 4 Oct 2016 13:14:21 +0200 Subject: [PATCH 1/2] FIX: add with methods to selecting comments and content pages --- app/Models/Content.php | 1 + modules/Blog/Article/Handlers/Article.php | 1 + 2 files changed, 2 insertions(+) diff --git a/app/Models/Content.php b/app/Models/Content.php index 6dee27a4..a91de453 100644 --- a/app/Models/Content.php +++ b/app/Models/Content.php @@ -62,6 +62,7 @@ class Content extends Model { return Content::where('status', '!=', Content::STATUS_DRAFT) ->select('contents.*') + ->with('author') ->join('modules', 'modules.handler', '=', 'contents.module_handler') ->where('language', LaravelLocalization::getCurrentLocale()) ->where('modules.enabled', true); diff --git a/modules/Blog/Article/Handlers/Article.php b/modules/Blog/Article/Handlers/Article.php index bc5481b9..44f4a1f9 100644 --- a/modules/Blog/Article/Handlers/Article.php +++ b/modules/Blog/Article/Handlers/Article.php @@ -27,6 +27,7 @@ class Article extends Handler implements ContentTitles $content->comments = []; if (isset($content->module_settings->allowComments) && $content->module_settings->allowComments) { $content->comments = Comment::where('content_id', $content->id) + ->with('author') ->where('approved', 1) ->orderBy('created_at') ->get(); From bceef69a72c38f576c3180efbaddeddafd0c6fb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Kv=C3=A1=C4=8Dek?= Date: Fri, 7 Oct 2016 10:32:46 +0200 Subject: [PATCH 2/2] FEATURE: add categories into article detail and article list --- modules/Blog/ArticleList/Handlers/ArticleList.php | 2 +- .../views/modules/article/visitor/default.blade.php | 7 +++++++ .../views/modules/articlelist/visitor/default.blade.php | 8 +++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/modules/Blog/ArticleList/Handlers/ArticleList.php b/modules/Blog/ArticleList/Handlers/ArticleList.php index b1bfd0d8..c65ba273 100644 --- a/modules/Blog/ArticleList/Handlers/ArticleList.php +++ b/modules/Blog/ArticleList/Handlers/ArticleList.php @@ -70,7 +70,7 @@ class ArticleList extends Handler ->enabled() ) { $category = Category::where('url', $categoryUrl) - ->first(); + ->firstOrFail(); $subcategories = $category->getChildren() ->toArray(); diff --git a/templates/Binarity/Resources/views/modules/article/visitor/default.blade.php b/templates/Binarity/Resources/views/modules/article/visitor/default.blade.php index afdd80d5..69a93026 100644 --- a/templates/Binarity/Resources/views/modules/article/visitor/default.blade.php +++ b/templates/Binarity/Resources/views/modules/article/visitor/default.blade.php @@ -17,6 +17,13 @@ {{$page->author->name}} + @if($page->category) + + @endif + + @if(isset($page->module_settings->allowComments) && $page->module_settings->allowComments != 0)
{{$page->comments->count()}} diff --git a/templates/Binarity/Resources/views/modules/articlelist/visitor/default.blade.php b/templates/Binarity/Resources/views/modules/articlelist/visitor/default.blade.php index 17b9595a..4baba499 100644 --- a/templates/Binarity/Resources/views/modules/articlelist/visitor/default.blade.php +++ b/templates/Binarity/Resources/views/modules/articlelist/visitor/default.blade.php @@ -37,8 +37,14 @@ vĂ­ce - @if(isset($article->module_settings->allowComments) && $article->module_settings->allowComments != 0) + @if(isset($article->module_settings->allowComments) && $article->module_settings->allowComments != 0 || $article->category)