bccu#1882: Return to the 'Files' app when the editing started there.

Also retain the directory where the editing started.
pull/1/head
Jan Holesovsky 8 years ago committed by Andras Timar
parent 39b860ffa2
commit cef6160019

@ -185,6 +185,7 @@ var documentsMain = {
loadErrorMessage : '', loadErrorMessage : '',
loadErrorHint : '', loadErrorHint : '',
toolbar : '<div id="ocToolbar"><div id="ocToolbarInside"></div><span id="toolbar" class="claro"></span></div>', 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 : { UI : {
/* Editor wrapper HTML */ /* Editor wrapper HTML */
@ -340,7 +341,12 @@ var documentsMain = {
} else { } else {
// Does anything indicate that we need to autostart a session? // 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(); documentsMain.show();
@ -637,7 +643,12 @@ var documentsMain = {
documentsMain.UI.hideEditor(); documentsMain.UI.hideEditor();
documentsMain.closeDocument(); documentsMain.closeDocument();
$('#ocToolbar').remove(); $('#ocToolbar').remove();
documentsMain.show();
if (documentsMain.returnToDir) {
window.location = OC.generateUrl('apps/files?dir={dir}', {dir: documentsMain.returnToDir});
} else {
documentsMain.show();
}
}, },
onTerminate: function(){ onTerminate: function(){

@ -78,7 +78,13 @@ var odfViewer = {
onEdit : function(fileName, context){ onEdit : function(fileName, context){
var fileId = context.$file.attr('data-id'); 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) { onView: function(filename, context) {

Loading…
Cancel
Save