Skip to content

Commit

Permalink
Show works first, then collections (#232)
Browse files Browse the repository at this point in the history
* Fix depenencies and pagination isseus

* further pagination refinements
  • Loading branch information
orangewolf authored Aug 18, 2020
1 parent 2db66de commit 122f900
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions app/controllers/bulkrax/importers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ def show
add_importer_breadcrumbs
add_breadcrumb @importer.name

@work_entries = @importer.entries.where(type: @importer.parser.entry_class.to_s).page(params[:work_entries_page])
@collection_entries = @importer.entries.where(type: @importer.parser.collection_entry_class.to_s).page(params[:collections_entries_page])
@work_entries = @importer.entries.where(type: @importer.parser.entry_class.to_s).page(params[:work_entries_page]).per(30)
@collection_entries = @importer.entries.where(type: @importer.parser.collection_entry_class.to_s).page(params[:collections_entries_page]).per(30)
end
end

Expand Down
46 changes: 23 additions & 23 deletions app/views/bulkrax/importers/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,20 @@
<%= @importer.importer_runs.last&.total_collection_entries %>
</p>

<div class="bulkrax-nav-tab-bottom-margin">
<!-- Nav tabs -->
<div class="bulkrax-nav-tab-bottom-margin">
<!-- Nav tabs -->
<ul class="bulkrax-nav-tab-top-margin tab-nav nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#collection-entries" aria-controls="collection-entries" role="tab" data-toggle="tab">Collection Entries</a></li>
<li role="presentation"><a href="#work-entries" aria-controls="work-entries" role="tab" data-toggle="tab">Work Entries</a></li>
<li role="presentation" class='active'><a href="#work-entries" aria-controls="work-entries" role="tab" data-toggle="tab">Work Entries</a></li>
<li role="presentation"><a href="#collection-entries" aria-controls="collection-entries" role="tab" data-toggle="tab">Collection Entries</a></li>
</ul>
<!-- Tab panes -->
<!-- Tab panes -->
<div class="tab-content outline">
<div role="tabpanel" class="tab-pane fade in active bulkrax-nav-tab-table-left-align" id="collection-entries">
<div role="tabpanel" class="tab-pane active bulkrax-nav-tab-table-left-align" id="work-entries">
<table class='table table-striped'>
<thead>
<tr>
<th>Identifier</th>
<th>Collection</th>
<th>Entry ID</th>
<th>Status</th>
<th>Errors</th>
Expand All @@ -87,13 +88,20 @@
</tr>
</thead>
<tbody>
<% @collection_entries.each do |e| %>
<% @work_entries.each do |e| %>
<tr>
<td><%= link_to e.identifier, bulkrax.importer_entry_path(@importer.id, e.id) %></td>
<% if e.parsed_metadata.present? && e.parsed_metadata.dig("collections").present? %>
<td><%= e.parsed_metadata.dig("collections").map {|c| c['id'] }.join('; ') %></td>
<% elsif e.raw_metadata.present? %>
<td><%= Array.wrap(e.raw_metadata.dig("collection")).join(';') %></td>
<% else %>
<td></td>
<% end %>
<td><%= e.id %></td>
<% if e.status == "succeeded" %>
<td><span class="glyphicon glyphicon-ok" style="color: green;"></span> <%= e.status %></td>
<% else %>
<% else %>
<td><span class="glyphicon glyphicon-remove" style="color: red;"></span> <%= e.status %></td>
<% end %>
<% if e.last_error.present? %>
Expand All @@ -107,15 +115,14 @@
<% end %>
</tbody>
</table>
<%= page_entries_info(@collection_entries) %><br />
<%= paginate(@collection_entries, param_name: :collections_entries_page, params: {anchor: 'collection-entries'}) %>
<%= page_entries_info(@work_entries) %><br />
<%= paginate(@work_entries, theme: 'blacklight', param_name: :work_entries_page, params: { anchor: 'work-entries'}) %>
</div>
<div role="tabpanel" class="tab-pane fade bulkrax-nav-tab-table-left-align" id="work-entries">
<div role="tabpanel" class="tab-pane bulkrax-nav-tab-table-left-align" id="collection-entries">
<table class='table table-striped'>
<thead>
<tr>
<th>Identifier</th>
<th>Collection</th>
<th>Entry ID</th>
<th>Status</th>
<th>Errors</th>
Expand All @@ -124,20 +131,13 @@
</tr>
</thead>
<tbody>
<% @work_entries.each do |e| %>
<% @collection_entries.each do |e| %>
<tr>
<td><%= link_to e.identifier, bulkrax.importer_entry_path(@importer.id, e.id) %></td>
<% if e.parsed_metadata.present? && e.parsed_metadata.dig("collections").present? %>
<td><%= e.parsed_metadata.dig("collections").map {|c| c['id'] }.join('; ') %></td>
<% elsif e.raw_metadata.present? %>
<td><%= Array.wrap(e.raw_metadata.dig("collection")).join(';') %></td>
<% else %>
<td></td>
<% end %>
<td><%= e.id %></td>
<% if e.status == "succeeded" %>
<td><span class="glyphicon glyphicon-ok" style="color: green;"></span> <%= e.status %></td>
<% else %>
<% else %>
<td><span class="glyphicon glyphicon-remove" style="color: red;"></span> <%= e.status %></td>
<% end %>
<% if e.last_error.present? %>
Expand All @@ -151,8 +151,8 @@
<% end %>
</tbody>
</table>
<%= page_entries_info(@work_entries) %><br />
<%= paginate(@work_entries, param_name: :work_entries_page, params: { anchor: 'work-entries'}) %>
<%= page_entries_info(@collection_entries) %><br />
<%= paginate(@collection_entries, theme: 'blacklight', param_name: :collections_entries_page, params: {anchor: 'collection-entries'}) %>
</div>
</div>
</div>
Expand Down

0 comments on commit 122f900

Please sign in to comment.