summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/js
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2013-08-17 13:07:18 +0200
committerVincent Petry <pvince81@owncloud.com>2013-09-13 19:59:14 +0200
commit1304b511e9533dee4cf1125e625568c8a74719a1 (patch)
tree2430ff5abeeb0f378547e49cb4b311b41c035421 /apps/files_trashbin/js
parentc149b57d3b4020c65d33966d5dc8395b8b821fc9 (diff)
downloadnextcloud-server-1304b511e9533dee4cf1125e625568c8a74719a1.tar.gz
nextcloud-server-1304b511e9533dee4cf1125e625568c8a74719a1.zip
Ajax calls for "files" and "files_trashbin" apps
Frontend: - The files app list now uses ajax calls to refresh the list. - Added support the browser back button (history API). - Added mask + spinner while loading file list Backend: - Added utility function in core JS for parsing query strings. - Moved file list + breadcrumb template data code to helper functions - Fixed some file paths in trashbin app to be similar to the files app
Diffstat (limited to 'apps/files_trashbin/js')
-rw-r--r--apps/files_trashbin/js/filelist.js29
-rw-r--r--apps/files_trashbin/js/trash.js14
2 files changed, 42 insertions, 1 deletions
diff --git a/apps/files_trashbin/js/filelist.js b/apps/files_trashbin/js/filelist.js
new file mode 100644
index 00000000000..ff3a846d860
--- /dev/null
+++ b/apps/files_trashbin/js/filelist.js
@@ -0,0 +1,29 @@
+// override reload with own ajax call
+FileList.reload = function(){
+ FileList.showMask();
+ if (FileList._reloadCall){
+ FileList._reloadCall.abort();
+ }
+ $.ajax({
+ url: OC.filePath('files_trashbin','ajax','list.php'),
+ data: {
+ dir : $('#dir').val(),
+ breadcrumb: true
+ },
+ error: function(result) {
+ FileList.reloadCallback(result);
+ },
+ success: function(result) {
+ FileList.reloadCallback(result);
+ }
+ });
+}
+
+FileList.setCurrentDir = function(targetDir, changeUrl){
+ $('#dir').val(targetDir);
+ // Note: IE8 handling ignored for now
+ if (window.history.pushState && changeUrl !== false){
+ url = OC.linkTo('files_trashbin', 'index.php')+"?dir="+ encodeURIComponent(targetDir).replace(/%2F/g, '/'),
+ window.history.pushState({dir: targetDir}, '', url);
+ }
+}
diff --git a/apps/files_trashbin/js/trash.js b/apps/files_trashbin/js/trash.js
index 40c0bdb3829..d73eadb6011 100644
--- a/apps/files_trashbin/js/trash.js
+++ b/apps/files_trashbin/js/trash.js
@@ -171,9 +171,15 @@ $(document).ready(function() {
action(filename);
}
}
+
+ // event handlers for breadcrumb items
+ $('#controls').delegate('.crumb:not(.home) a', 'click', onClickBreadcrumb);
});
- FileActions.actions.dir = {};
+ FileActions.actions.dir = {
+ // only keep 'Open' action for navigation
+ 'Open': FileActions.actions.dir.Open
+ };
});
function processSelection(){
@@ -246,3 +252,9 @@ function disableActions() {
$(".action").css("display", "none");
$(":input:checkbox").css("display", "none");
}
+function onClickBreadcrumb(e){
+ var $el = $(e.target).closest('.crumb');
+ e.preventDefault();
+ FileList.changeDirectory(decodeURIComponent($el.data('dir')));
+}
+