summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/htdocs/luci-static
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2022-05-17 15:07:48 +0200
committerJo-Philipp Wich <jo@mein.io>2022-05-17 15:07:48 +0200
commit9c136c9beaa7639aecc351c5725de33cfe4d2e5c (patch)
treee2691cf97f950e40d66e42efb5c5c4318eaa77f1 /modules/luci-base/htdocs/luci-static
parentb6ae1d4f4aec94b38e59b11e5fd9c28799dae05b (diff)
luci-base: form.js: minor tweaks for mobile styling
- Annotate gridsection textvalue cells as CBI.DummyValue widgets - Replace `<br>` elements with newlines in `stripTags()` Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base/htdocs/luci-static')
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/form.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js
index 0802d8b24d..90a1517571 100644
--- a/modules/luci-base/htdocs/luci-static/resources/form.js
+++ b/modules/luci-base/htdocs/luci-static/resources/form.js
@@ -287,9 +287,13 @@ var CBIAbstractElement = baseclass.extend(/** @lends LuCI.form.AbstractElement.p
if (typeof(s) == 'string' && !s.match(/[<>]/))
return s;
- var x = dom.parse('<div>' + s + '</div>');
+ var x = dom.elem(s) ? s : dom.parse('<div>' + s + '</div>');
- return x.textContent || x.innerText || '';
+ x.querySelectorAll('br').forEach(function(br) {
+ x.replaceChild(document.createTextNode('\n'), br);
+ });
+
+ return (x.textContent || x.innerText || '').replace(/([ \t]*\n)+/g, '\n');
},
/**
@@ -3412,7 +3416,7 @@ var CBIGridSection = CBITableSection.extend(/** @lends LuCI.form.GridSection.pro
'data-title': (title != '') ? title : null,
'data-description': (descr != '') ? descr : null,
'data-name': opt.option,
- 'data-widget': opt.typename || opt.__name__
+ 'data-widget': 'CBI.DummyValue'
}, (value != null) ? value : E('em', _('none')));
},