MiraitSystems/enju_trunk

View on GitHub
app/views/agents/_index_manifestation.html.erb

Summary

Maintainability
Test Coverage
<div id="content_detail" class="ui-corner-all">
<h1 class="title"><%= t('page.listing', :model => t('agent.publisher')) -%></h1>
<div id="content_list">
  <%= render 'manifestations/title', :manifestation => manifestation -%>

<%= form_for :agents, :url => manifestation_agents_path(manifestation), :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, manifestation -%>
      <%= render 'page/add' %>
    <%- end -%>
    <%= submit_tag t('page.search') -%>
    <%= link_to t('page.back_to_index'), manifestation_agents_path(manifestation) -%>
  </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_manifestation_produce_path(manifestation, :agent_id => agent.id) unless manifestation.publishers.include?(agent) -%>
            <%- else -%>
              <%= link_to t('page.destroy'), manifestation_produce_path(manifestation, manifestation.produced(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">
  <%= render 'manifestations/book_jacket', :manifestation => manifestation -%>
  <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>
    <li><%= link_to t('activerecord.models.manifestation'), manifestations_path -%></li>
    <li><%= link_to t('page.listing', :model => t('activerecord.models.item')), manifestation_items_path(manifestation) -%></li>
    <%- if can? :create, Agent -%>
      <li><%= link_to t('page.new', :model => t('activerecord.models.agent')), new_manifestation_agent_path(manifestation) -%></li>
    <%- end -%>
  </ul>
</div>