summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/htdocs/luci-static
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2019-04-01 15:38:00 +0200
committerJo-Philipp Wich <jo@mein.io>2019-07-07 15:25:49 +0200
commit2beb9fa16fffc0cceea1d90c191309dfbcc307cc (patch)
treef2183466da7304a2793d6038417b5c4989c5737b /modules/luci-base/htdocs/luci-static
parent5b7924c8087b93037ae20e03f35bd0c7e9e06a05 (diff)
luci-base: add client based view actions
Introduce a new view() target for CBI dispatch nodes, as long with the required template and plumbing work in luci.js to allow requiring view classes. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base/htdocs/luci-static')
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/luci.js24
1 files changed, 12 insertions, 12 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/luci.js b/modules/luci-base/htdocs/luci-static/resources/luci.js
index c71865f96f..896ded3af0 100644
--- a/modules/luci-base/htdocs/luci-static/resources/luci.js
+++ b/modules/luci-base/htdocs/luci-static/resources/luci.js
@@ -582,19 +582,19 @@
for (var i = 0; ptr && i < parts.length - 1; i++)
ptr = ptr[parts[i]];
- if (!ptr)
- L.error('DependencyError',
- 'Parent "%s" for class "%s" is missing',
- parts.slice(0, i).join('.'), name);
+ if (ptr)
+ ptr[parts[i]] = instance;
- classes[name] = ptr[parts[i]] = instance;
+ classes[name] = instance;
return instance;
});
};
/* Request class file */
- classes[name] = Request.get(url, { cache: true }).then(compileClass);
+ classes[name] = Request.get(url, { cache: true })
+ .then(compileClass)
+ .catch(L.error);
return classes[name];
},
@@ -942,18 +942,18 @@
__name__: 'LuCI.View',
__init__: function() {
- var mc = document.getElementById('maincontent');
+ var vp = document.getElementById('view');
- L.dom.content(mc, E('div', { 'class': 'spinning' }, _('Loading view…')));
+ L.dom.content(vp, E('div', { 'class': 'spinning' }, _('Loading view…')));
return Promise.resolve(this.load())
.then(L.bind(this.render, this))
.then(L.bind(function(nodes) {
- var mc = document.getElementById('maincontent');
+ var vp = document.getElementById('view');
- L.dom.content(mc, nodes);
- L.dom.append(mc, this.addFooter());
- }, this));
+ L.dom.content(vp, nodes);
+ L.dom.append(vp, this.addFooter());
+ }, this)).catch(L.error);
},
load: function() {},