Commit 6248b9a2 authored by Benjamin Fischer's avatar Benjamin Fischer
Browse files

FileHandler2: added create file/folder

parent 116d6474
......@@ -398,6 +398,34 @@ define([
throw Error("NOT IMPLEMENTED");
},
}, "extract");
var CreateHandler = M.clsBib.base._extend({
init: function init(type) {
var cType = Utils.capitalize(type);
init._super.call(this, "create" + cType);
this._type = type;
this.menuTmpl = {
label: "Create " + cType,
iconClass: "fa-" + type + "-o",
position: pos++,
};
},
run: function run(info) {
if (info.name) {
info.view.POST("/ajax/fs/create" + this._type, {
path: info.pathBase,
name: info.name,
});
} else {
info.view.prompt("Enter the new " + this._type + " name:", function (name) {
if (!name) return;
run.call(this, $.extend({}, info, {name: name}));
}.bind(this));
}
}
});
new CreateHandler("file");
new CreateHandler("folder");
pos = 101;
// TODO: info
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment