summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2019-11-16 18:23:43 +0100
committerJo-Philipp Wich <jo@mein.io>2019-11-16 18:25:52 +0100
commit13e9e3e9e8633c7a54fe5fec1481e9df62594982 (patch)
tree3e57a63b3645c289c1b495d7587cf7f020a2090d
parenteaa193336fc7b1f4bf2b8a51c120308d90e86e95 (diff)
treewide: fix "Unhandled token" errors with Lua CBI maps
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>
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/form.js10
-rw-r--r--modules/luci-compat/luasrc/view/cbi/cell_valueheader.htm2
-rw-r--r--modules/luci-compat/luasrc/view/cbi/tblsection.htm4
-rw-r--r--themes/luci-theme-bootstrap/htdocs/luci-static/bootstrap/mobile.css18
-rw-r--r--themes/luci-theme-openwrt/htdocs/luci-static/openwrt.org/cascade.css18
5 files changed, 26 insertions, 26 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js
index 7de5e0f76b..1c6f843041 100644
--- a/modules/luci-base/htdocs/luci-static/resources/form.js
+++ b/modules/luci-base/htdocs/luci-static/resources/form.js
@@ -1103,7 +1103,7 @@ var CBITableSection = CBITypedSection.extend({
trEl.appendChild(E('div', {
'class': 'th cbi-section-table-cell',
- 'data-type': opt.__name__
+ 'data-widget': opt.__name__
}));
if (opt.width != null)
@@ -1139,7 +1139,7 @@ var CBITableSection = CBITypedSection.extend({
trEl.appendChild(E('div', {
'class': 'th cbi-section-table-cell',
- 'data-type': opt.__name__
+ 'data-widget': opt.__name__
}, opt.description));
if (opt.width != null)
@@ -1444,7 +1444,7 @@ var CBIGridSection = CBITableSection.extend({
'data-title': (title != '') ? title : null,
'data-description': (descr != '') ? descr : null,
'data-name': opt.option,
- 'data-type': opt.typename || opt.__name__
+ 'data-widget': opt.typename || opt.__name__
}, (value != null) ? value : E('em', _('none')));
},
@@ -1586,7 +1586,7 @@ var CBIValue = CBIAbstractValue.extend({
'data-title': (title != '') ? title : null,
'data-description': this.stripTags(this.description).trim(),
'data-name': this.option,
- 'data-type': this.typename || (this.template ? this.template.replace(/^.+\//, '') : null) || this.__name__
+ 'data-widget': this.typename || (this.template ? this.template.replace(/^.+\//, '') : null) || this.__name__
}, E('div', {
'id': 'cbi-%s-%s-%s'.format(config_name, section_id, this.option),
'data-index': option_index,
@@ -1602,7 +1602,7 @@ var CBIValue = CBIAbstractValue.extend({
'data-depends': depend_list,
'data-field': this.cbid(section_id),
'data-name': this.option,
- 'data-type': this.typename || (this.template ? this.template.replace(/^.+\//, '') : null) || this.__name__
+ 'data-widget': this.typename || (this.template ? this.template.replace(/^.+\//, '') : null) || this.__name__
});
if (this.last_child)
diff --git a/modules/luci-compat/luasrc/view/cbi/cell_valueheader.htm b/modules/luci-compat/luasrc/view/cbi/cell_valueheader.htm
index 4b70957543..db5c66850d 100644
--- a/modules/luci-compat/luasrc/view/cbi/cell_valueheader.htm
+++ b/modules/luci-compat/luasrc/view/cbi/cell_valueheader.htm
@@ -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)
%>>
diff --git a/modules/luci-compat/luasrc/view/cbi/tblsection.htm b/modules/luci-compat/luasrc/view/cbi/tblsection.htm
index 11c2206d8c..1e067edf38 100644
--- a/modules/luci-compat/luasrc/view/cbi/tblsection.htm
+++ b/modules/luci-compat/luasrc/view/cbi/tblsection.htm
@@ -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)
diff --git a/themes/luci-theme-bootstrap/htdocs/luci-static/bootstrap/mobile.css b/themes/luci-theme-bootstrap/htdocs/luci-static/bootstrap/mobile.css
index 2d4f856602..466573b26f 100644
--- a/themes/luci-theme-bootstrap/htdocs/luci-static/bootstrap/mobile.css
+++ b/themes/luci-theme-bootstrap/htdocs/luci-static/bootstrap/mobile.css
@@ -71,8 +71,8 @@ header h3 a, header .brand {
word-wrap: normal;
}
- .td[data-type="button"],
- .td[data-type="fvalue"] {
+ .td[data-widget="button"],
+ .td[data-widget="fvalue"] {
flex: 1 1 17%;
text-align: left;
}
@@ -145,12 +145,12 @@ header h3 a, header .brand {
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;
}
@@ -311,7 +311,7 @@ header h3 a, header .brand {
flex-basis: 50% !important;
}
- [data-page="admin-status-processes"] .td[data-type="button"] {
+ [data-page="admin-status-processes"] .td[data-widget="button"] {
flex-basis: 33% !important;
}
@@ -320,9 +320,9 @@ header h3 a, header .brand {
flex-basis: 25% !important;
}
- [data-page="admin-system-fstab"] .td[data-type="button"]::before,
- [data-page="admin-system-startup"] .td[data-type="button"]::before,
- [data-page="admin-status-processes"] .td[data-type="button"]::before {
+ [data-page="admin-system-fstab"] .td[data-widget="button"]::before,
+ [data-page="admin-system-startup"] .td[data-widget="button"]::before,
+ [data-page="admin-status-processes"] .td[data-widget="button"]::before {
display: none;
}
}
diff --git a/themes/luci-theme-openwrt/htdocs/luci-static/openwrt.org/cascade.css b/themes/luci-theme-openwrt/htdocs/luci-static/openwrt.org/cascade.css
index fe46400717..faaaf220a1 100644
--- a/themes/luci-theme-openwrt/htdocs/luci-static/openwrt.org/cascade.css
+++ b/themes/luci-theme-openwrt/htdocs/luci-static/openwrt.org/cascade.css
@@ -933,8 +933,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;
}
@@ -1828,8 +1828,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;
}
@@ -1972,12 +1972,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;
}
@@ -2038,8 +2038,8 @@ select + .cbi-button {
margin-top: .5em;
}
- #cbi-firewall-rule .td[data-type="fvalue"],
- #cbi-firewall-redirect .td[data-type="fvalue"] {
+ #cbi-firewall-rule .td[data-widget="fvalue"],
+ #cbi-firewall-redirect .td[data-widget="fvalue"] {
display: none;
}
}