gluon/package/gluon-web/files/lib/gluon/web/view/model/lvalue.html
Matthias Schiffer cfe1bba8ae
gluon-web: fix radio button view of ListValues
Pretty much everything about this was broken:
* Fix dependency tracking
* Fix vertical orientation
* Fix paddings
* Add theming
2018-01-31 15:47:45 +01:00

41 lines
1.2 KiB
HTML

<%
local br = self.orientation == "horizontal" and '&#160;&#160;&#160;' or '<br />'
%>
<% if self.widget == "select" then %>
<select class="gluon-input-select" data-update="change"<%=
attr("id", id) ..
attr("name", id) ..
attr("size", self.size)
%>>
<% for i, key in pairs(self.keylist) do -%>
<option<%=
attr("id", id.."."..key) ..
attr("value", key) ..
attr("data-index", i) ..
attr("data-depends", self:deplist(self.valdeps[i])) ..
attr("selected", (self:cfgvalue() == key) and "selected")
%>><%=pcdata(self.vallist[i])%></option>
<%- end %>
</select>
<% elseif self.widget == "radio" then %>
<div>
<% for i, key in pairs(self.keylist) do %>
<label<%=
attr("data-index", i) ..
attr("data-depends", self:deplist(self.valdeps[i]))
%>>
<input class="gluon-input-radio" data-update="click change" type="radio"<%=
attr("id", id.."."..key) ..
attr("name", id) ..
attr("value", key) ..
attr("checked", (self:cfgvalue() == key) and "checked")
%> />
<label<%= attr("for", id.."."..key)%>></label>
<%=pcdata(self.vallist[i])%>
</label>
<% if i ~= #self.keylist then write(br) end %>
<% end %>
</div>
<% end %>