12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <%
- local br = self.orientation == "horizontal" and '   ' or '<br />'
- local entries = self:entries()
- %>
- <% if self.widget == "select" then %>
- <select class="gluon-input-select" data-update="change"<%=
- attr("id", id) ..
- attr("name", id) ..
- attr("size", self.size) ..
- attr("data-type", "minlength(1)") ..
- attr("data-optional", self.optional)
- %>>
- <% for i, entry in pairs(entries) do -%>
- <option<%=
- attr("id", id.."."..entry.key) ..
- attr("value", entry.key) ..
- attr("data-index", i) ..
- attr("data-depends", self:deplist(entry.deps)) ..
- attr("selected", (self:cfgvalue() == entry.key) and "selected")
- %>><%=pcdata(entry.value)%></option>
- <%- end %>
- </select>
- <% elseif self.widget == "radio" then %>
- <div>
- <% for i, entry in pairs(entries) do %>
- <label<%=
- attr("data-index", i) ..
- attr("data-depends", self:deplist(entry.deps))
- %>>
- <input class="gluon-input-radio" data-update="click change" type="radio"<%=
- attr("id", id.."."..entry.key) ..
- attr("name", id) ..
- attr("value", entry.key) ..
- attr("checked", (self:cfgvalue() == entry.key) and "checked")
- %> />
- <label<%= attr("for", id.."."..entry.key)%>></label>
- <%=pcdata(entry.value)%>
- </label>
- <% if i ~= #entries then write(br) end %>
- <% end %>
- </div>
- <% end %>
|