<% orphans ||= [] %> <% files ||= [] %> <% content_for(:javascript) do %> <% end %>

Downloadable Resources

<%= render :partial => 'file_attachments/file_attachments', :locals => { :orphans => orphans, :files => files } %> <% if has_authorization?(:create, FileAttachment.new) %>

Upload Files

<%= link_to_unless params[:std] == '1', "One at a time", url_for(:controller => controller_name, :action => action_name, :std => 1), :class => 'fake_button' %> <%= link_to_if params[:std] == '1', "Several at once", url_for(:controller => controller_name, :action => action_name, :std => 0), :class => 'fake_button' %>

<% if @file_containers.present? %>

<%= render({ :partial => 'file_attachments/file_container_select', :locals => { :selected => "#{params[:attachable_type]}_#{params[:attachable_id]}" } }) %>

<% elsif instance_variable_defined?("@#{controller_name.singularize}") %> <% instance = instance_variable_get("@#{controller_name.singularize}") %> <%= hidden_field_tag 'file_attachment[file_container]', "#{instance.class}_#{instance.id}", { :id => 'file_container_select' } %> <% else %> <%= hidden_field_tag 'file_attachment[file_container]', nil, { :id => 'file_container_select' } %> <% end %> <% if params[:std] && params[:std] == '1' %>
<%= render :partial => 'file_attachments/upload_form', :locals => {:container => instance} if defined?(instance) %> <%= render :partial => 'file_attachments/upload_form' unless defined?(instance) %>
<% elsif params[:std].nil? || params[:std] == '0' %>
You browser doesn't support native upload. Try Firefox 3 or Safari 4.
<% end %>
<% end %>