From cb4d00828c0f2df7098dbfcb9a9211d14e5eb322 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 8 Apr 2015 02:59:48 -0400 Subject: [PATCH] feature(client) createFileTable: history -> options (history, noCurrent) --- lib/client.js | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/lib/client.js b/lib/client.js index aa5aed04..5442b019 100644 --- a/lib/client.js +++ b/lib/client.js @@ -351,14 +351,13 @@ var Util, DOM, CloudFunc, join; name = Info.name, obj = Util.json.parse(json), isRefresh = options.refresh, - noCurrent = options.noCurrent, - history = options.history; + noCurrent = options.noCurrent; if (!isRefresh && json) - createFileTable(obj, panel, history, callback); + createFileTable(obj, panel, options, callback); else RESTful.read(path, 'json', function(obj) { - createFileTable(obj, panel, history, function() { + createFileTable(obj, panel, options, function() { var current; if (isRefresh && !noCurrent) { @@ -399,8 +398,10 @@ var Util, DOM, CloudFunc, join; * @param history * @param callback */ - function createFileTable(json, panelParam, history, callback) { - var names = ['file', 'path', 'link', 'pathLink']; + function createFileTable(json, panelParam, options, callback) { + var history = options.history, + noCurrent = options.noCurrent, + names = ['file', 'path', 'link', 'pathLink']; Files.get(names, function(error, templFile, templPath, templLink, templPathLink) { var Dialog = DOM.Dialog, @@ -429,15 +430,17 @@ var Util, DOM, CloudFunc, join; Listeners.setOnPanel(panel.id); - if (name === '..' && dir !== '/') - current = DOM.getCurrentByName(dir); - - if (!current) - current = DOM.getFiles(panel)[0]; + if (!noCurrent) { + if (name === '..' && dir !== '/') + current = DOM.getCurrentByName(dir); - DOM.setCurrentFile(current, { - history: history - }); + if (!current) + current = DOM.getFiles(panel)[0]; + + DOM.setCurrentFile(current, { + history: history + }); + } Util.exec(callback); }