summaryrefslogtreecommitdiffhomepage
path: root/modules
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2019-08-19 15:06:31 +0200
committerJo-Philipp Wich <jo@mein.io>2019-08-19 15:06:31 +0200
commit2aab85814d0eead5f82ee1c5661f03667ce50b62 (patch)
tree5f5484e922a250b7d836dcea7cfbc9460a24b11e /modules
parentafd361e368808472cee2e8f3a780252d8bd39f36 (diff)
luci-base: form.js: implement Textfield widget
Port the CBI Textfield (textarea) widget type to client side form.js Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules')
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/form.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js
index 44a2df22f1..cc72d6e487 100644
--- a/modules/luci-base/htdocs/luci-static/resources/form.js
+++ b/modules/luci-base/htdocs/luci-static/resources/form.js
@@ -1600,6 +1600,29 @@ var CBIMultiValue = CBIDynamicList.extend({
},
});
+var CBITextValue = CBIValue.extend({
+ __name__: 'CBI.TextValue',
+
+ value: null,
+
+ renderWidget: function(section_id, option_index, cfgvalue) {
+ var value = (cfgvalue != null) ? cfgvalue : this.default;
+
+ var widget = new ui.Textarea(value, {
+ id: this.cbid(section_id),
+ optional: this.optional || this.rmempty,
+ placeholder: this.placeholder,
+ monospace: this.monospace,
+ cols: this.cols,
+ rows: this.rows,
+ wrap: this.wrap,
+ validate: L.bind(this.validate, this, section_id)
+ });
+
+ return widget.render();
+ }
+});
+
var CBIDummyValue = CBIValue.extend({
__name__: 'CBI.DummyValue',
@@ -1713,6 +1736,7 @@ return L.Class.extend({
ListValue: CBIListValue,
Flag: CBIFlagValue,
MultiValue: CBIMultiValue,
+ TextValue: CBITextValue,
DummyValue: CBIDummyValue,
Button: CBIButtonValue,
HiddenValue: CBIHiddenValue,