From b2b96c097faa05c2b45849860b3938191bba9131 Mon Sep 17 00:00:00 2001 From: zeners Date: Tue, 26 Jan 2016 11:55:48 +0100 Subject: [PATCH] webui: small main reorganisation --- libresapi/src/webui-src/app/main.js | 16 +++++++++++----- libresapi/src/webui-src/app/retroshare.js | 3 ++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/libresapi/src/webui-src/app/main.js b/libresapi/src/webui-src/app/main.js index 5483609d0..cb628f8fc 100644 --- a/libresapi/src/webui-src/app/main.js +++ b/libresapi/src/webui-src/app/main.js @@ -17,7 +17,14 @@ function sendPassword(data) { }); } -function Page(content, runst){ +function Page(menu){ + this.menu = menu; + this.module = (menu.module != undefined) ? menu.module : menu.name; + this.path = menu.path != undefined ? menu.path : ("/" + menu.name); + + var runst = menu.runstate; + var content = require(module); + this.view = function(){ var runstate = rs("control/runstate"); var needpasswd = rs("control/password"); @@ -85,10 +92,9 @@ module.exports = { menudef.nodes.map(function(menu){ if (menu.action === undefined) { - var path = menu.path != undefined ? menu.path : ("/" + menu.name); - var module = menu.module != undefined ? menu.module : menu.name - console.log("adding route " + menu.name + " for " + path + " with module " + module); - maps[path] = new Page(require(module), menu.runstate); + var p = new Page(menu) + console.log("adding route " + menu.name + " for " + p.path + " with module " + p.module); + maps[p.path] = p; } }); m.route.mode = "hash"; diff --git a/libresapi/src/webui-src/app/retroshare.js b/libresapi/src/webui-src/app/retroshare.js index 6c1763573..089d1f7ce 100644 --- a/libresapi/src/webui-src/app/retroshare.js +++ b/libresapi/src/webui-src/app/retroshare.js @@ -161,7 +161,8 @@ function checkFocus(){ ctrl.focus(); m.initControl = undefined; } else { - console.log("focus-control '" + m.initControl + "' not found!") + console.log("focus-control '" + m.initControl + "' not found!"); + m.initControl = undefined; } } }