mirror of
https://github.com/flarum/framework.git
synced 2024-12-12 14:13:37 +08:00
Allow customisation of the client layout
This commit is contained in:
parent
01b225fd6d
commit
a9d4be8c0b
|
@ -12,7 +12,7 @@ class ClientAction extends BaseClientAction
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected $layout = 'flarum.forum::forum';
|
protected $layout = __DIR__.'/../../../views/forum.blade.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
|
@ -132,10 +132,14 @@ class ClientAction extends BaseClientAction
|
||||||
'core.write_a_reply'
|
'core.write_a_reply'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
protected function getAssets()
|
protected function getAssets()
|
||||||
{
|
{
|
||||||
$assets = parent::getAssets();
|
$assets = parent::getAssets();
|
||||||
|
|
||||||
|
// Add the formatter JavaScript payload.
|
||||||
$assets->addJs(function () {
|
$assets->addJs(function () {
|
||||||
return app('flarum.formatter')->getJS();
|
return app('flarum.formatter')->getJS();
|
||||||
});
|
});
|
||||||
|
|
|
@ -41,7 +41,7 @@ class ClientView implements Renderable
|
||||||
protected $content;
|
protected $content;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the client layout view to display.
|
* The path to the client layout view to display.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
|
@ -143,6 +143,16 @@ class ClientView implements Renderable
|
||||||
$this->content = $content;
|
$this->content = $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the name of the client layout view to display.
|
||||||
|
*
|
||||||
|
* @param string $layout
|
||||||
|
*/
|
||||||
|
public function setLayout($layout)
|
||||||
|
{
|
||||||
|
$this->layout = $layout;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a string to be appended to the page's <head>.
|
* Add a string to be appended to the page's <head>.
|
||||||
*
|
*
|
||||||
|
@ -205,7 +215,7 @@ class ClientView implements Renderable
|
||||||
$view->title = ($this->title ? $this->title . ' - ' : '') . $forum->data->attributes->title;
|
$view->title = ($this->title ? $this->title . ' - ' : '') . $forum->data->attributes->title;
|
||||||
$view->document = $this->document;
|
$view->document = $this->document;
|
||||||
$view->forum = $forum->data;
|
$view->forum = $forum->data;
|
||||||
$view->layout = $this->layout;
|
$view->layout = app('view')->file($this->layout, ['forum' => $forum->data]);
|
||||||
$view->content = $this->content;
|
$view->content = $this->content;
|
||||||
|
|
||||||
$view->styles = [$this->assets->getCssFile()];
|
$view->styles = [$this->assets->getCssFile()];
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@include($layout)
|
{!! $layout !!}
|
||||||
|
|
||||||
<div id="modal"></div>
|
<div id="modal"></div>
|
||||||
<div id="alerts"></div>
|
<div id="alerts"></div>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user