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
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2019-01-30 23:33:19 +0300
committerGitHub <noreply@github.com>2019-01-30 23:33:19 +0300
commitf0f151268156fcfafc1dfebe97fc1c5e8211607d (patch)
tree99a4cc6495b06fe1484506b8e009eccd8df71e22 /js/documents.js
parentedd9c6bb3ef9e9d71d28b39db5e814f8b4166b4d (diff)
parentec388693be862795a37820a1380be02c898d09f6 (diff)
Merge pull request #368 from nextcloud/enh/new-file
Add new file dialog on UI_CreateFile
Diffstat (limited to 'js/documents.js')
-rw-r--r--js/documents.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/js/documents.js b/js/documents.js
index 08d3926e..8ef58d06 100644
--- a/js/documents.js
+++ b/js/documents.js
@@ -703,6 +703,9 @@ var documentsMain = {
$buttons.eq(0).text(t('richdocuments', 'Cancel'));
$buttons.eq(1).text(t('richdocuments', 'Save'));
});
+ } else if (msgId === 'UI_CreateFile') {
+ documentsMain.UI.createNewFile(args.DocumentType);
+
} else if (msgId === 'UI_InsertGraphic') {
parent.OC.dialogs.filepicker(t('richdocuments', 'Insert from {name}', { name: oc_defaults.name }), function(path, type) {
if (type === OC.dialogs.FILEPICKER_TYPE_CHOOSE) {
@@ -762,6 +765,32 @@ var documentsMain = {
$('#loleafletform').submit();
},
+ /* Ask for a new filename and open the files app in a new tab
+ * the parameters richdocuments_create and richdocuments_filename are
+ * parsed by viewer.js and open a template picker in the new tab
+ */
+ createNewFile: function(type) {
+ parent.OC.dialogs.prompt(
+ t('richdocuments', 'Please enter the filename for the new document'),
+ t('richdocuments', 'Save As'),
+ function(result, value) {
+ if (result === true && value) {
+ var dir = parent.$('#dir').val();
+ var url = OC.generateUrl('/apps/files/?dir=' + dir + '&richdocuments_create=' + type + '&richdocuments_filename=' + encodeURI(value));
+ var win = window.open(url, '_blank');
+ }
+ },
+ true,
+ t('richdocuments', 'New filename'),
+ false
+ ).then(function() {
+ var $dialog = parent.$('.oc-dialog:visible');
+ var $buttons = $dialog.find('button');
+ $buttons.eq(0).text(t('richdocuments', 'Cancel'));
+ $buttons.eq(1).text(t('richdocuments', 'Create a new document'));
+ });
+ },
+
hideEditor : function(){
// Fade out editor
$('#mainContainer').fadeOut('fast', function() {
@@ -806,6 +835,7 @@ var documentsMain = {
}
documentsMain.ready = true;
+ parent.OCA.Files.App.fileList.reload();
},
WOPIPostMessage: function(iframe, msgId, values) {