MiraitSystems/enju_trunk

View on GitHub
app/views/resource_import_textfiles/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.resource_import_textfile')) -%></h1>
<div id="content_list">
<p id="notice"><%= notice %></p>

<p>
  <strong>Id:</strong>
  <%= @resource_import_textfile.id -%>
</p>

<p>
  <strong><%= t('activerecord.attributes.resource_import_textfile.adapter_name') -%>:</strong>
  <%= @resource_import_textfile.adapter_display_name -%>
</p>

<p>
  <strong><%= t('activerecord.attributes.resource_import_textfile.resource_import_text_file_name') -%>:</strong>
  <%= link_to @resource_import_textfile.resource_import_text_file_name, resource_import_textfile_path(@resource_import_textfile, :format => :download) -%>
</p>

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

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

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

<br />
<table style="border: 0px;">
  <% line_style = "border:0px; border-bottom: 1px solid #aaa;" %>
  <tr>
    <% if @resource_import_textfile.adapter_name == 'Excelfile_Adapter' %>
      <th style="<%= line_style%>"><%= t('activerecord.attributes.resource_import_textfile.sheet') %></th>
    <% end %>
    <% if SystemConfiguration.get('manifestations.split_by_type') %>
      <th style="<%= line_style%>"><%= t('activerecord.models.manifestation_type') %></th>
    <% end %>
    <th style="<%= line_style%>"><%= t('activerecord.models.numbering') %></th>
    <th style="<%= line_style%>"><%= t('resource_import_textfile.auto_numbering') %></th>
    <th style="<%= line_style%>"><%= t('resource_import_textfile.not_set_serial_number') %></th>
  </tr>

  <% if SystemConfiguration.get('manifestations.split_by_type') %>
    <% manifestation_types = eval(@resource_import_textfile.extraparams)["manifestation_type"] %>
  <% end %>
  <% numberings = eval(@resource_import_textfile.extraparams)["numbering"] %>
  <% auto_numberings = eval(@resource_import_textfile.extraparams)["auto_numbering"] %>
  <% not_set_serial_number = eval(@resource_import_textfile.extraparams)["not_set_serial_number"] %>
  <% if @resource_import_textfile.adapter_name == 'Excelfile_Adapter' %> 
    <% sheets = eval(@resource_import_textfile.extraparams)["sheet"] %>
    <% sheets.each_with_index do |sheet, i| %>
      <tr>
        <td style="<%= line_style%>"><%= sheet %></td>
        <% if SystemConfiguration.get('manifestations.split_by_type') %>
          <td style="<%= line_style%>"><%= get_manifestation_type_name(manifestation_types[i]) rescue nil %></td>
          <td style="<%= line_style%>"><%= get_numbering_display_name(numberings[i], manifestation_types[i]) rescue nil %></td>
        <% else %>
          <td style="<%= line_style%>"><%= get_numbering_display_name(numberings[i]) rescue nil %></td>
        <% end %>
        <td style="<%= line_style%>"><%= t("page.boolean.#{auto_numberings[i]}") if auto_numberings %></td>
        <td style="<%= line_style%>"><%= t("page.boolean.#{not_set_serial_number[i]}") if not_set_serial_number %></td>
      </tr>
    <% end %>
  <% else %>
    <tr>
      <% if SystemConfiguration.get('manifestations.split_by_type') %>
        <td style="<%= line_style%>"><%= get_manifestation_type_name(manifestation_types.first) rescue nil %></td>
        <td style="<%= line_style%>"><%= get_numbering_display_name(numberings.first, manifestation_types.first) rescue nil %></td>
      <% else %>
        <td style="<%= line_style%>"><%= get_numbering_display_name(numberings.first) rescue nil %></td>
      <% end %>
      <td style="<%= line_style%>"><%= t("page.boolean.#{auto_numberings.first}") %></td>
    </tr>
  <% end %>
</table>
<br />

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

<p>
  <strong><%= t('activerecord.attributes.resource_import_textfile.imported_at') -%>:</strong>
  <%= l(@resource_import_textfile.imported_at) if @resource_import_textfile.imported_at -%>
</p>

<p>
  <strong><%= t('activerecord.attributes.resource_import_textfile.state') -%>:</strong>
  <%= t("state.#{@resource_import_textfile.state}") -%>
</p>

<p>
  <strong><%= t('activerecord.models.user') -%>:</strong>
  <%= link_to @resource_import_textfile.try(:user).try(:username), @resource_import_textfile.try(:user) if @resource_import_textfile.user -%>
</p>

</div>
</div>

<div id="submenu" class="ui-corner-all">
  <ul>
    <%- if @resource_import_textfile.state == 'pending' -%>
      <li><%= link_to t('resource_import_textfile.import_request'), {:action => "import_request", :id => @resource_import_textfile.id} -%></li>
    <%- end -%>
    <li><%= link_to t('activerecord.models.resource_import_textresult'), resource_import_textfile_resource_import_textresults_path(@resource_import_textfile) -%></li>
    <li><%= link_to t('page.back_to_index'), resource_import_textfiles_path -%></li>
  </ul>
</div>