Skip to content

Commit

Permalink
Restructure views
Browse files Browse the repository at this point in the history
- Use Laravel's view namespacing rather than the full file path
- Organise views into directories
  • Loading branch information
tobyzerner committed Nov 29, 2017
1 parent 7796580 commit 479e44d
Show file tree
Hide file tree
Showing 10 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Forum/Controller/DiscussionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ protected function getView(Request $request)

$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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Forum/Controller/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected function getView(Request $request)
$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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Http/WebApp/AbstractWebApp.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ abstract protected function getName();
*/
protected function getLayout()
{
return __DIR__.'/../../../views/'.$this->getName().'.blade.php';
return 'flarum::frontend.'.$this->getName();
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/Http/WebApp/WebAppView.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ public function render(Request $request)
$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');
Expand Down Expand Up @@ -336,7 +336,7 @@ protected function buildPayload(Request $request, $forum)

protected function buildLayout()
{
$view = $this->view->file($this->layout);
$view = $this->view->make($this->layout);

$view->content = $this->buildContent();

Expand All @@ -345,7 +345,7 @@ protected function buildLayout()

protected function buildContent()
{
$view = $this->view->file(__DIR__.'/../../../views/content.blade.php');
$view = $this->view->make('flarum::frontend.content');

$view->content = $this->content;

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 479e44d

Please sign in to comment.