46 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			46 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| <%
 | |
| 	local br = self.orientation == "horizontal" and '   ' or '<br>'
 | |
| 	local entries = self:entries()
 | |
| %>
 | |
| 
 | |
| <% if self.widget == "select" then %>
 | |
| 	<div class="select-wrapper">
 | |
| 		<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")
 | |
| 				%>><%|entry.value%></option>
 | |
| 			<%- end %>
 | |
| 		</select>
 | |
| 	</div>
 | |
| <% 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 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>
 | |
| 				<%|entry.value%>
 | |
| 			</label>
 | |
| 			<% if i ~= #entries then write(br) end %>
 | |
| 		<% end %>
 | |
| 	</div>
 | |
| <% end %>
 |