diff options
author | Pranav Kant <pranavk@collabora.com> | 2016-06-08 22:09:17 +0300 |
---|---|---|
committer | Pranav Kant <pranavk@collabora.com> | 2016-06-09 17:47:36 +0300 |
commit | b138109820e246c3323ae410b8a7715beb16d683 (patch) | |
tree | 5c8bd0c47f16fd00559ab4cf8237b5cacd011647 /js | |
parent | 3566c7cff5a06aa2870ef2129c8c5c56f2d26bc5 (diff) |
Don't load all documents when only one is clicked on from 'Files'
Diffstat (limited to 'js')
-rw-r--r-- | js/documents.js | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/js/documents.js b/js/documents.js index 0ad57a26..15a5a84b 100644 --- a/js/documents.js +++ b/js/documents.js @@ -12,9 +12,9 @@ $.widget('oc.documentGrid', { }, - render : function(){ + render : function(fileId){ var that = this; - jQuery.when(this._load()) + jQuery.when(this._load(fileId)) .then(function(){ that._render(); }); @@ -78,10 +78,17 @@ $.widget('oc.documentGrid', { } }, - _load : function (){ + _load : function (fileId){ var that = this; var def = new $.Deferred(); - $.getJSON(OC.generateUrl('apps/richdocuments/ajax/documents/list')) + var url = 'apps/richdocuments/ajax/documents/list'; + var dataObj = {}; + if (fileId){ + url = 'apps/richdocuments/ajax/documents/get/{fileId}'; + dataObj = { fileId: fileId }; + } + + $.getJSON(OC.generateUrl(url, dataObj)) .done(function (result) { if (!result || result.status === 'error') { documentsMain.loadError = true; @@ -349,7 +356,7 @@ var documentsMain = { } } - documentsMain.show(); + documentsMain.show(fileId); if (fileId) { documentsMain.overlay.documentOverlay('show'); @@ -671,12 +678,12 @@ var documentsMain = { } }, - show: function(){ + show: function(fileId){ if (documentsMain.isGuest){ return; } documentsMain.UI.showProgress(t('richdocuments', 'Loading documents...')); - documentsMain.docs.documentGrid('render'); + documentsMain.docs.documentGrid('render', fileId); documentsMain.UI.hideProgress(); } }; |