Permalink
Browse files

Added the spinner to card and phase creation/editing

  • Loading branch information...
1 parent e5aace5 commit 13796ff7336b0f48d858229ce1bb1d3240f7aaa7 @mirhagen mirhagen committed Jan 15, 2010
View
@@ -1,5 +1,5 @@
#utf-8
-#Tue Jan 12 13:17:14 CET 2010
+#Thu Jan 14 10:30:39 CET 2010
plugins.acegi=0.5.2
app.version=0.1
plugins.jquery=1.3.2.4
@@ -24,7 +24,8 @@
<g:formRemote url="[controller:'card',action:'move']"
update="moveCardDialog" name="cardForm"
- onSuccess="jQuery('#moveCardDialog').qRefreshDialog({formData:data,url:resources.cardShowURL})" >
+ onSuccess="jQuery('#moveCardDialog').qRefreshDialog({formData:data,url:resources.cardShowURL})"
+ onLoading="jQuery.toggleSpinner()" onComplete="jQuery.toggleSpinner()">
<div class="header">
@@ -116,7 +117,8 @@
<g:formRemote url="[controller:'card',action:'update', params: [format: 'html']]"
update="editCardDialog" name="cardForm"
- onSuccess="jQuery('#editCardDialog').qRefreshDialog({formData:data,successTitle:'Success',successMessage:'Card successfully updated',url:resources.cardShowURL})">
+ onSuccess="jQuery('#editCardDialog').qRefreshDialog({formData:data,successTitle:'Success',successMessage:'Card successfully updated',url:resources.cardShowURL})"
+ onLoading="jQuery.toggleSpinner()" onComplete="jQuery.toggleSpinner()">
<div class="header">
@@ -220,7 +222,8 @@
<g:formRemote url="${[controller:'card',action:'create', params: [format: 'html']]}"
update="createCardDialog" name="cardForm"
onSuccess="jQuery('#createCardDialog').qRefreshDialog({formData:data,url:resources.cardShowURL, errorCallback: jQuery.qInitAssigneeSelector })"
- before="if(\$('[name=title]').val() == 'Title... ') \$('[name=title]').val('');">
+ before="if(\$('[name=title]').val() == 'Title... ') \$('[name=title]').val('');"
+ onLoading="jQuery.toggleSpinner()" onComplete="jQuery.toggleSpinner()">
<div class="header">
<div class="dropdownContainer assignee">
@@ -26,7 +26,8 @@
</g:hasErrors>
<g:formRemote url="[controller:'phase',action:'update',params: [format: 'html']]" update="editPhaseDialog" name="phaseForm"
- onSuccess="jQuery('#editPhaseDialog').qRefreshDialog({formData:data,url:resources.phaseShowURL,indexSelector:'[name=phasePos]',successTitle:'Success',successMessage:'Phase successfully updated'})">
+ onSuccess="jQuery('#editPhaseDialog').qRefreshDialog({formData:data,url:resources.phaseShowURL,indexSelector:'[name=phasePos]',successTitle:'Success',successMessage:'Phase successfully updated'})"
+ onLoading="jQuery.toggleSpinner()" onComplete="jQuery.toggleSpinner()">
<div class="content">
@@ -93,7 +94,8 @@
</g:hasErrors>
<g:formRemote url="[controller:'phase',action:'create',params: [format: 'html']]" update="createPhaseDialog" name="phaseForm"
- onSuccess="jQuery('#createPhaseDialog').qRefreshDialog({formData:data,url:resources.phaseShowURL,indexSelector:'[name=phasePos]'})">
+ onSuccess="jQuery('#createPhaseDialog').qRefreshDialog({formData:data,url:resources.phaseShowURL,indexSelector:'[name=phasePos]'})"
+ onLoading="jQuery.toggleSpinner()" onComplete="jQuery.toggleSpinner()">
<div class="content">
@@ -143,7 +145,3 @@
</g:formRemote>
</g:elseif>
-
-
-
-
@@ -179,6 +179,7 @@
enableCardForm(settings.dialog,settings.resources.cardEditDialogTitle);
dialogBtns[settings.resources.cardFormUpdateBtn] = function(){
settings.dialog.find('input[type="submit"]').click();
+ jQuery.toggleSpinner();
};
if( settings.admin ){
@@ -1364,15 +1365,15 @@
defaults.append ? $element.append(data) : $element.html(data);
}
},
- complete: function(){toggleSpinner(); }
+ complete: function(){$.toggleSpinner(); }
};
var settings = $.extend(defaults, options);
if( options.completeCallback ){
- settings.complete = function() { options.completeCallback(); toggleSpinner(); };
+ settings.complete = function() { options.completeCallback(); $.toggleSpinner(); };
}
- toggleSpinner();
+ $.toggleSpinner();
$.ajax(settings);
};
@@ -1386,20 +1387,20 @@
error: function(XMLHttpRequest, textStatus, errorThrown){
if( XMLHttpRequest.status == 0 ){
if( defaults.tries > 3 ){
- toggleSpinner();
+ $.toggleSpinner();
showServerDownMesg( defaults.tries );
} else {
defaults.tries = defaults.tries + 1;
defaults.caller( defaults.tries );
}
}
if( defaults.errorCallback ){
- toggleSpinner();
+ $.toggleSpinner();
defaults.errorCallback(XMLHttpRequest, textStatus, errorThrown);
}
},
success: function(data, textStatus){
- toggleSpinner();
+ $.toggleSpinner();
var fail = data.indexOf('<html>') != -1;
if( fail ) {
showSessionTimeoutMesg();
@@ -1412,7 +1413,7 @@
};
var settings = $.extend(defaults,options);
- toggleSpinner();
+ $.toggleSpinner();
$.ajax(settings);
};
@@ -1425,7 +1426,7 @@
error: function(XMLHttpRequest, textStatus, errorThrown){
if( XMLHttpRequest.status == 0 ){
if( defaults.tries > 3 ){
- toggleSpinner();
+ $.toggleSpinner();
showServerDownMesg( defaults.tries );
} else {
defaults.tries = defaults.tries + 1;
@@ -1437,7 +1438,7 @@
}
},
success: function(data, textStatus){
- toggleSpinner();
+ $.toggleSpinner();
var fail = data.indexOf('<html>') != -1;
if( fail ) {
showSessionTimeoutMesg();
@@ -1450,7 +1451,7 @@
};
var settings = $.extend(defaults,options);
- toggleSpinner();
+ $.toggleSpinner();
$.ajax(settings);
};
@@ -1507,7 +1508,7 @@
}
}
- function toggleSpinner(){
+ $.toggleSpinner = function(){
// TODO: Set a delay for showing the spinner?
if( !$('#spinner').length ){
$('<div id="spinner"><img src="'+resources.spinnerImg+'"/></div>').appendTo($('body'));

0 comments on commit 13796ff

Please sign in to comment.