From 4c9637ddc49ce4bc8af5a54f94fdc0a72721539e Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 28 Oct 2014 10:20:21 -0400 Subject: [PATCH] fix(client) createFileTable: when name of subdir same as parrentdir it is became current after changing directory --- lib/client.js | 34 ++++++++-------------------------- 1 file changed, 8 insertions(+), 26 deletions(-) diff --git a/lib/client.js b/lib/client.js index 8b00ab46..e656dc42 100644 --- a/lib/client.js +++ b/lib/client.js @@ -67,22 +67,6 @@ var Util, DOM, CloudFunc, join; }, panel, callback); }; - /** - * функция устанавливает курсор на каталог - * с которого мы пришли, если мы поднялись - * в верх по файловой структуре - * @param pDirName - имя каталога с которого мы пришли - */ - function currentToParent(dirName) { - var rootDir; - /* убираем слэш с имени каталога */ - dirName = Util.rmStr(dirName, '/'); - rootDir = DOM.getCurrentByName(dirName); - - if (rootDir) - DOM.setCurrentFile(rootDir); - } - /** * function load modules * @pParams = {name, path, func, dobefore, arg} @@ -401,19 +385,17 @@ var Util, DOM, CloudFunc, join; } }); - current = DOM.getCurrentByName(name); - - if (!current) /* .. */ - current = DOM.getFiles(panel)[0]; - - DOM.setCurrentFile(current, { - history: history - }); - Listeners.setOnPanel(panel.id); if (name === '..' && dir !== '/') - currentToParent(dir); + current = DOM.getCurrentByName(dir); + + if (!current) + current = DOM.getFiles(panel)[0]; + + DOM.setCurrentFile(current, { + history: history + }); Util.exec(callback); }