Initial commit of events.js file; added it to all pages.

events.js should eventually be loaded in only the events view.  This commit
creates #15.
This commit is contained in:
Kyle Johnson 2013-05-29 07:47:27 -04:00
parent 47af648803
commit 984035dde3
2 changed files with 24 additions and 0 deletions

View File

@ -36,6 +36,7 @@ $cakeDescription = __d('cake_dev', 'CakePHP: the rapid development php framework
echo $this->fetch('css');
echo $this->fetch('script');
echo $this->Html->script('jquery-2.0.1.min');
echo $this->Html->script('events.js');
echo $this->Js->writeBuffer();
?>
</head>

View File

@ -0,0 +1,23 @@
$(document).ready(function() {
$('[id^=Monitor_]').click(function() {
$('h2').append('<img src="/img/loading.gif" alt="loading" width="25px" />');
$base_url = '/events/index/';
if ($(this).attr('class') == 'selected') {
$(this).toggleClass('selected');
} else {
$(this).toggleClass('selected');
}
$('[id^=Monitor_]').each(function() {
if ($(this).attr('class') == 'selected' ){
$monitor_id = $(this).attr('id').split('_');
$base_url = $base_url + 'MonitorId:'+$monitor_id[1]+'/';
}
});
$('#Events').load($base_url + ' #Events', function(){
$('h2 img').detach();
});
});
});