2014-05-09 08:42:23 +00:00
|
|
|
$(function() {
|
|
|
|
$.pageslide.closeCallback(function(pageslide, item) {
|
|
|
|
$("tr").removeClass("active");
|
|
|
|
pageslide.find('.preview').cycle('destroy');
|
|
|
|
});
|
|
|
|
$.pageslide.loadComplete(function(pageslide, item) {
|
|
|
|
$("tr").removeClass("active");
|
|
|
|
item.closest('tr').addClass('active');
|
|
|
|
if(item.data('id') == 'new') {
|
|
|
|
resetForm();
|
|
|
|
pageslide.find('form').attr('action', '/admin/ad_banners/');
|
|
|
|
pageslide.find('form').attr('method', 'post');
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
setForm(item.data('form'));
|
|
|
|
pageslide.find('form').attr('action', '/admin/ad_banners/' + item.data('id'));
|
|
|
|
pageslide.find('form').attr('method', 'put');
|
|
|
|
}
|
|
|
|
setSlideshow(pageslide.find('.preview'), item.data());
|
|
|
|
});
|
|
|
|
})
|