lvalue.html 1.2 KB

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