mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-24 03:05:41 +00:00
refactor(client) route
This commit is contained in:
parent
ef10353b7d
commit
1d523622bb
1 changed files with 13 additions and 15 deletions
|
|
@ -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');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue