summaryrefslogtreecommitdiff
path: root/luci2
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2014-01-31 21:54:14 +0000
committerJo-Philipp Wich <jow@openwrt.org>2014-01-31 21:54:14 +0000
commit9b01564c3c6b3ffad67dd1040af41d8f940b7464 (patch)
treea3fe3da61edca5db4b4ddd3573cafc82211003af /luci2
parentfacf7e6d82dcaff660ceb2cbcd31eebbeb116a47 (diff)
downloadluci2-ui-9b01564c3c6b3ffad67dd1040af41d8f940b7464.tar.gz
luci2: update ACL cache and initialize NetworkModel in LuCI2.ui.init(), bind view changes to 'hashchange' event to support browser back and forward buttons
Diffstat (limited to 'luci2')
-rw-r--r--luci2/htdocs/luci2/luci2.js34
1 files changed, 27 insertions, 7 deletions
diff --git a/luci2/htdocs/luci2/luci2.js b/luci2/htdocs/luci2/luci2.js
index 2d002cb..beed5ca 100644
--- a/luci2/htdocs/luci2/luci2.js
+++ b/luci2/htdocs/luci2/luci2.js
@@ -3763,6 +3763,23 @@ function LuCI2()
});
},
+ changeView: function()
+ {
+ var name = _luci2.getHash('view');
+ var node = _luci2.globals.defaultNode;
+
+ if (name && _luci2.globals.mainMenu)
+ node = _luci2.globals.mainMenu.getNode(name);
+
+ if (node)
+ {
+ _luci2.ui.loading(true);
+ _luci2.ui.renderView(node).then(function() {
+ _luci2.ui.loading(false);
+ });
+ }
+ },
+
updateHostname: function()
{
return _luci2.system.getBoardInfo().then(function(info) {
@@ -3854,13 +3871,19 @@ function LuCI2()
_luci2.ui.loading(true);
$.when(
+ _luci2.session.updateACLs(),
_luci2.ui.updateHostname(),
_luci2.ui.updateChanges(),
- _luci2.ui.renderMainMenu()
+ _luci2.ui.renderMainMenu(),
+ _luci2.NetworkModel.init()
).then(function() {
_luci2.ui.renderView(_luci2.globals.defaultNode).then(function() {
_luci2.ui.loading(false);
- })
+ });
+
+ $(window).on('hashchange', function() {
+ _luci2.ui.changeView();
+ });
});
},
@@ -4074,10 +4097,7 @@ function LuCI2()
_onclick: function(ev)
{
- _luci2.ui.loading(true);
- _luci2.ui.renderView(ev.data).then(function() {
- _luci2.ui.loading(false);
- });
+ _luci2.setHash('view', ev.data);
ev.preventDefault();
this.blur();
@@ -4130,7 +4150,7 @@ function LuCI2()
}
else
{
- item.find('a').click(nodes[i], this._onclick);
+ item.find('a').click(nodes[i].view, this._onclick);
}
}