From 9b3fe3ad2fcf88eeff29eadbe36ce4b5bb3d0619 Mon Sep 17 00:00:00 2001 From: Chris Hallberg <crhallberg@gmail.com> Date: Fri, 24 Apr 2015 10:28:35 -0400 Subject: [PATCH] Moved userIsLoggedIn JS variable to layout. Also checkstyles. --- .../templates/RecordDriver/SolrDefault/core.phtml | 8 -------- themes/blueprint/templates/layout/layout.phtml | 9 +++++++++ .../templates/RecordDriver/SolrDefault/core.phtml | 11 ----------- themes/bootstrap3/templates/layout/layout.phtml | 9 +++++++++ 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/themes/blueprint/templates/RecordDriver/SolrDefault/core.phtml b/themes/blueprint/templates/RecordDriver/SolrDefault/core.phtml index 84279ea2f51..00fd354e5fc 100644 --- a/themes/blueprint/templates/RecordDriver/SolrDefault/core.phtml +++ b/themes/blueprint/templates/RecordDriver/SolrDefault/core.phtml @@ -1,11 +1,3 @@ -<? - if($loggedin = $this->auth()->isLoggedIn()) { - $user_id = $loggedin->id; - $loggedin = true; - } else { - $user_id = false; - } -?> <div class="span-13" vocab="http://schema.org/" resource="#record" typeof="<?=$this->driver->getSchemaOrgFormats()?> Product"> <h1 property="name"><?=$this->escapeHtml($this->driver->getShortTitle() . ' ' . $this->driver->getSubtitle() . ' ' . $this->driver->getTitleSection())?></h1> diff --git a/themes/blueprint/templates/layout/layout.phtml b/themes/blueprint/templates/layout/layout.phtml index 5d0f99455f3..f96416f5e05 100644 --- a/themes/blueprint/templates/layout/layout.phtml +++ b/themes/blueprint/templates/layout/layout.phtml @@ -58,6 +58,15 @@ ); } $this->headScript()->appendScript($this->jsTranslations()->getScript()); + if($loggedin = $this->auth()->isLoggedIn()) { + $user_id = $loggedin->id; + $loggedin = true; + } else { + $user_id = false; + } + $this->headScript()->appendScript( + 'var userIsLoggedIn = ' . ($loggedin ? 'true' : 'false') . ';' + ); } if ($feedback) { $this->headScript()->appendFile("jquery.tabSlideOut.v2.0.js"); diff --git a/themes/bootstrap3/templates/RecordDriver/SolrDefault/core.phtml b/themes/bootstrap3/templates/RecordDriver/SolrDefault/core.phtml index 927ce810f63..98b3841ca28 100644 --- a/themes/bootstrap3/templates/RecordDriver/SolrDefault/core.phtml +++ b/themes/bootstrap3/templates/RecordDriver/SolrDefault/core.phtml @@ -1,14 +1,3 @@ -<? - if($loggedin = $this->auth()->isLoggedIn()) { - $user_id = $loggedin->id; - $loggedin = true; - } else { - $user_id = false; - } -?> -<script> - var userIsLoggedIn = <?=$loggedin ? 'true' : 'false' ?>; -</script> <div class="row" vocab="http://schema.org/" resource="#record" typeof="<?=$this->driver->getSchemaOrgFormats()?> Product"> <div class="col-sm-3"> <div class="text-center"> diff --git a/themes/bootstrap3/templates/layout/layout.phtml b/themes/bootstrap3/templates/layout/layout.phtml index 154317b0ff8..f5633b7b0a0 100644 --- a/themes/bootstrap3/templates/layout/layout.phtml +++ b/themes/bootstrap3/templates/layout/layout.phtml @@ -63,6 +63,15 @@ ); } $this->headScript()->appendScript($this->jsTranslations()->getScript()); + if($loggedin = $this->auth()->isLoggedIn()) { + $user_id = $loggedin->id; + $loggedin = true; + } else { + $user_id = false; + } + $this->headScript()->appendScript( + 'var userIsLoggedIn = ' . ($loggedin ? 'true' : 'false') . ';' + ); } // Session keep-alive -- GitLab