Skip to content

Commit

Permalink
Initial works in batch UI
Browse files Browse the repository at this point in the history
  • Loading branch information
little9 committed Nov 4, 2019
1 parent e6a4fb3 commit e2decb3
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 19 deletions.
9 changes: 9 additions & 0 deletions app/models/zizia/pre_ingest_work.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,14 @@
module Zizia
class PreIngestWork < ::ApplicationRecord
has_many :pre_ingest_files

# Returns the title based on the deduplication_key if the work has been indexed to solr
# @return [String] the work's title
def title
solr_title = ActiveFedora::SolrService.get("deduplication_key_tesim:#{deduplication_key}")
.dig('response', 'docs', 0, 'title_tesim', 0)
return solr_title unless solr_title.nil?
'This work\'s metadata has not been indexed yet.'
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<table id="files-table" class="dataTable display responsive nowrap table table-striped works-list" style="width:100%">
<tr>
<th>Filename</th>
<th>Size</th>
<th>Row Number</th>
</tr>
<% pre_ingest_work.pre_ingest_files.each do |pre_ingest_file| %>
<tr>
<td>
<%= pre_ingest_file.basename %>
</td>
<td>
<%= number_to_human_size(pre_ingest_file.size) %>
</td>
<td>
<%= pre_ingest_file.row_number %>
</td>
</tr>
<% end %>
</table>
42 changes: 23 additions & 19 deletions app/views/zizia/csv_import_details/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,30 @@
<li>Total Size: <%= number_to_human_size(@csv_import_detail.total_size) %></li>
</ul>

<h3>Files</h3>
<table id="files-table" class="dataTable display responsive nowrap table table-striped works-list" style="width:100%">
<h3>Works & Files</h3>

<table id="works-table" class="table works-list">
<tr>
<th>Filename</th>
<th>Size</th>
<th>Row Number</th>
<th>Deduplication Key</th>
<th>Title</th>
<th>Files</th>
<th>Date</th>
</tr>

<% @csv_import_detail.pre_ingest_files.each do |pre_ingest_file| %>
<tr>
<td>
<%= pre_ingest_file.basename %>
</td>
<td>
<%= number_to_human_size(pre_ingest_file.size) %>
</td>
<td>
<%= pre_ingest_file.row_number %>
</td>
</tr>
<% end %>
<% @csv_import_detail.pre_ingest_works.each do |pre_ingest_work| %>
<tr>
<td>
<%= pre_ingest_work.deduplication_key%>
</td>
<td>
<%= pre_ingest_work.title %>
</td>
<td>
<%= render 'pre_ingest_files_table', pre_ingest_work: pre_ingest_work %>
</td>
<td>
<%= pre_ingest_work.created_at.strftime("%B %-d, %Y %H:%M") %>
</td>
</tr>
<% end %>
</table>
</div>

0 comments on commit e2decb3

Please sign in to comment.