CC-4583: Use AJAX calls instead of refreshing entire page

-done
This commit is contained in:
denise 2012-10-26 18:09:30 -04:00
parent 0ab1353564
commit 3a7700eaac
12 changed files with 185 additions and 82 deletions

View file

@ -109,3 +109,9 @@ function openPreviewWindow(url) {
function pad(number, length) {
return sprintf("%'0"+length+"d", number);
}
function removeSuccessMsg() {
var $status = $('.success');
$status.fadeOut("slow", function(){$status.empty()});
}

View file

@ -483,12 +483,6 @@ function callback(data, type) {
setTimeout(removeSuccessMsg, 5000);
}
function removeSuccessMsg() {
var $status = $('.success');
$status.fadeOut("slow", function(){$status.empty()});
}
function appendAddButton() {
var add_button = "<a class='btn btn-small' id='criteria_add'>" +
"<i class='icon-white icon-plus'></i></a>";

View file

@ -88,6 +88,17 @@ $(document).ready(function() {
$(this).toggleClass("closed");
return false;
}).next().hide();
$('#pref_save').live('click', function() {
var data = $('#pref_form').serialize();
var url = baseUrl+'/Preference/index';
$.post(url, {format: "json", data: data}, function(data){
var json = $.parseJSON(data);
$('#content').empty().append(json.html);
setTimeout(removeSuccessMsg, 5000);
});
});
showErrorSections();

View file

@ -352,4 +352,22 @@ $(document).ready(function() {
at: "right center"
},
})
$('#stream_save').live('click', function(){
var confirm_pypo_restart_text = "If you change the username or password values for an enabled stream the "
+ "playout engine will be rebooted and your listeners will hear silence for"
+ "5-10 seconds. Changing the following fields will NOT cause a reboot: "
+ "Stream Label (Global Settings), and Switch Transition Fade(s), Master "
+ "Username, and Master Password (Input Stream Settings). If Airtime is recording"
+ ", and if the change causes a playout engine restart, the recording will be interrupted.";
if (confirm(confirm_pypo_restart_text)) {
var data = $('#stream_form').serialize();
var url = baseUrl+'/Preference/stream-setting';
$.post(url, {format:"json", data: data}, function(data){
var json = $.parseJSON(data);
$('#content').empty().append(json.html);
});
}
});
});

View file

@ -60,7 +60,7 @@ function rowCallback( nRow, aData, iDisplayIndex ){
return nRow;
}
$(document).ready(function() {
function populateUserTable() {
$('#users_datatable').dataTable( {
"bProcessing": true,
"bServerSide": true,
@ -92,11 +92,32 @@ $(document).ready(function() {
"sDom": '<"H"lf<"dt-process-rel"r>>t<"F"ip>',
});
}
$(document).ready(function() {
populateUserTable();
//$('#user_details').hide();
var newUser = {login:"", first_name:"", last_name:"", type:"G", id:""};
$('#add_user_button').click(function(){populateForm(newUser)});
$('#add_user_button').live('click', function(){populateForm(newUser)});
$('#save_user').live('click', function(){
var data = $('#user_form').serialize();
var url = baseUrl+'/User/add-user';
$.post(url, {format: "json", data: data}, function(data){
var json = $.parseJSON(data);
if (json.valid === "true") {
$('#content').empty().append(json.html);
populateUserTable();
} else {
//if form is invalid we only need to redraw the form
$('#user_form').empty().append($(json.html).find('#user_form').children());
}
setTimeout(removeSuccessMsg, 5000);
});
});
});