2011-03-05 21:27:20 -08:00
|
|
|
/**
|
|
|
|
|
* Javascript that applies to the whole site.
|
|
|
|
|
*
|
|
|
|
|
* Apply button() to buttons and submit buttons for jQuery UI styling.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
$(function() {
|
|
|
|
|
$("button, input:submit").button();
|
2011-05-15 23:13:21 -07:00
|
|
|
|
|
|
|
|
$('#globalAjaxLoading')
|
|
|
|
|
.hide() // hide it initially
|
|
|
|
|
.ajaxStart(function() {
|
|
|
|
|
$(this).show();
|
|
|
|
|
})
|
|
|
|
|
.ajaxStop(function() {
|
|
|
|
|
$(this).hide();
|
2011-05-18 16:46:22 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function getCakeID(model, count, field) {
|
|
|
|
|
return model+count+capitalizeFirstLetter(field);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getCakeName(model, count, field) {
|
|
|
|
|
return 'data['+model+']['+count+']['+field+']';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function capitalizeFirstLetter(string) {
|
|
|
|
|
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getSelectedID(elementID) {
|
|
|
|
|
var id;
|
|
|
|
|
$(elementID+" :selected").each(function(i, selected) {
|
|
|
|
|
id = this.value;
|
|
|
|
|
});
|
|
|
|
|
return id;
|
|
|
|
|
}
|
2011-05-15 23:13:21 -07:00
|
|
|
|
2011-05-18 16:46:22 -07:00
|
|
|
function getSelectedText(elementID) {
|
|
|
|
|
var text;
|
|
|
|
|
$(elementID+" :selected").each(function(i, selected) {
|
|
|
|
|
text = $(selected).text();
|
|
|
|
|
});
|
|
|
|
|
return text;
|
|
|
|
|
}
|