Media<% if @object.try(:title) or @object.try(:name) and !params.has_key? :insert %> for <%= sub_title_for @object %>: <%= @object.try(:title) || @object.try(:name) || "N/A" %><% end %>

<% if @object %> <%= link_to "New", new_polymorphic_path([@object, :medium]), class: "button" %> <%= link_to "Back", url_for([:edit, @object]), class: "secondary hollow button" %> <% else %> <%= link_to "New", new_medium_path, class: "button" %> <% end %>
<% if notice %>

<%= notice %>

<% end %>
<% if @media.size > 0 %> <% @media.each do |media| %> <% end %>
<% if media.file_content_type.include? "image" %> <%= image_tag media.file.url(:small) %> <% else %> <% end %> <%= media.title %> <% if media.filable %>
Belongs to: <%= media.filable.try(:title) || media.filable_type.demodulize.humanize %> <% end %>
<% else %>

No media files have been added.

<% end %>
<%= will_paginate @media %>