diff options
author | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2013-11-14 14:35:54 +0200 |
---|---|---|
committer | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2013-11-14 14:58:29 +0200 |
commit | 75eff8e0f70758588afc19ab1600f45fc6756e54 (patch) | |
tree | 0d2ae450e2c6765fadfba5718db1c187d2fbe270 | |
parent | de4d9755157aa5e8e5f654702b2933599fc442b7 (diff) | |
download | aconf-75eff8e0f70758588afc19ab1600f45fc6756e54.tar.bz2 aconf-75eff8e0f70758588afc19ab1600f45fc6756e54.tar.xz |
web client: revert to parent view also when module does not use tabs
-rw-r--r-- | web/client.js | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/web/client.js b/web/client.js index c3b68a3..1c5ffae 100644 --- a/web/client.js +++ b/web/client.js @@ -1069,8 +1069,10 @@ $(function() { var layouts = {stacked: Stacked, tabular: Tabular}; + function redirect(path) { $.bbq.pushState("#" + path); } + function renderObject(path, data) { - var path = path || $.param.fragment(); + path = path || $.param.fragment(); return ( data ? $.Deferred().resolve(data) : txnMgr.query(path) @@ -1099,12 +1101,15 @@ $(function() { true, false ); + }).fail(function() { + var comps = split(path); + comps.pop(); + comps.unshift("/"); + redirect(join.apply(undefined, comps)); }); }; - function redirect(path) { $.bbq.pushState("#" + path); } - function render() { var path = $.param.fragment(); @@ -1157,13 +1162,7 @@ $(function() { renderMenu(tabs, "/" + comps[0], comps[1], true) .done(function(first) { - renderObject( - topLevel ? join(path, first) : path - ).fail(function() { - comps.pop(); - comps.unshift("/"); - redirect(join.apply(undefined, comps)); - }); + renderObject(topLevel ? join(path, first) : path); }) .fail(function(data) { renderObject(path, topLevel ? data : null); |