diff options
author | Bart Visscher <bartv@thisnet.nl> | 2012-04-12 22:25:40 +0200 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2012-04-12 23:10:49 +0200 |
commit | bc81179163642098ee27cf43aff25c4c68f3e12c (patch) | |
tree | 2481e0395ae30f5a37259074b7af0e02cd9ebc64 /core/js | |
parent | 815649dbd7a8e8d6dfd92ca6ccaa157d1f80a8c1 (diff) | |
download | nextcloud-server-bc81179163642098ee27cf43aff25c4c68f3e12c.tar.gz nextcloud-server-bc81179163642098ee27cf43aff25c4c68f3e12c.zip |
Fix categories delete fallback when there is no app specific ajax categories delete function
Diffstat (limited to 'core/js')
-rw-r--r-- | core/js/oc-vcategories.js | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/core/js/oc-vcategories.js b/core/js/oc-vcategories.js index e3b1abba08d..d5a9b0016de 100644 --- a/core/js/oc-vcategories.js +++ b/core/js/oc-vcategories.js @@ -53,25 +53,21 @@ OCCategories={ } }); }, + _processDeleteResult:function(jsondata, status, xhr){ + if(jsondata.status == 'success'){ + OCCategories._update(jsondata.data.categories); + } else { + OC.dialogs.alert(jsondata.data.message, 'Error'); + } + }, doDelete:function(){ var categories = $('#categorylist').find('input[type="checkbox"]').serialize(); categories += '&app=' + OCCategories.app; console.log('OCCategories.delete: ' + categories); - $.post(OC.filePath(OCCategories.app, 'ajax', 'categories/delete.php'),categories,function(jsondata, status, xhr){ - if (status == 'error' && xhr.status == 404) { - $.post(OC.filePath('core', 'ajax', 'vcategories/delete.php'),categories,function(jsondata, status, xhr){ - if(jsondata.status == 'success'){ - OCCategories._update(jsondata.data.categories); - } else { - OC.dialogs.alert(jsondata.data.message, 'Error'); - } - }); - return; - } - if(jsondata.status == 'success'){ - OCCategories._update(jsondata.data.categories); - } else { - OC.dialogs.alert(jsondata.data.message, 'Error'); + $.post(OC.filePath(OCCategories.app, 'ajax', 'categories/delete.php'), categories, OCCategories._processDeleteResult) + .error(function(xhr){ + if (xhr.status == 404) { + $.post(OC.filePath('core', 'ajax', 'vcategories/delete.php'), categories, OCCategories._processDeleteResult); } }); }, |