Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/richdocuments.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2016-06-07 13:11:50 +0300
committerJan Holesovsky <kendy@collabora.com>2016-06-07 13:12:23 +0300
commit68b81e846b7e7cf53e755929f5094820f2f1774f (patch)
tree93b491887873ff10df9ae57a7d6908563b33c542 /js
parentfdcd86524478548071b8adfd9438052fe7af483a (diff)
bccu#1882: Return to the 'Files' app when the editing started there.
Also retain the directory where the editing started.
Diffstat (limited to 'js')
-rw-r--r--js/documents.js15
-rw-r--r--js/viewer/viewer.js8
2 files changed, 20 insertions, 3 deletions
diff --git a/js/documents.js b/js/documents.js
index cb524131..0ad57a26 100644
--- a/js/documents.js
+++ b/js/documents.js
@@ -185,6 +185,7 @@ var documentsMain = {
loadErrorMessage : '',
loadErrorHint : '',
toolbar : '<div id="ocToolbar"><div id="ocToolbarInside"></div><span id="toolbar" class="claro"></span></div>',
+ returnToDir : null, // directory where we started from in the 'Files' app
UI : {
/* Editor wrapper HTML */
@@ -340,7 +341,12 @@ var documentsMain = {
} else {
// Does anything indicate that we need to autostart a session?
- fileId = parent.location.hash.replace(/\W*/g, '');
+ fileId = parent.location.hash.replace(/^\W*/, '');
+
+ if (fileId.indexOf('_') >= 0) {
+ documentsMain.returnToDir = unescape(fileId.replace(/^[^_]*_/, ''));
+ fileId = fileId.replace(/_.*/, '');
+ }
}
documentsMain.show();
@@ -637,7 +643,12 @@ var documentsMain = {
documentsMain.UI.hideEditor();
documentsMain.closeDocument();
$('#ocToolbar').remove();
- documentsMain.show();
+
+ if (documentsMain.returnToDir) {
+ window.location = OC.generateUrl('apps/files?dir={dir}', {dir: documentsMain.returnToDir});
+ } else {
+ documentsMain.show();
+ }
},
onTerminate: function(){
diff --git a/js/viewer/viewer.js b/js/viewer/viewer.js
index c33bc919..0c782d64 100644
--- a/js/viewer/viewer.js
+++ b/js/viewer/viewer.js
@@ -78,7 +78,13 @@ var odfViewer = {
onEdit : function(fileName, context){
var fileId = context.$file.attr('data-id');
- window.location = OC.generateUrl('apps/richdocuments/index#{file_id}', {file_id: fileId});
+ var fileDir = context.dir;
+
+ if (fileDir) {
+ window.location = OC.generateUrl('apps/richdocuments/index#{file_id}_{dir}', {file_id: fileId, dir: fileDir});
+ } else {
+ window.location = OC.generateUrl('apps/richdocuments/index#{file_id}', {file_id: fileId});
+ }
},
onView: function(filename, context) {