Changeset 833 for trunk/web-app
- Timestamp:
- Mar 3, 2011, 12:24:01 PM (14 years ago)
- Location:
- trunk/web-app
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/web-app/css/main.css
r825 r833 751 751 right: 5px; 752 752 padding: 5px; 753 cursor: pointer; 753 754 } 754 755 -
trunk/web-app/js/taskShow.js
r831 r833 1 1 2 // Load an Entry from via AJAX. 3 // @container Container object to load response into. 2 // Load data into createContainer and register events. 3 function loadCreateContainer(data, createContainer, listContainer, button) { 4 // Load the response data and show container. 5 createContainer.html(data).slideDown(800); 6 // Scroll the window. 7 jQuery('html,body').animate({scrollTop: createContainer.offset().top}, 900, function() { 8 createContainer.find(':input[name="comment"]').focus(); 9 }); 10 // Hijack form submit to use our function. 11 var eventData = {listContainer:listContainer,createContainer:createContainer, button:button}; 12 createContainer.find('form:first').submit(eventData, submitCreateEntryForm); 13 // Register the close img click handler. 14 createContainer.find('.pane_close img').click(function(){ 15 createContainer.slideUp(600); 16 button.show(600); 17 }); 18 } 19 20 // Submit a create Entry form via AJAX. 21 function submitCreateEntryForm(event) { 22 23 var actionUrl = getContextPath()+"/entryDetailed/ajaxSave/"; 24 25 event.preventDefault(); 26 var listContainer = event.data.listContainer; 27 var createContainer = event.data.createContainer; 28 var button = event.data.button; 29 var form = createContainer.find('form:first'); 30 31 // On success reload listContainer. 32 function success(data, textStatus, jqXHR){ 33 createContainer.hide(); 34 listContainer.html(data); 35 button.show(600); 36 } 37 38 // On create failure controller sets 403 and returns the form template. 39 function error(jqXHR, textStatus, errorThrown){ 40 if(jqXHR.status == 403 && jqXHR.responseText){ 41 loadCreateContainer(jqXHR.responseText, createContainer, listContainer, button); 42 } 43 else { 44 createContainer.html(errorIndication().show()).slideDown(600); 45 } 46 button.show(600); 47 } 48 49 // Start. 50 createContainer.html(loadingIndication().show()).slideDown(600); 51 52 jQuery.ajax({ 53 url: actionUrl, 54 data: form.serializeArray(), 55 success: success, 56 error: error 57 }); 58 } 59 60 // Get a create Entry form via AJAX. 61 // @listContainer Container object to reload list into. 62 // @createContainer Container object to load response into. 4 63 // @button Button object used to trigger this function. 5 // @ args Params map to pass to actionUrl.6 function loadEntryForm(container, button, params) {64 // @params Params map to pass to actionUrl. 65 function getCreateEntryForm(listContainer, createContainer, button, params) { 7 66 8 67 var actionUrl = getContextPath()+"/entryDetailed/ajaxCreate/"; 9 68 69 // On success load createContainer. 10 70 function success(data, textStatus, jqXHR){ 11 container.html(data); 12 jQuery('html,body').animate({scrollTop: container.offset().top}, 800, function() { 13 container.css("border", "1px solid #006DBA"); 14 container.find(':input[name="comment"]').focus(); 15 }); 71 loadCreateContainer(data, createContainer, listContainer, button); 16 72 } 17 73 74 // On error show controller responseText or show default error. 18 75 function error(jqXHR, textStatus, errorThrown){ 19 container.html(errorIndication().slideDown(600)); 76 if(jqXHR.status == 403 && jqXHR.responseText){ 77 loadCreateContainer(jqXHR.responseText, createContainer, listContainer, button); 78 } 79 else { 80 createContainer.html(errorIndication().show()).slideDown(600); 81 } 20 82 button.show(600); 21 83 } … … 23 85 // Start. 24 86 button.hide(600); 25 c ontainer.html(loadingIndication().slideDown(600));87 createContainer.html(loadingIndication().show()).slideDown(600); 26 88 27 89 jQuery.ajax({ … … 32 94 }); 33 95 } 96
Note: See TracChangeset
for help on using the changeset viewer.