Sha256: f8e3960cc1b75fc429fd4e4a5760c87ecc340c2c7dbff32c37f102f91505ca62

Contents?: true

Size: 1.21 KB

Versions: 9

Compression:

Stored size: 1.21 KB

Contents

<%
#Ssince the data is in yaml coming out of the DB it is converted here from
#comparission. 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">&nbsp;-<%=h subcat %></option>
          <% else -%>
            <option value="<%=h cat %>-<%=h subcat %>">&nbsp;-<%=h subcat %></option>
          <% end -%>
        <% else -%>
          <option value="<%=h cat %>-<%=h subcat %>">&nbsp;-<%=h subcat %></option>
        <% end -%>
      <% end unless subcats.nil?  %>
    <% end -%>
  <% end -%>
</select>

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
typo-3.99.0 app/views/admin/resources/_itunes_category_edit.rhtml
typo-3.99.3 app/views/admin/resources/_itunes_category_edit.rhtml
typo-3.99.1 app/views/admin/resources/_itunes_category_edit.rhtml
typo-3.99.2 app/views/admin/resources/_itunes_category_edit.rhtml
typo-4.0.1 app/views/admin/resources/_itunes_category_edit.rhtml
typo-3.99.4 app/views/admin/resources/_itunes_category_edit.rhtml
typo-4.0.0 app/views/admin/resources/_itunes_category_edit.rhtml
typo-4.0.2 app/views/admin/resources/_itunes_category_edit.rhtml
typo-4.0.3 app/views/admin/resources/_itunes_category_edit.rhtml