<% render_req = true if render_req.blank? %>
<% vals = generic_file.send(key) %> <% # not an arry lets just shove it in one %> <% vals = [vals] unless vals.is_a?(Array) %> <%# if vals is zero we create an empty array to loop over for output %> <% vals = [''] if vals.count == 0 %> <% label = GenericFile::get_label(key) %> <% vals.each_with_index do |v, index| %> <% req = render_req && (index == 0) && (["title", "creator", "tag", "rights"].include?(key)) %> <% if req %> <% tmp = '*' + label %> <%= f.label key, tmp.html_safe, :class=>"control-label" if index == 0 %> <% else %> <%= f.label key, label, :class=>"control-label" if index == 0 %> <% end %>
id="additional_<%= key %>_clone" <% end %>> <% if key == "description" %> <%= f.text_area :description, :name=>"generic_file[#{key}][]", :id => "generic_file_"+key, :value=>v, :class => "input-large" %> <% elsif key == "rights" %> <% choices = ScholarSphere::Application::config.cc_licenses %> <% choices = {""=>""}.merge(choices) %> <%= f.select "rights", options_for_select(choices, v) %> <% elsif key == "resource_type" %> <% if (index == 0) %>

You may select multiple types to apply

<% choices = ScholarSphere::Application::config.resource_types.keys %> <%= f.select "resource_type", options_for_select(choices, vals.to_a), {}, {:multiple=>true, :size=>7} %> <%end%> <% else %> <%= f.text_field :title, :name=>"generic_file[#{key}][]", :id => "generic_file_"+key, :value=>v, :class => "input-large", :required => req %> <% end %> <% if index == 0 %> <% if (key != "resource_type") %>   <% end %> <%= render :partial => "generic_files/rights_modal" if key == "rights" %> <% elsif (key != "resource_type") %> <% end %>

<% end %>