feature(client) createFileTable: history -> options (history, noCurrent)

This commit is contained in:
coderaiser 2015-04-08 02:59:48 -04:00
parent 72598b88f6
commit cb4d00828c

View file

@ -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);
}