refactor(client) route

This commit is contained in:
coderaiser 2014-05-22 05:14:53 -04:00
parent ef10353b7d
commit 1d523622bb

View file

@ -171,23 +171,21 @@ var Util, DOM, CloudFunc;
};
this.route = function(path) {
var query, module, file, current, msg;
var module, file, current, msg,
query = path.split('/'),
length = query.length;
if (path.length > 0) {
query = path.split('/');
if (length) {
module = Util.getStrBigFirst(query[1]);
file = query[2];
current = DOM.getCurrentFileByName(file);
if (query.length > 0) {
module = Util.getStrBigFirst(query[1]);
file = query[2];
current = DOM.getCurrentFileByName(file);
if (file && !current) {
msg = CloudFunc.formatMsg('set current file', file, 'error');
Util.log(msg);
} else {
DOM.setCurrentFile(current);
CloudCmd.execFromModule(module, 'show');
}
if (file && !current) {
msg = CloudFunc.formatMsg('set current file', file, 'error');
Util.log(msg);
} else {
DOM.setCurrentFile(current);
CloudCmd.execFromModule(module, 'show');
}
}
};