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:
parent
47af648803
commit
984035dde3
|
@ -36,6 +36,7 @@ $cakeDescription = __d('cake_dev', 'CakePHP: the rapid development php framework
|
||||||
echo $this->fetch('css');
|
echo $this->fetch('css');
|
||||||
echo $this->fetch('script');
|
echo $this->fetch('script');
|
||||||
echo $this->Html->script('jquery-2.0.1.min');
|
echo $this->Html->script('jquery-2.0.1.min');
|
||||||
|
echo $this->Html->script('events.js');
|
||||||
echo $this->Js->writeBuffer();
|
echo $this->Js->writeBuffer();
|
||||||
?>
|
?>
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -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();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue