From 479e44dd04128b9972e7002156b69bcb152943a7 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Wed, 29 Nov 2017 12:49:09 +1030 Subject: [PATCH] Restructure views - Use Laravel's view namespacing rather than the full file path - Organise views into directories --- src/Forum/Controller/DiscussionController.php | 2 +- src/Forum/Controller/IndexController.php | 2 +- src/Http/WebApp/AbstractWebApp.php | 2 +- src/Http/WebApp/WebAppView.php | 6 +++--- views/{ => frontend}/admin.blade.php | 0 views/{ => frontend}/app.blade.php | 0 views/{ => frontend}/content.blade.php | 0 views/{ => frontend/content}/discussion.blade.php | 0 views/{ => frontend/content}/index.blade.php | 0 views/{ => frontend}/forum.blade.php | 0 10 files changed, 6 insertions(+), 6 deletions(-) rename views/{ => frontend}/admin.blade.php (100%) rename views/{ => frontend}/app.blade.php (100%) rename views/{ => frontend}/content.blade.php (100%) rename views/{ => frontend/content}/discussion.blade.php (100%) rename views/{ => frontend/content}/index.blade.php (100%) rename views/{ => frontend}/forum.blade.php (100%) diff --git a/src/Forum/Controller/DiscussionController.php b/src/Forum/Controller/DiscussionController.php index ebc7ab0de..c7bb5dcd9 100644 --- a/src/Forum/Controller/DiscussionController.php +++ b/src/Forum/Controller/DiscussionController.php @@ -87,7 +87,7 @@ class DiscussionController extends WebAppController $view->title = $document->data->attributes->title; $view->document = $document; - $view->content = app('view')->make('flarum.forum::discussion', compact('document', 'page', 'getResource', 'posts', 'url')); + $view->content = app('view')->make('flarum::frontend.content.discussion', compact('document', 'page', 'getResource', 'posts', 'url')); return $view; } diff --git a/src/Forum/Controller/IndexController.php b/src/Forum/Controller/IndexController.php index a4c059f34..0a52ed7cd 100644 --- a/src/Forum/Controller/IndexController.php +++ b/src/Forum/Controller/IndexController.php @@ -68,7 +68,7 @@ class IndexController extends WebAppController $document = $this->getDocument($request->getAttribute('actor'), $params); $view->document = $document; - $view->content = app('view')->make('flarum.forum::index', compact('document', 'page', 'forum')); + $view->content = app('view')->make('flarum::frontend.content.index', compact('document', 'page', 'forum')); return $view; } diff --git a/src/Http/WebApp/AbstractWebApp.php b/src/Http/WebApp/AbstractWebApp.php index e20ec3cac..68f9b80f5 100644 --- a/src/Http/WebApp/AbstractWebApp.php +++ b/src/Http/WebApp/AbstractWebApp.php @@ -86,7 +86,7 @@ abstract class AbstractWebApp */ protected function getLayout() { - return __DIR__.'/../../../views/'.$this->getName().'.blade.php'; + return 'flarum::frontend.'.$this->getName(); } /** diff --git a/src/Http/WebApp/WebAppView.php b/src/Http/WebApp/WebAppView.php index d38e95839..78af25540 100644 --- a/src/Http/WebApp/WebAppView.php +++ b/src/Http/WebApp/WebAppView.php @@ -287,7 +287,7 @@ class WebAppView $this->view->share('forum', array_get($forum, 'data')); $this->view->share('debug', $this->app->inDebugMode()); - $view = $this->view->file(__DIR__.'/../../../views/app.blade.php'); + $view = $this->view->make('flarum::frontend.app'); $view->title = $this->buildTitle(array_get($forum, 'data.attributes.title')); $view->description = $this->description ?: array_get($forum, 'data.attributes.description'); @@ -336,7 +336,7 @@ class WebAppView protected function buildLayout() { - $view = $this->view->file($this->layout); + $view = $this->view->make($this->layout); $view->content = $this->buildContent(); @@ -345,7 +345,7 @@ class WebAppView protected function buildContent() { - $view = $this->view->file(__DIR__.'/../../../views/content.blade.php'); + $view = $this->view->make('flarum::frontend.content'); $view->content = $this->content; diff --git a/views/admin.blade.php b/views/frontend/admin.blade.php similarity index 100% rename from views/admin.blade.php rename to views/frontend/admin.blade.php diff --git a/views/app.blade.php b/views/frontend/app.blade.php similarity index 100% rename from views/app.blade.php rename to views/frontend/app.blade.php diff --git a/views/content.blade.php b/views/frontend/content.blade.php similarity index 100% rename from views/content.blade.php rename to views/frontend/content.blade.php diff --git a/views/discussion.blade.php b/views/frontend/content/discussion.blade.php similarity index 100% rename from views/discussion.blade.php rename to views/frontend/content/discussion.blade.php diff --git a/views/index.blade.php b/views/frontend/content/index.blade.php similarity index 100% rename from views/index.blade.php rename to views/frontend/content/index.blade.php diff --git a/views/forum.blade.php b/views/frontend/forum.blade.php similarity index 100% rename from views/forum.blade.php rename to views/frontend/forum.blade.php