treewide: fix "Unhandled token" errors with Lua CBI maps
authorJo-Philipp Wich <jo@mein.io>
Sat, 16 Nov 2019 17:23:43 +0000 (18:23 +0100)
committerJo-Philipp Wich <jo@mein.io>
Sat, 16 Nov 2019 17:28:39 +0000 (18:28 +0100)
The `data-type` attribute is used to bind datatype validators to a widget
while some templates used the same attribute to denote the name of the
underlying widget.

Change the `data-type` attributes referring to the widget name to
`data-widget` in order to stop the JS token error spam.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(backported from commit 13e9e3e9e8633c7a54fe5fec1481e9df62594982)

modules/luci-base/luasrc/view/cbi/cell_valueheader.htm
modules/luci-base/luasrc/view/cbi/tblsection.htm
themes/luci-theme-openwrt/htdocs/luci-static/openwrt.org/cascade.css

index 4b70957543b4f5b4caf68027543bd44f0cde164a..db5c66850dff5c2564d672b5f829477ab463f507 100644 (file)
@@ -5,7 +5,7 @@
 -%>
 <div class="td cbi-value-field<% if self.error and self.error[section] then %> cbi-value-error<% end %><% if self.password then %> nowrap<% end %>"<%=
        attr("data-name", self.option) ..
-       ifattr(ftype and #ftype > 0, "data-type", ftype) ..
+       ifattr(ftype and #ftype > 0, "data-widget", ftype) ..
        ifattr(title and #title > 0, "data-title", title, true) ..
        ifattr(descr and #descr > 0, "data-description", descr, true)
 %>>
index 11c2206d8ca1b794f868c7d87f3b18ed82d70018..1e067edf38e785b11513575ba6da2a7aef717a47 100644 (file)
@@ -52,7 +52,7 @@ function render_titles()
        for i, k in ipairs(self.children) do
                if not k.optional then
                        %><div class="th cbi-section-table-cell"<%=
-                               width(k) .. attr('data-type', k.typename) %>><%
+                               width(k) .. attr('data-widget', k.typename) %>><%
 
                        if k.titleref then
                                %><a title="<%=self.titledesc or translate('Go to relevant configuration page')%>" class="cbi-title-ref" href="<%=k.titleref%>"><%
@@ -88,7 +88,7 @@ function render_descriptions()
        for i, k in ipairs(self.children) do
                if not k.optional then
                        %><div class="th cbi-section-table-cell"<%=
-                               width(k) .. attr("data-type", k.typename) %>><%
+                               width(k) .. attr("data-widget", k.typename) %>><%
 
                        write(k.description)
 
index 5becfc5ba59ad1d44bc6af3c969d08060f9d9b7a..46d7b9d011f74b2b5765a4e3ca2c5fcad2e7c960 100644 (file)
@@ -861,8 +861,8 @@ div.cbi-optionals {
        margin-left: 3px;
 }
 
-.th[data-type="button"], .td[data-type="button"],
-.th[data-type="fvalue"], .td[data-type="fvalue"] {
+.th[data-widget="button"], .td[data-widget="button"],
+.th[data-widget="fvalue"], .td[data-widget="fvalue"] {
        flex: 1 1 2em;
        text-align: center;
 }
@@ -1599,8 +1599,8 @@ select + .cbi-button {
                word-wrap: normal;
        }
 
-       .td[data-type="button"],
-       .td[data-type="fvalue"] {
+       .td[data-widget="button"],
+       .td[data-widget="fvalue"] {
                flex: 1 1 12.5%;
                text-align: left;
        }
@@ -1717,12 +1717,12 @@ select + .cbi-button {
                flex-basis: 100%;
        }
 
-       .td.cbi-value-field[data-type="dvalue"] {
+       .td.cbi-value-field[data-widget="dvalue"] {
                flex-basis: 50%;
        }
 
-       .td.cbi-value-field[data-type="button"],
-       .td.cbi-value-field[data-type="fvalue"] {
+       .td.cbi-value-field[data-widget="button"],
+       .td.cbi-value-field[data-widget="fvalue"] {
                flex-basis: 25%;
                text-align: left;
        }