From 8e5862085e7b3c074bfa26af03b0a1b697729511 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Fri, 31 Oct 2014 05:42:08 -0400 Subject: [PATCH] fix(dom) renameCurrent: if name ".." show dialog -> alert --- lib/client/dom.js | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/lib/client/dom.js b/lib/client/dom.js index e8339cf9..177cb506 100644 --- a/lib/client/dom.js +++ b/lib/client/dom.js @@ -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); + }); + } } };