MiraitSystems/enju_trunk

View on GitHub
app/views/shelves/show.html.erb

Summary

Maintainability
Test Coverage
<div id="content_detail" class="ui-corner-all">
<h1 class="title"><%= t('page.showing', :model => t('activerecord.models.shelf')) -%></h1>
<div id="content_list">
<p id="notice"><%= notice %></p>

<h2 class="resource_title">
  <%= link_to @shelf.library.display_name.localize, @shelf.library -%>
  <%= @shelf.display_name.localize -%>
</h2>

<% if current_user.try(:has_role?, 'Librarian') %>
  <p>
    <strong><%= t('activerecord.attributes.shelf.name') -%>:</strong>
    <%= @shelf.name %>
  </p>
<% end %>

<p>
  <strong><%= t('activerecord.attributes.shelf.note') -%>:</strong>
  <%= @shelf.note -%>
</p>

<p>
  <strong><%= t('activerecord.attributes.shelf.open_access') -%>:</strong>
  <%= i18n_open_access(@shelf.open_access) -%>
</p>

<p>
  <strong><%= t('activerecord.attributes.shelf.required_role') -%>:</strong>
  <%= @shelf.required_role.display_name -%>
</p>

<p>
  <strong><%= t('activerecord.models.picture_file') -%>:</strong><br />
  <%- @shelf.picture_files.each do |picture_file| -%>
    <%= render 'picture_files/link', :picture_file => picture_file %>
  <%- end -%>
</p>

<p>
  <strong><%= t('page.created_at') -%>:</strong>
  <%= l(@shelf.created_at) -%>
</p>

<p>
  <strong><%= t('page.updated_at') -%>:</strong>
  <%= l(@shelf.updated_at) -%>
</p>

</div>
</div>

<div id="submenu" class="ui-corner-all">
  <ul>
    <% if can? :create, Shelf %>
      <%- if @library -%>
        <li><%= link_to t('page.new', :model => t('activerecord.models.shelf')), new_library_shelf_path(@library) -%></li>
      <%- else -%>
        <li><%= link_to t('page.new', :model => t('activerecord.models.shelf')), new_shelf_path -%></li>
      <%- end -%>
    <% end %>
    <% if can? :update, @shelf %>
      <% unless @shelf.open_access == 9 %>
        <li><%= link_to t('page.edit'), edit_shelf_path(@shelf) -%></li>
      <% end %>
    <% end %>
    <%- if can? :create, PictureFile -%>
      <li><%= link_to t('page.listing', :model => t('activerecord.models.picture_file')), shelf_picture_files_path(@shelf) -%></li>
    <% end %>
    <%- if can? :destroy, @shelf -%>
      <%- unless @shelf.id == 1 or @shelf.open_access == 9 -%>
        <li><%= link_to t('page.destroy'), @shelf, :confirm => t('page.are_you_sure'), :method => :delete -%></li>
      <%- end -%>
    <%- end -%>
    <li><%= link_to t('page.back'), shelves_path -%></li>
  </ul>
</div>