summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/htdocs/luci-static/resources
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-04-28 09:50:28 +0200
committerJo-Philipp Wich <jo@mein.io>2020-04-28 09:50:28 +0200
commitdaa318c1b2cde1be9df370b1794d660902feab6b (patch)
tree875492f95d3103d962e36925e197a9f61ed423bb /modules/luci-base/htdocs/luci-static/resources
parent2fb55e1ab5a28c1000a8de6710b6f586f5b88329 (diff)
luci-base: form.js: ListValue: support widget and orientation properties
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base/htdocs/luci-static/resources')
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/form.js26
1 files changed, 26 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 987640f00..f9a9c5df7 100644
--- a/modules/luci-base/htdocs/luci-static/resources/form.js
+++ b/modules/luci-base/htdocs/luci-static/resources/form.js
@@ -3315,6 +3315,7 @@ var CBIListValue = CBIValue.extend(/** @lends LuCI.form.ListValue.prototype */ {
__init__: function() {
this.super('__init__', arguments);
this.widget = 'select';
+ this.orientation = 'horizontal';
this.deplist = [];
},
@@ -3326,6 +3327,29 @@ var CBIListValue = CBIValue.extend(/** @lends LuCI.form.ListValue.prototype */ {
* @default null
*/
+ /**
+ * Set the type of the underlying form controls.
+ *
+ * May be one of `select` or `radio`. If set to `select`, an HTML
+ * select element is rendered, otherwise a collection of `radio`
+ * elements is used.
+ *
+ * @name LuCI.form.ListValue.prototype#widget
+ * @type string
+ * @default select
+ */
+
+ /**
+ * Set the orientation of the underlying radio or checkbox elements.
+ *
+ * May be one of `horizontal` or `vertical`. Only applies to non-select
+ * widget types.
+ *
+ * @name LuCI.form.ListValue.prototype#orientation
+ * @type string
+ * @default horizontal
+ */
+
/** @private */
renderWidget: function(section_id, option_index, cfgvalue) {
var choices = this.transformChoices();
@@ -3333,7 +3357,9 @@ var CBIListValue = CBIValue.extend(/** @lends LuCI.form.ListValue.prototype */ {
id: this.cbid(section_id),
size: this.size,
sort: this.keylist,
+ widget: this.widget,
optional: this.optional,
+ orientation: this.orientation,
placeholder: this.placeholder,
validate: L.bind(this.validate, this, section_id),
disabled: (this.readonly != null) ? this.readonly : this.map.readonly