lvalue.html 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <%
  2. local br = self.orientation == "horizontal" and '&#160;&#160;&#160;' or '<br />'
  3. local entries = self:entries()
  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. attr("data-type", "minlength(1)") ..
  11. attr("data-optional", self.optional)
  12. %>>
  13. <% for i, entry in pairs(entries) do -%>
  14. <option<%=
  15. attr("id", id.."."..entry.key) ..
  16. attr("value", entry.key) ..
  17. attr("data-index", i) ..
  18. attr("data-depends", self:deplist(entry.deps)) ..
  19. attr("selected", (self:cfgvalue() == entry.key) and "selected")
  20. %>><%|entry.value%></option>
  21. <%- end %>
  22. </select>
  23. <% elseif self.widget == "radio" then %>
  24. <div>
  25. <% for i, entry in pairs(entries) do %>
  26. <label<%=
  27. attr("data-index", i) ..
  28. attr("data-depends", self:deplist(entry.deps))
  29. %>>
  30. <input class="gluon-input-radio" data-update="click change" type="radio"<%=
  31. attr("id", id.."."..entry.key) ..
  32. attr("name", id) ..
  33. attr("value", entry.key) ..
  34. attr("checked", (self:cfgvalue() == entry.key) and "checked")
  35. %> />
  36. <label<%= attr("for", id.."."..entry.key)%>></label>
  37. <%|entry.value%>
  38. </label>
  39. <% if i ~= #entries then write(br) end %>
  40. <% end %>
  41. </div>
  42. <% end %>