diff options
author | Jo-Philipp Wich <jo@mein.io> | 2019-04-01 15:38:00 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2019-07-07 15:25:49 +0200 |
commit | 2beb9fa16fffc0cceea1d90c191309dfbcc307cc (patch) | |
tree | f2183466da7304a2793d6038417b5c4989c5737b /modules/luci-base/luasrc | |
parent | 5b7924c8087b93037ae20e03f35bd0c7e9e06a05 (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/luasrc')
-rw-r--r-- | modules/luci-base/luasrc/dispatcher.lua | 9 | ||||
-rw-r--r-- | modules/luci-base/luasrc/view/view.htm | 8 |
2 files changed, 17 insertions, 0 deletions
diff --git a/modules/luci-base/luasrc/dispatcher.lua b/modules/luci-base/luasrc/dispatcher.lua index 626a46dfd2..e8106b741d 100644 --- a/modules/luci-base/luasrc/dispatcher.lua +++ b/modules/luci-base/luasrc/dispatcher.lua @@ -857,6 +857,15 @@ function template(name) end +local _view = function(self, ...) + require "luci.template".render("view", { view = self.view }) +end + +function view(name) + return {type = "view", view = name, target = _view} +end + + local function _cbi(self, ...) local cbi = require "luci.cbi" local tpl = require "luci.template" diff --git a/modules/luci-base/luasrc/view/view.htm b/modules/luci-base/luasrc/view/view.htm new file mode 100644 index 0000000000..bddd8e4464 --- /dev/null +++ b/modules/luci-base/luasrc/view/view.htm @@ -0,0 +1,8 @@ +<%+header%> + +<div id="view"> + <div class="spinning"><%:Loading view…%></div> + <script type="text/javascript">L.require('view.<%=view%>');</script> +</div> + +<%+footer%> |