summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/luasrc/view
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2018-12-13 11:31:50 +0100
committerJo-Philipp Wich <jo@mein.io>2018-12-13 11:35:38 +0100
commitb33192a0335722aa8bd390fb994d7045ba52fe9e (patch)
tree8f6f471976e854b04327c6da9f2dd3b39f4479cd /modules/luci-base/luasrc/view
parent979a4780018778008bdf11c343671376021ecbf9 (diff)
luci-base: support cidr list notation for option ipaddr and ip6addr
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base/luasrc/view')
-rw-r--r--modules/luci-base/luasrc/view/cbi/ipaddr.htm27
1 files changed, 27 insertions, 0 deletions
diff --git a/modules/luci-base/luasrc/view/cbi/ipaddr.htm b/modules/luci-base/luasrc/view/cbi/ipaddr.htm
new file mode 100644
index 0000000000..1c924e1544
--- /dev/null
+++ b/modules/luci-base/luasrc/view/cbi/ipaddr.htm
@@ -0,0 +1,27 @@
+<%+cbi/valueheader%>
+ <script type="text/javascript">
+ function switchToCIDRList(ev) {
+ var input = ev.target.previousElementSibling,
+ usecidr = document.getElementById(input.id + '_usecidr');
+
+ ev.preventDefault();
+
+ usecidr.value = '1';
+ cbi_d_update();
+ }
+ </script>
+ <input data-update="change"<%=
+ attr("id", cbid) ..
+ attr("name", cbid) ..
+ attr("type", "text") ..
+ attr("class", "cbi-input-text") ..
+ attr("value", self:cfgvalue(section) or self.default) ..
+ ifattr(self.size, "size") ..
+ ifattr(self.placeholder, "placeholder") ..
+ ifattr(self.datatype, "data-type", self.datatype) ..
+ ifattr(self.datatype, "data-optional", self.optional or self.rmempty) ..
+ ifattr(self.combobox_manual, "data-manual", self.combobox_manual) ..
+ ifattr(#self.keylist > 0, "data-choices", { self.keylist, self.vallist })
+ %> /><!--
+ --><button class="cbi-button cbi-button-neutral" title="<%:Switch to CIDR list notation%>" aria-label="<%:Switch to CIDR list notation%>" onclick="switchToCIDRList(event)">…</button>
+<%+cbi/valuefooter%>