refactor(dom) setCurrentFile: nohistory -> history

This commit is contained in:
coderaiser 2014-07-01 04:00:48 -04:00
parent a9400ce06b
commit e7dad86f91
3 changed files with 19 additions and 15 deletions

View file

@ -33,7 +33,7 @@ var Util, DOM, CloudFunc;
*/
this.loadDir = function(params) {
var link, imgPosition, panelChanged, pathParams,
isRefresh, panel, nohistory,
isRefresh, panel, history,
p = params,
currentLink = DOM.getCurrentLink(),
href = currentLink.href;
@ -42,7 +42,7 @@ var Util, DOM, CloudFunc;
pathParams = p.path;
isRefresh = p.isRefresh;
panel = p.panel;
nohistory = p.nohistory;
history = p.history;
}
if (pathParams)
@ -66,7 +66,7 @@ var Util, DOM, CloudFunc;
/* загружаем содержимое каталога */
ajaxLoad(link, {
refresh : isRefresh,
nohistory : nohistory
history : history
}, panel);
}
};
@ -307,7 +307,7 @@ var Util, DOM, CloudFunc;
CloudCmd.loadDir({
path : notSlashlLink,
isRefresh : NEEDREFRESH,
nohistory : true,
history : false,
panel : panel
});
};
@ -317,7 +317,7 @@ var Util, DOM, CloudFunc;
* через ajax-запрос.
* @param path - каталог для чтения
* @param pOptions
* { refresh, nohistory } - необходимость обновить данные о каталоге
* { refresh, history } - необходимость обновить данные о каталоге
*/
function ajaxLoad(path, options, panel) {
if (!options)
@ -329,13 +329,13 @@ var Util, DOM, CloudFunc;
var RESTful = DOM.RESTful,
obj = Util.parseJSON(json),
isRefresh = options.refresh,
nohistory = options.nohistory;
history = options.history;
if (!isRefresh && json)
createFileTable(obj, panel, nohistory);
createFileTable(obj, panel, history);
else
RESTful.read(path, 'json', function(obj) {
createFileTable(obj, panel, nohistory);
createFileTable(obj, panel, history);
Storage.set(path, obj);
});
});
@ -345,9 +345,9 @@ var Util, DOM, CloudFunc;
* Функция строит файловую таблицу
* @param json - данные о файлах
* @param panelParam
* @param nohistory
* @param history
*/
function createFileTable(json, panelParam, nohistory) {
function createFileTable(json, panelParam, history) {
var files,
panel = panelParam || DOM.getPanel(),
/* getting current element if was refresh */
@ -396,7 +396,7 @@ var Util, DOM, CloudFunc;
current = files[0];
DOM.setCurrentFile(current, {
nohistory: nohistory
history: history
});
Listeners.setOnPanel(panel.id);

View file

@ -853,7 +853,11 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
title = CloudFunc.getTitle(path);
this.setTitle(title);
if (o && !o.nohistory) {
/* history could be present
* but it should be false
* to prevent default behavior
*/
if (!o || o.history !== false) {
if (path !== '/')
path = FS + path;
@ -1609,7 +1613,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
current = filesPassive[0];
DOM.setCurrentFile(current, {
nohistory: false
history: true
});
return this;

View file

@ -340,8 +340,8 @@ var Util, DOM, CloudFunc, CloudCmd;
if (path)
CloudCmd.loadDir({
path : path,
nohistory: true
path : path,
history : false
});
else
CloudCmd.route(location.hash);