Restructure views

- Use Laravel's view namespacing rather than the full file path
- Organise views into directories
This commit is contained in:
Toby Zerner 2017-11-29 12:49:09 +10:30
parent 7796580210
commit 479e44dd04
10 changed files with 6 additions and 6 deletions

View File

@ -87,7 +87,7 @@ class DiscussionController extends WebAppController
$view->title = $document->data->attributes->title; $view->title = $document->data->attributes->title;
$view->document = $document; $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; return $view;
} }

View File

@ -68,7 +68,7 @@ class IndexController extends WebAppController
$document = $this->getDocument($request->getAttribute('actor'), $params); $document = $this->getDocument($request->getAttribute('actor'), $params);
$view->document = $document; $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; return $view;
} }

View File

@ -86,7 +86,7 @@ abstract class AbstractWebApp
*/ */
protected function getLayout() protected function getLayout()
{ {
return __DIR__.'/../../../views/'.$this->getName().'.blade.php'; return 'flarum::frontend.'.$this->getName();
} }
/** /**

View File

@ -287,7 +287,7 @@ class WebAppView
$this->view->share('forum', array_get($forum, 'data')); $this->view->share('forum', array_get($forum, 'data'));
$this->view->share('debug', $this->app->inDebugMode()); $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->title = $this->buildTitle(array_get($forum, 'data.attributes.title'));
$view->description = $this->description ?: array_get($forum, 'data.attributes.description'); $view->description = $this->description ?: array_get($forum, 'data.attributes.description');
@ -336,7 +336,7 @@ class WebAppView
protected function buildLayout() protected function buildLayout()
{ {
$view = $this->view->file($this->layout); $view = $this->view->make($this->layout);
$view->content = $this->buildContent(); $view->content = $this->buildContent();
@ -345,7 +345,7 @@ class WebAppView
protected function buildContent() protected function buildContent()
{ {
$view = $this->view->file(__DIR__.'/../../../views/content.blade.php'); $view = $this->view->make('flarum::frontend.content');
$view->content = $this->content; $view->content = $this->content;