Skip to content
Permalink
Browse files

lib: Allow to control reload CSS header in Response

Whenever the theme is switched, client side script code has to be instructed to reload CSS.

refs #10705
  • Loading branch information
lippserd committed Nov 27, 2015
1 parent 5d4a628 commit 8fb9d94f4697e946dd8746daaf7ed285fcc3aedc
Showing with 36 additions and 0 deletions.
  1. +36 −0 library/Icinga/Web/Response.php
@@ -7,6 +7,9 @@
use Icinga\Application\Icinga;
use Icinga\Web\Response\JsonResponse;
/**
* A HTTP response
*/
class Response extends Zend_Controller_Response_Http
{
/**
@@ -23,6 +26,13 @@ class Response extends Zend_Controller_Response_Http
*/
protected $request;
/**
* Whether to instruct client side script code to reload CSS
*
* @var bool
*/
protected $reloadCss;
/**
* Whether to send the rerender layout header on XHR
*
@@ -74,6 +84,29 @@ public function getRequest()
return $this->request;
}
/**
* Get whether to instruct client side script code to reload CSS
*
* @return bool
*/
public function isReloadCss()
{
return $this->reloadCss;
}
/**
* Set whether to instruct client side script code to reload CSS
*
* @param bool $reloadCss
*
* @return $this
*/
public function setReloadCss($reloadCss)
{
$this->reloadCss = $reloadCss;
return $this;
}
/**
* Get whether to send the rerender layout header on XHR
*
@@ -123,6 +156,9 @@ protected function prepare()
if ($this->getRerenderLayout()) {
$this->setHeader('X-Icinga-Container', 'layout', true);
}
if ($this->isReloadCss()) {
$this->setHeader('X-Icinga-Reload-Css', 'now', true);
}
} else {
if ($redirectUrl !== null) {
$this->setRedirect($redirectUrl->getAbsoluteUrl());

0 comments on commit 8fb9d94

Please sign in to comment.
You can’t perform that action at this time.