app/views/agents/_index_work.html.erb
<div id="content_detail" class="ui-corner-all">
<h1 class="title"><%= t('page.listing', :model => t('agent.creator')) -%></h1>
<div id="content_list">
<h2 class="resource_title">
[W]
<%= link_to work.original_title, work -%>
<%- if work.series_statement -%>
(<%= link_to work.series_statement.original_title, work.series_statement -%>)
<%- end -%>
</h2>
<%= form_for :agents, :url => work_agents_path(work), :html => {:method => 'get'} do -%>
<p>
<%= t('page.search_term') -%>: <%= search_field_tag 'query', h(@query), {:id => 'search_form_top', :class => 'search_form', :placeholder => t('page.search_term')} -%>
<%- if can? :update, work -%>
<%= render 'page/add' %>
<% end %>
<%= submit_tag t('page.search') -%>
<%= link_to t('page.back_to_index'), work_agents_path(work) -%>
</p>
<%- end -%>
<table class="index">
<tr>
<th><%= t('activerecord.attributes.agent.full_name') -%></th>
<th><%= t('activerecord.models.agent_type') -%></th>
<th><%= t('activerecord.attributes.agent.date_of_birth') -%></th>
<th id="edit_icons"></th>
</tr>
<%- @agents.each do |agent| -%>
<%- if agent.user.blank? -%>
<tr class="line<%= cycle("0", "1") -%>">
<td><%= link_to agent.full_name, agent -%></td>
<td><%= agent.agent_type.display_name.localize -%></td>
<td><%= l(agent.date_of_birth, :format => :only_date) if agent.date_of_birth -%></td>
<td>
<%- if can? :destroy, agent -%>
<%- if params[:mode] == 'add' -%>
<%= link_to t('page.add'), new_work_create_path(work, :agent_id => agent.id) unless work.creators.include?(agent) -%>
<%- else -%>
<%= link_to t('page.destroy'), work_create_path(work, work.created(agent)), :confirm => t('page.are_you_sure'), :method => :delete -%>
<%- end -%>
<%- end -%>
</td>
</tr>
<%- end -%>
<%- end -%>
</table>
<%= paginate(@agents) -%>
</div>
</div>
<div id="submenu" class="ui-corner-all">
<h3>
<%= link_to h("#{t('page.total')}: #{@count[:query_result]}"),
url_for(params.merge(:action => 'index', :library => nil, :role => nil, :agent_type => nil)) %>
</h3>
<% if @count[:query_result] > 0 %>
<%= render 'agent_type_facet' %>
<br />
<% end %>
<ul>
<%- if can? :create, Agent -%>
<li><%= link_to t('page.new', :model => t('activerecord.models.agent')), new_work_agent_path(work) -%></li>
<%- end -%>
</ul>
</div>