Sha256: 3d6e17924932e1ea56669f2b7f92ea052d31ed96a08bbfb65428728ca3f38ca7
Contents?: true
Size: 1.21 KB
Versions: 19
Compression:
Stored size: 1.21 KB
Contents
<% #Since the data is in yaml coming out of the DB it is converted here from #comparision. This is a hack to get things working. unless categories.nil? selected = YAML::load(categories) else selected = Hash.new end -%> <select name="itunes_category[]" id="resource_itunes_category_<%= id %>" size="3" multiple="multiple"> <% @itunes_category_list.each do |h| h.each_pair do |cat,subcats| -%> <% # not a great way of handling this but it looks better -%> <% if selected.key?(cat) -%> <option value="<%=h cat %>" selected="selected"><%=h cat %></option> <% else -%> <option value="<%=h cat %>"><%=h cat %></option> <% end -%> <% subcats.each do |subcat| -%> <% unless selected[cat].nil? -%> <% if selected[cat].include?(subcat) -%> <option value="<%=h cat %>-<%=h subcat %>" selected="selected"> -<%=h subcat %></option> <% else -%> <option value="<%=h cat %>-<%=h subcat %>"> -<%=h subcat %></option> <% end -%> <% else -%> <option value="<%=h cat %>-<%=h subcat %>"> -<%=h subcat %></option> <% end -%> <% end unless subcats.nil? %> <% end -%> <% end -%> </select>
Version data entries
19 entries across 19 versions & 1 rubygems