summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/luasrc/view/cbi
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2018-12-29 14:19:59 +0100
committerJo-Philipp Wich <jo@mein.io>2018-12-29 14:19:59 +0100
commited914df3f518faa29795308adb12084754965d39 (patch)
treee764ef7f3fd81dffa13bf35078bc09aa352f2dbe /modules/luci-base/luasrc/view/cbi
parent8cecff2197ab148bdf6dcec1594b7c54b0f95fb5 (diff)
luci-base: rework filebrowser initialization
Do not call cbi_init() from the browser field template but lazily initialize the field, like it is being done for all other widgets as well. Fixes: #2398 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base/luasrc/view/cbi')
-rw-r--r--modules/luci-base/luasrc/view/cbi/browser.htm14
1 files changed, 8 insertions, 6 deletions
diff --git a/modules/luci-base/luasrc/view/cbi/browser.htm b/modules/luci-base/luasrc/view/cbi/browser.htm
index 362c40bec1..eb47ffafe6 100644
--- a/modules/luci-base/luasrc/view/cbi/browser.htm
+++ b/modules/luci-base/luasrc/view/cbi/browser.htm
@@ -1,8 +1,10 @@
-<% local v = self:cfgvalue(section) or self.default -%>
<%+cbi/valueheader%>
- <input class="cbi-input-text" type="text"<%= attr("value", v) .. attr("name", cbid) .. attr("id", cbid) %> />
- <script type="text/javascript">
-cbi_init()
-cbi_browser_init('<%=cbid%>', '<%=resource%>', '<%=url('admin/filebrowser')%>'<%=self.default_path and ", '"..self.default_path.."'"%>);
- </script>
+
+<input class="cbi-input-text" type="text"<%=
+ attr("id", cbid) ..
+ attr("name", cbid) ..
+ attr("value", self:cfgvalue(section) or self.default) ..
+ attr("data-browser", self.default_path or "")
+%> />
+
<%+cbi/valuefooter%>