Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Cleaning up UI on importers show #1011

Merged
merged 3 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions app/assets/javascripts/bulkrax/datatables.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ Blacklight.onLoad(function() {
$('#importer-show-table').DataTable( {
'processing': true,
'serverSide': true,
'width': '100%',
'autoWidth': false,
'scrollX': true,
'scrollCollapse': true,
"ajax": window.location.href.replace(/(\/(importers|exporters)\/\d+)/, "$1/entry_table.json"),
"pageLength": 30,
"lengthMenu": [[30, 100, 200], [30, 100, 200]],
Expand All @@ -15,6 +19,14 @@ Blacklight.onLoad(function() {
{ "data": "errors", "orderable": false },
{ "data": "actions", "orderable": false }
],
drawCallback: function() {
// Remove the inline styles that DataTables adds to the scrollHeadInner and table elements
// it's not perfect but better than the style being applied
setTimeout(function() {
$('.dataTables_scrollHeadInner').removeAttr('style');
$('.table.table-striped.dataTable.no-footer').removeAttr('style');
}, 100);
},
initComplete: function () {
// Add entry class filter
entrySelect.bind(this)()
Expand Down
8 changes: 4 additions & 4 deletions app/views/bulkrax/importers/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<div class="col-xs-12 main-header">
<div class="col-xs-12 main-header d-flex justify-content-between align-items-center">
<h1><span class="fa fa-cloud-upload" aria-hidden="true"></span> Importer: <%= @importer.name %></h1>
<div class="pull-right">
<%= link_to 'Download Original File', importer_original_file_path(@importer.id), class: 'btn btn-primary', data: { turbolinks: false } if @importer.original_file %>
<%= link_to 'Download Original File', importer_original_file_path(@importer.id), class: 'btn btn-primary text-nowrap', data: { turbolinks: false } if @importer.original_file %>
<% if @importer.failed_entries? %>
<%= link_to 'Export Errored Entries', importer_export_errors_path(@importer.id), class: 'btn btn-primary', data: { turbolinks: false }%>
<%= link_to 'Upload Corrected Entries', importer_upload_corrected_entries_path(@importer.id), class: 'btn btn-primary' if @importer.parser.is_a?(Bulkrax::CsvParser) %>
<%= link_to 'Export Errored Entries', importer_export_errors_path(@importer.id), class: 'btn btn-primary text-nowrap', data: { turbolinks: false }%>
<%= link_to 'Upload Corrected Entries', importer_upload_corrected_entries_path(@importer.id), class: 'btn btn-primary text-nowrap' if @importer.parser.is_a?(Bulkrax::CsvParser) %>
<% end %>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/bulkrax/shared/_entries_tab.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
</tr>
</thead>
</table>
<div id='importer-entry-classes' class='hidden'><%= [item.parser.entry_class.to_s, item.parser.collection_entry_class.to_s, item.parser.file_set_entry_class.to_s].compact.join('|') %></div>
<div id='importer-entry-classes' class='hidden d-none'><%= [item.parser.entry_class.to_s, item.parser.collection_entry_class.to_s, item.parser.file_set_entry_class.to_s].compact.join('|') %></div>
</div>
8 changes: 5 additions & 3 deletions config/locales/bulkrax.en.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
en:
helpers:
action:
helpers:
action:
importer:
new: "New"
exporter:
exporter:
new: "New"
bulkrax:
admin:
Expand Down Expand Up @@ -75,6 +75,8 @@ en:
identifier: Identifier
entry_id: Entry ID
status: Status
type: Type
updated_at: Updated At
errors: Errors
status_set_at: Status Set At
actions: Actions
Loading