From b3a450bace8461fb7989d5406b9d9ec644d7df4a Mon Sep 17 00:00:00 2001 From: Frederic Guillot <fred@kanboard.net> Date: Sun, 8 Jan 2017 14:00:51 -0500 Subject: Display project analytics in modal box --- app/Helper/LayoutHelper.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'app/Helper/LayoutHelper.php') diff --git a/app/Helper/LayoutHelper.php b/app/Helper/LayoutHelper.php index 8d2e7e00..8be71757 100644 --- a/app/Helper/LayoutHelper.php +++ b/app/Helper/LayoutHelper.php @@ -22,7 +22,10 @@ class LayoutHelper extends Base */ public function app($template, array $params = array()) { - if ($this->request->isAjax()) { + $isAjax = $this->request->isAjax(); + $params['is_ajax'] = $isAjax; + + if ($isAjax) { return $this->template->render($template, $params); } @@ -160,7 +163,7 @@ class LayoutHelper extends Base $params['title'] = $params['project']['name'].' > '.$params['title']; } - return $this->subLayout('analytic/layout', 'analytic/sidebar', $template, $params); + return $this->subLayout('analytic/layout', 'analytic/sidebar', $template, $params, true); } /** @@ -188,13 +191,16 @@ class LayoutHelper extends Base * @param string $sidebar * @param string $template * @param array $params + * @param bool $ignoreAjax * @return string */ - public function subLayout($sublayout, $sidebar, $template, array $params = array()) + public function subLayout($sublayout, $sidebar, $template, array $params = array(), $ignoreAjax = false) { + $isAjax = $this->request->isAjax(); + $params['is_ajax'] = $isAjax; $content = $this->template->render($template, $params); - if ($this->request->isAjax()) { + if (!$ignoreAjax && $isAjax) { return $content; } -- cgit v1.2.3