mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-24 16:42:01 +00:00
refactor(dom) promptNew
This commit is contained in:
parent
77debf311d
commit
edc14b5f29
1 changed files with 14 additions and 10 deletions
|
|
@ -449,20 +449,24 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
|
||||
function promptNew(typeName, type) {
|
||||
var RESTful = DOM.RESTful,
|
||||
lName = Cmd.getCurrentName(),
|
||||
lDir = Cmd.getCurrentDirPath(),
|
||||
lMsg = 'New ' + typeName || 'File',
|
||||
lType = Util.type.string(type) ? type : '';
|
||||
path = '',
|
||||
name = Cmd.getCurrentName(),
|
||||
dir = Cmd.getCurrentDirPath(),
|
||||
msg = 'New ' + typeName || 'File';
|
||||
|
||||
if (lName === '..')
|
||||
lName = '';
|
||||
if (name === '..')
|
||||
name = '';
|
||||
|
||||
lName = Dialog.prompt(lMsg, lName);
|
||||
name = Dialog.prompt(msg, name);
|
||||
path = dir + name;
|
||||
|
||||
if (lName)
|
||||
RESTful.write(lDir + lName + lType, null, function() {
|
||||
if (type)
|
||||
path += type;
|
||||
|
||||
if (name)
|
||||
RESTful.write(path, null, function() {
|
||||
CloudCmd.refresh(null, null, function() {
|
||||
var current = DOM.getCurrentFileByName(lName);
|
||||
var current = DOM.getCurrentFileByName(name);
|
||||
|
||||
DOM.setCurrentFile(current);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue