summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2013-11-14 14:35:54 +0200
committerKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2013-11-14 14:58:29 +0200
commit75eff8e0f70758588afc19ab1600f45fc6756e54 (patch)
tree0d2ae450e2c6765fadfba5718db1c187d2fbe270 /web
parentde4d9755157aa5e8e5f654702b2933599fc442b7 (diff)
downloadaconf-75eff8e0f70758588afc19ab1600f45fc6756e54.tar.bz2
aconf-75eff8e0f70758588afc19ab1600f45fc6756e54.tar.xz
web client: revert to parent view also when module does not use tabs
Diffstat (limited to 'web')
-rw-r--r--web/client.js19
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);