Make header flips perisisent based on cookie

This commit is contained in:
Isaac Connor 2018-10-10 13:11:27 -04:00
parent ff00f15b58
commit 48e805c09f
2 changed files with 9 additions and 2 deletions

View File

@ -124,6 +124,7 @@ echo output_link_if_exists( array(
jQuery("#flip").click(function(){ jQuery("#flip").click(function(){
jQuery("#panel").slideToggle("slow"); jQuery("#panel").slideToggle("slow");
jQuery("#flip").toggleClass('glyphicon-menu-down').toggleClass('glyphicon-menu-up'); jQuery("#flip").toggleClass('glyphicon-menu-down').toggleClass('glyphicon-menu-up');
Cookie.write( 'zmHeaderFlip', jQuery('#flip').hasClass('glyphicon-menu-up') ? 'up' : 'down', { duration: 10*365 } );
}); });
}); });
</script> </script>
@ -303,7 +304,7 @@ if (isset($_REQUEST['filter']['Query']['terms']['attr'])) {
} }
?> ?>
<li><a href="?view=report_event_audit"<?php echo $view=='report_event_audit'?' class="selected"':''?>><?php echo translate('ReportEventAudit') ?></a></li> <li><a href="?view=report_event_audit"<?php echo $view=='report_event_audit'?' class="selected"':''?>><?php echo translate('ReportEventAudit') ?></a></li>
<li><a href="#"><span id="flip" class="glyphicon glyphicon-menu-up pull-right"></span></a></li> <li><a href="#"><span id="flip" class="glyphicon glyphicon-menu-<?php echo ( isset($_COOKIE['zmHeaderFlip']) and $_COOKIE['zmHeaderFlip'] == 'down') ? 'down' : 'up' ?> pull-right"></span></a></li>
</ul> </ul>
<?php } // end if canView('Monitors') ?> <?php } // end if canView('Monitors') ?>
@ -321,7 +322,7 @@ if (isset($_REQUEST['filter']['Query']['terms']['attr'])) {
</div> </div>
</div><!-- End .navbar-collapse --> </div><!-- End .navbar-collapse -->
</div> <!-- End .container-fluid --> </div> <!-- End .container-fluid -->
<div id="panel"> <div id="panel"<?php echo ( isset($_COOKIE['zmHeaderFlip']) and $_COOKIE['zmHeaderFlip'] == 'down' ) ? 'style="display:none;"' : '' ?>>
<?php <?php
}//end reload null. Runs on full page load }//end reload null. Runs on full page load

View File

@ -402,8 +402,14 @@ function initPage() {
jQuery("#hdrbutton").click(function(){ jQuery("#hdrbutton").click(function(){
jQuery("#flipMontageHeader").slideToggle("slow"); jQuery("#flipMontageHeader").slideToggle("slow");
jQuery("#hdrbutton").toggleClass('glyphicon-menu-down').toggleClass('glyphicon-menu-up'); jQuery("#hdrbutton").toggleClass('glyphicon-menu-down').toggleClass('glyphicon-menu-up');
Cookie.write( 'zmMontageHeaderFlip', jQuery('#hdrbutton').hasClass('glyphicon-menu-up') ? 'up' : 'down', { duration: 10*365 } );
}); });
}); });
if ( Cookie.read('zmMontageHeaderFlip') == 'down' ) {
// The chosen dropdowns require the selects to be visible, so once chosen has initialized, we can hide the header
jQuery("#flipMontageHeader").slideToggle("fast");
jQuery("#hdrbutton").toggleClass('glyphicon-menu-down').toggleClass('glyphicon-menu-up');
}
for ( var i = 0; i < monitorData.length; i++ ) { for ( var i = 0; i < monitorData.length; i++ ) {
monitors[i] = new Monitor(monitorData[i]); monitors[i] = new Monitor(monitorData[i]);