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

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2021-01-27 17:56:31 +0300
committerJulius Härtl <jus@bitgrid.net>2021-01-28 14:00:21 +0300
commit2d46971199eecb49b96d5031bdbad25e448d0b27 (patch)
tree95f457aba3ca0d8a6c40982434ad24e177682973 /apps
parent01113815297b6f59b7eea96dcb55db2ec374e599 (diff)
Hide new template directory entry after creating and allow setting existing directories
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps')
-rw-r--r--apps/files/js/newfilemenu.js21
-rw-r--r--apps/files/src/templates.js1
2 files changed, 21 insertions, 1 deletions
diff --git a/apps/files/js/newfilemenu.js b/apps/files/js/newfilemenu.js
index 305af051271..742a5e95fe2 100644
--- a/apps/files/js/newfilemenu.js
+++ b/apps/files/js/newfilemenu.js
@@ -119,6 +119,11 @@
var lastPos;
var checkInput = function () {
+ // Special handling for the setup template directory
+ if ($target.attr('data-action') === 'template-init') {
+ return true;
+ }
+
var filename = $input.val();
try {
if (!Files.isFileNameValid(filename)) {
@@ -198,7 +203,21 @@
iconClass: actionSpec.iconClass,
fileType: actionSpec.fileType,
actionHandler: actionSpec.actionHandler,
- });
+ checkFilename: actionSpec.checkFilename
+ });
+ },
+
+ /**
+ * Remove a menu item from the "New" file menu
+ * @param {string} actionId
+ */
+ removeMenuEntry: function(actionId) {
+ var index = this._menuItems.findIndex(function (actionSpec) {
+ return actionSpec.id === actionId;
+ });
+ if (index > -1) {
+ this._menuItems.splice(index, 1);
+ }
},
/**
diff --git a/apps/files/src/templates.js b/apps/files/src/templates.js
index c493e254caf..be41e864854 100644
--- a/apps/files/src/templates.js
+++ b/apps/files/src/templates.js
@@ -82,6 +82,7 @@ window.addEventListener('DOMContentLoaded', function() {
fileType: 'file',
actionHandler(name) {
initTemplatesFolder(name)
+ menu.removeMenuEntry('template-init')
},
})
},