Skip to content

Commit

Permalink
add result template file
Browse files Browse the repository at this point in the history
  • Loading branch information
nabeta committed Dec 30, 2019
1 parent fa2ac7e commit 60b81e4
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 35 deletions.
1 change: 1 addition & 0 deletions app/controllers/inventory_files_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def show
file = @inventory_file.inventory.path
end
end
@inventories = @inventory_file.inventories.page(params[:page])

respond_to do |format|
format.html # show.html.erb
Expand Down
36 changes: 36 additions & 0 deletions app/views/inventory_files/_results.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<h2><%= t('activerecord.models.inventory') %></h2>

<p>
<%= link_to((image_tag 'icons/page_white_excel.png', size: '16x16', alt: 'TSV', class: 'enju_icon'), inventories_path(inventory_file_id: @inventory_file.id, format: :txt)) -%>
(<%= link_to 'TSV', inventories_path(inventory_file_id: @inventory_file.id, format: :txt) -%>)
</p>

<table class="table table-striped index">
<tr>
<th><%= t('activerecord.attributes.inventory.lineno') %></th>
<th><%= t('activerecord.attributes.inventory.current_shelf_name') %></th>
<th><%= t('activerecord.attributes.inventory.item_identifier') %></th>
<th><%= t('activerecord.models.manifestation') %></th>
<th></th>
</tr>
<% @inventories.each_with_index do |inventory, idx| %>
<tr class="line<%= cycle("0", "1") -%>">
<td><%= @inventories.offset_value + idx + 1 %></td>
<td><%= inventory.current_shelf_name %></td>
<td><%= inventory.item_identifier %></td>
</td>
<td>
<% if inventory.item %>
<%= link_to inventory.item.item_identifier, inventory.item %>
<br />
<%= link_to inventory.item.manifestation.original_title, inventory.item.manifestation if inventory.item.try(:manifestation) %>
<% end %>
</td>
<td>
<%= link_to t('page.show'), inventory %>
<%= link_to t('page.destroy'), inventory, data: {confirm: t('page.are_you_sure')}, method: :delete %>
</td>
</tr>
<% end %>
</table>
<%= paginate(@inventories) %>
74 changes: 39 additions & 35 deletions app/views/inventory_files/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,39 +1,43 @@
<div id="content_detail" class="ui-corner-all ui-widget-content">
<h1 class="title"><%= t('page.showing', :model => t('activerecord.models.inventory_file')) -%></h1>
<div id="content_list">
<p id="notice"><%= notice %></p>

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

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

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

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

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

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

</div>
<h1 class="title"><%= t('page.showing', :model => t('activerecord.models.inventory_file')) -%></h1>
<div id="content_list">
<p id="notice"><%= notice %></p>

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

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

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

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

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

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

<% if @inventories %>
<%= render 'results' %>
<% end %>

</div>
</div>

<div id="submenu" class="ui-corner-all ui-widget-content">
Expand Down

0 comments on commit 60b81e4

Please sign in to comment.