lvalue.html 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <%
  2. local i, key
  3. local br = self.orientation == "horizontal" and '&#160;' or '<br />'
  4. %>
  5. <% if self.widget == "select" then %>
  6. <select class="gluon-input-select" data-update="change"<%=
  7. attr("id", id) ..
  8. attr("name", id) ..
  9. attr("size", self.size)
  10. %>>
  11. <% for i, key in pairs(self.keylist) do -%>
  12. <option<%=
  13. attr("id", id.."."..key) ..
  14. attr("value", key) ..
  15. attr("data-index", i) ..
  16. attr("data-depends", self:deplist(self.valdeps[i])) ..
  17. attr("selected", (self:cfgvalue() == key) and "selected")
  18. %>><%=pcdata(self.vallist[i])%></option>
  19. <%- end %>
  20. </select>
  21. <% elseif self.widget == "radio" then %>
  22. <div>
  23. <% for i, key in pairs(self.keylist) do %>
  24. <label<%=
  25. attr("data-index", i) ..
  26. attr("data-depends", self:deplist(self.valdeps[i]))
  27. %>>
  28. <input class="gluon-input-radio" data-update="click change" type="radio"<%=
  29. attr("id", id.."."..key) ..
  30. attr("name", id) ..
  31. attr("value", key) ..
  32. attr("checked", (self:cfgvalue() == key) and "checked")
  33. %> />
  34. <label<%= attr("for", id.."-"..key)%>></label>
  35. <%=pcdata(self.vallist[i])%>
  36. </label>
  37. <% if i == self.size then write(br) end %>
  38. <% end %>
  39. </div>
  40. <% end %>