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

🐛 Fix tabs for Hydra application #875

Merged
merged 1 commit into from
Oct 25, 2023
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
21 changes: 19 additions & 2 deletions app/assets/javascripts/bulkrax/navtabs.js.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
<% unless defined?(::Hyku) %>
// enables the tabs in the importers/exporters pages.
$(document).ready(function() {
$('.bulkrax-nav-tab-top-margin.nav-tabs a').click(function (e) {
$('.bulkrax-nav-tab-top-margin.nav-tabs a').click(function(e) {
e.preventDefault();
$(this).tab('show');

// Remove active class from all tabs and hide all tab content
$('.bulkrax-nav-tab-top-margin.nav-tabs a').parent().removeClass('active');
$('.tab-content .tab-pane').removeClass('active');

// Add active class to clicked tab and show its content
$(this).parent().addClass('active');
$($(this).attr('href')).addClass('active');
});

$('#full-errors-tab, #full-errors-tab a').click(function(e) {
$('#raw-errors-tab, #bulkrax-raw-toggle-1').removeClass('active');
$('#full-errors-tab, #bulkrax-full-toggle-1').addClass('active');
})

$('#raw-errors-tab, #raw-errors-tab a').click(function(e) {
$('#full-errors-tab, #bulkrax-full-toggle-1').removeClass('active');
$('#raw-errors-tab, #bulkrax-raw-toggle-1').addClass('active');
})
});
<% end %>
4 changes: 2 additions & 2 deletions app/views/bulkrax/shared/_bulkrax_errors.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
<div class="bulkrax-nav-tab-bottom-margin">
<!-- Toggle buttons -->
<div class="btn-group pull-right" role="group" aria-label="...">
<button type="button" class="btn btn-default active"><a href="#bulkrax-full-toggle-1" aria-controls="bulkrax-full-toggle-1" role="tab" data-toggle="tab">Full</a></button>
<button type="button" class="btn btn-default"><a href="#bulkrax-raw-toggle-1" aria-controls="bulkrax-raw-toggle-1" role="tab" data-toggle="tab">Raw</a></button>
<button id="full-errors-tab" type="button" class="btn btn-default active"><a href="#bulkrax-full-toggle-1" aria-controls="bulkrax-full-toggle-1" role="tab" data-toggle="tab">Full</a></button>
<button id="raw-errors-tab" type="button" class="btn btn-default"><a href="#bulkrax-raw-toggle-1" aria-controls="bulkrax-raw-toggle-1" role="tab" data-toggle="tab">Raw</a></button>
</div>
<!-- Tab panes -->
<div class="tab-content">
Expand Down