_itunes_category_edit.rhtml
来自「用ruby on rails写的一个博客程序,还不错..ruby on rail」· RHTML 代码 · 共 33 行
RHTML
33 行
<%#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.newend-%><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>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?