Skip to content

Commit

Permalink
use the same checks as for the frontend and backend
Browse files Browse the repository at this point in the history
  • Loading branch information
zero-24 committed Aug 3, 2015
1 parent 0b79fd1 commit 832994b
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 38 deletions.
4 changes: 2 additions & 2 deletions administrator/templates/hathor/index.php
Expand Up @@ -42,7 +42,7 @@
// Load custom.css
$file = 'templates/' . $this->template . '/css/custom.css';

if (is_file($file))
if (file_exists($file) && filesize($file) > 0)
{
$doc->addStyleSheetVersion($file);
}
Expand Down Expand Up @@ -170,7 +170,7 @@
<p class="copyright">
<?php
// Fix wrong display of Joomla!® in RTL language
if (JFactory::getLanguage()->isRTL())
if (JFactory::getLanguage()->isRtl())
{
$joomla = '<a href="http://www.joomla.org" target="_blank">Joomla!</a><sup>&#174;&#x200E;</sup>';
}
Expand Down
98 changes: 62 additions & 36 deletions administrator/templates/isis/index.php
Expand Up @@ -24,16 +24,16 @@
// Add Stylesheets
$doc->addStyleSheetVersion($this->baseurl . '/templates/' . $this->template . '/css/template' . ($this->direction == 'rtl' ? '-rtl' : '') . '.css');

// Load specific language related CSS
$file = 'language/' . $lang->getTag() . '/' . $lang->getTag() . '.css';
// Load custom.css
$file = 'templates/' . $this->template . '/css/custom.css';

if (is_file($file))
if (file_exists($file) && filesize($file) > 0)
{
$doc->addStyleSheetVersion($file);
}

// Load custom.css
$file = 'templates/' . $this->template . '/css/custom.css';
// Load specific language related CSS
$file = 'language/' . $lang->getTag() . '/' . $lang->getTag() . '.css';

if (is_file($file))
{
Expand Down Expand Up @@ -71,10 +71,8 @@
$stickyToolbar = $this->params->get('stickyToolbar', '1');

// Header classes
$navbar_color = $this->params->get('templateColor') ? $this->params->get('templateColor') : '';
$header_color = ($displayHeader && $this->params->get('headerColor')) ? $this->params->get('headerColor') : '';
$navbar_is_light = ($navbar_color && colorIsLight($navbar_color));
$header_is_light = ($header_color && colorIsLight($header_color));
$template_is_light = ($this->params->get('templateColor') && colorIsLight($this->params->get('templateColor')));
$header_is_light = ($displayHeader && $this->params->get('headerColor') && colorIsLight($this->params->get('headerColor')));

if ($displayHeader)
{
Expand All @@ -98,28 +96,6 @@ function colorIsLight($color)

return $yiq >= 200;
}

// Pass some values to javascript
$offset = 20;

if ($displayHeader || !$statusFixed)
{
$offset = 30;
}

$stickyBar = 0;

if ($stickyToolbar)
{
$stickyBar = 1;
}

$doc->addScriptDeclaration(
"
window.isisStickyToolbar = $stickyBar;
window.isisOffsetTop = $offset;
"
);
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>">
Expand All @@ -129,18 +105,18 @@ function colorIsLight($color)
<jdoc:include type="head" />

<!-- Template color -->
<?php if ($navbar_color) : ?>
<?php if ($this->params->get('templateColor')) : ?>
<style type="text/css">
.navbar-inner, .navbar-inverse .navbar-inner, .dropdown-menu li > a:hover, .dropdown-menu .active > a, .dropdown-menu .active > a:hover, .navbar-inverse .nav li.dropdown.open > .dropdown-toggle, .navbar-inverse .nav li.dropdown.active > .dropdown-toggle, .navbar-inverse .nav li.dropdown.open.active > .dropdown-toggle, #status.status-top {
background: <?php echo $navbar_color; ?>;
background: <?php echo $this->params->get('templateColor'); ?>;
}
</style>
<?php endif; ?>
<!-- Template header color -->
<?php if ($header_color) : ?>
<?php if ($displayHeader && $this->params->get('headerColor')) : ?>
<style type="text/css">
.header {
background: <?php echo $header_color; ?>;
background: <?php echo $this->params->get('headerColor'); ?>;
}
</style>
<?php endif; ?>
Expand Down Expand Up @@ -171,7 +147,7 @@ function colorIsLight($color)

<body class="admin <?php echo $option . ' view-' . $view . ' layout-' . $layout . ' task-' . $task . ' itemid-' . $itemid; ?>">
<!-- Top Navigation -->
<nav class="navbar<?php echo $navbar_is_light ? '' : ' navbar-inverse'; ?> navbar-fixed-top">
<nav class="navbar<?php echo $template_is_light ? '' : ' navbar-inverse'; ?> navbar-fixed-top">
<div class="navbar-inner">
<div class="container-fluid">
<?php if ($this->params->get('admin_menus') != '0') : ?>
Expand Down Expand Up @@ -314,5 +290,55 @@ function colorIsLight($color)
<!-- End Status Module -->
<?php endif; ?>
<jdoc:include type="modules" name="debug" style="none" />
<?php if ($stickyToolbar) : ?>
<script>
jQuery(function($)
{

var navTop;
var isFixed = false;

processScrollInit();
processScroll();

$(window).on('resize', processScrollInit);
$(window).on('scroll', processScroll);

function processScrollInit()
{
if ($('.subhead').length) {
navTop = $('.subhead').length && $('.subhead').offset().top - <?php echo ($displayHeader || !$statusFixed) ? 30 : 20;?>;

// Fix the container top
$(".container-main").css("top", $('.subhead').height() + $('nav.navbar').height());

// Only apply the scrollspy when the toolbar is not collapsed
if (document.body.clientWidth > 480)
{
$('.subhead-collapse').height($('.subhead').height());
$('.subhead').scrollspy({offset: {top: $('.subhead').offset().top - $('nav.navbar').height()}});
}
}
}

function processScroll()
{
if ($('.subhead').length) {
var scrollTop = $(window).scrollTop();
if (scrollTop >= navTop && !isFixed) {
isFixed = true;
$('.subhead').addClass('subhead-fixed');

// Fix the container top
$(".container-main").css("top", $('.subhead').height() + $('nav.navbar').height());
} else if (scrollTop <= navTop && isFixed) {
isFixed = false;
$('.subhead').removeClass('subhead-fixed');
}
}
}
});
</script>
<?php endif; ?>
</body>
</html>

0 comments on commit 832994b

Please sign in to comment.