fix(dom) renameCurrent: if name ".." show dialog -> alert

This commit is contained in:
coderaiser 2014-10-31 05:42:08 -04:00
parent ba06cf0ff1
commit 8e5862085e

View file

@ -1511,25 +1511,30 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
if (!Cmd.isCurrentFile(current))
current = Cmd.getCurrentFile();
from = Cmd.getCurrentName(current),
to = Dialog.prompt('Rename', from) || from,
dirPath = Cmd.getCurrentDirPath();
cmp = Util.strCmp(from, to);
from = Cmd.getCurrentName(current);
if (!cmp) {
files = {
from : dirPath + from,
to : dirPath + to
};
if (from === '..') {
Dialog.alert('No files selected!');
} else {
to = Dialog.prompt('Rename', from) || from;
dirPath = Cmd.getCurrentDirPath();
cmp = Util.strCmp(from, to);
RESTful.mv(files, function() {
var Storage = DOM.Storage,
path = CloudFunc.rmLastSlash(dirPath);
if (!cmp) {
files = {
from : dirPath + from,
to : dirPath + to
};
DOM.setCurrentName(to, current);
Cmd.updateCurrentInfo();
Storage.remove(path);
});
RESTful.mv(files, function() {
var Storage = DOM.Storage,
path = CloudFunc.rmLastSlash(dirPath);
DOM.setCurrentName(to, current);
Cmd.updateCurrentInfo();
Storage.remove(path);
});
}
}
};