luci-base: render default values for all server side cbi map widgets
authorJo-Philipp Wich <jo@mein.io>
Fri, 19 Jul 2019 15:19:24 +0000 (17:19 +0200)
committerJo-Philipp Wich <jo@mein.io>
Fri, 19 Jul 2019 15:28:36 +0000 (17:28 +0200)
Fixes: 9c7eb1dec ("luci-base: switch from server side to client side widget markup")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-base/luasrc/view/cbi/dropdown.htm
modules/luci-base/luasrc/view/cbi/dynlist.htm
modules/luci-base/luasrc/view/cbi/lvalue.htm
modules/luci-base/luasrc/view/cbi/tvalue.htm

index 40bd8e953698ab963d3f1565386c9f3c2fd7aa0c..95bd0d4bdc0122f1cfbeb60a9f7dc410b45ca22d 100644 (file)
@@ -1,6 +1,6 @@
 <%+cbi/valueheader%>
 <div<%=attr("data-ui-widget", luci.util.serialize_json({
-       "Dropdown", self:cfgvalue(section), self:choices(), {
+       "Dropdown", self:cfgvalue(section) or self.default, self:choices(), {
                id = cbid,
                name = cbid,
                sort = self.keylist,
index d50328d79f262e71d9e582baa32201243b61945e..2a3da67ff9118990b306a01196ccc83555813490 100644 (file)
@@ -1,6 +1,6 @@
 <%+cbi/valueheader%>
 <div<%=attr("data-ui-widget", luci.util.serialize_json({
-       "DynamicList", self:cfgvalue(section), self:choices(), {
+       "DynamicList", self:cfgvalue(section) or self.default, self:choices(), {
                name = cbid,
                size = self.size,
                sort = self.keylist,
index e07648835668640ea198d4ce4fbacf68642e25d3..920b5e9f92210bacaa95f2305b79cdd719cab143 100644 (file)
@@ -1,6 +1,6 @@
 <%+cbi/valueheader%>
 <div<%=attr("data-ui-widget", luci.util.serialize_json({
-       "Select", self:cfgvalue(section), self:choices(), {
+       "Select", self:cfgvalue(section) or self.default, self:choices(), {
                id = cbid,
                name = cbid,
                size = self.size,
index d1e9e667288f2fcb332f5fa6af08a3526a0810c1..f3b12bd09472f6b853d4e3d7ee97c3f3a61d6698 100644 (file)
@@ -1,5 +1,5 @@
 <%+cbi/valueheader%>
        <textarea class="cbi-input-textarea" <% if not self.size then %> style="width: 100%"<% else %> cols="<%=self.size%>"<% end %> data-update="change"<%= attr("name", cbid) .. attr("id", cbid) .. ifattr(self.rows, "rows") .. ifattr(self.wrap, "wrap")  .. ifattr(self.readonly, "readonly") %>>
-       <%-=pcdata(self:cfgvalue(section))-%>
+       <%-=pcdata(self:cfgvalue(section) or self.default)-%>
        </textarea>
 <%+cbi/valuefooter%>