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;
|
2011-05-19 00:05:01 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Setup CKEditor toolbars
|
|
|
|
|
var config = {
|
|
|
|
|
toolbar:[
|
|
|
|
|
|
|
|
|
|
['Cut','Copy','Paste','PasteText','PasteFromWord','-','Scayt'],
|
|
|
|
|
['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
|
|
|
|
|
['Image','Table','HorizontalRule','SpecialChar'],
|
|
|
|
|
'/',
|
|
|
|
|
['Styles','Format'],
|
2011-05-24 02:11:07 -07:00
|
|
|
['Bold','Italic','Strike','Underline'],
|
2011-05-19 00:05:01 -07:00
|
|
|
['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
|
|
|
|
|
['Link','Unlink'],
|
|
|
|
|
['Maximize','-','About']
|
|
|
|
|
]
|
|
|
|
|
};
|