ActionController: Introduce constant DEFAULT_TITLE

Controllers are now allowed to fully customize the page title.
This commit is contained in:
Johannes Meyer 2017-06-09 11:13:37 +02:00
parent 6e2c128c54
commit df04c0f837
2 changed files with 9 additions and 3 deletions

View File

@ -27,7 +27,7 @@ $innerLayoutScript = $this->layout()->innerLayout . '.phtml';
<meta name="google" value="notranslate">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta http-equiv="cleartype" content="on">
<title><?= $this->title ? $this->escape($this->title) : 'Icinga Web' ?></title>
<title><?= $this->title ? $this->escape($this->title) : $this->defaultTitle ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="application-name" content="Icinga Web 2">

View File

@ -46,6 +46,11 @@ class ActionController extends Zend_Controller_Action
*/
const LOGIN_ROUTE = 'authentication/login';
/**
* The default page title to use
*/
const DEFAULT_TITLE = 'Icinga Web';
/**
* Whether the controller requires the user to be authenticated
*
@ -115,6 +120,7 @@ class ActionController extends Zend_Controller_Action
$this->handlerBrowserWindows();
$moduleName = $this->getModuleName();
$this->view->defaultTitle = static::DEFAULT_TITLE;
$this->view->translationDomain = $moduleName !== 'default' ? $moduleName : 'icinga';
$this->_helper->layout()->isIframe = $request->getUrl()->shift('isIframe');
$this->_helper->layout()->showFullscreen = $request->getUrl()->shift('showFullscreen');
@ -526,11 +532,11 @@ class ActionController extends Zend_Controller_Action
}
$resp->setHeader(
'X-Icinga-Title',
rawurlencode($this->view->title . ' :: Icinga Web'),
rawurlencode($this->view->title . ' :: ' . static::DEFAULT_TITLE),
true
);
} else {
$resp->setHeader('X-Icinga-Title', rawurlencode('Icinga Web'), true);
$resp->setHeader('X-Icinga-Title', rawurlencode(static::DEFAULT_TITLE), true);
}
if ($this->rerenderLayout) {