Skip to content

Commit

Permalink
🐛 Fix exporter page for Bootstrap 3 applications (#928)
Browse files Browse the repository at this point in the history
This commit will add the `hidden` class back in addition to the `d-none`
class.  This way older Hyku/Hyrax applications can still use it without
unintended effects.  Also, adding a turbolinks false to the edit
exporter link because the buttons on the form page was not working
without a refresh.
  • Loading branch information
kirkkwang authored Feb 19, 2024
1 parent 933b44d commit a6b44d1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions app/assets/javascripts/bulkrax/exporters.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ function removeRequired(allSources) {

// hide all export_source
function hide(allSources) {
allSources.addClass('d-none');
allSources.find('#exporter_export_source').addClass('.d-none').attr('type', 'd-none');
allSources.addClass('d-none hidden');
allSources.find('#exporter_export_source').addClass('.d-none hidden').attr('type', 'd-none hidden');
}

// unhide selected export_source
function unhideSelected(selectedSource) {
selectedSource.removeClass('d-none').removeAttr('type');
selectedSource.parent().removeClass('d-none').removeAttr('type');
selectedSource.removeClass('d-none hidden').removeAttr('type');
selectedSource.parent().removeClass('d-none hidden').removeAttr('type');
};

// add the autocomplete javascript
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/concerns/bulkrax/datatables_behavior.rb
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def importer_util_links(i)
def exporter_util_links(i)
links = []
links << view_context.link_to(view_context.raw('<span class="glyphicon glyphicon-info-sign"></span>'), exporter_path(i))
links << view_context.link_to(view_context.raw('<span class="glyphicon glyphicon-pencil"></span>'), edit_exporter_path(i))
links << view_context.link_to(view_context.raw('<span class="glyphicon glyphicon-pencil"></span>'), edit_exporter_path(i), data: { turbolinks: false })
links << view_context.link_to(view_context.raw('<span class="glyphicon glyphicon-remove"></span>'), i, method: :delete, data: { confirm: 'Are you sure?' })
links.join(" ")
end
Expand Down
20 changes: 10 additions & 10 deletions app/views/bulkrax/exporters/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,18 @@
label: t('bulkrax.exporter.labels.importer'),
required: true,
prompt: 'Select from the list',
label_html: { class: 'importer export-source-option d-none' },
input_html: { class: 'importer export-source-option d-none form-control' },
label_html: { class: 'importer export-source-option d-none hidden' },
input_html: { class: 'importer export-source-option d-none hidden form-control' },
collection: form.object.importers_list.sort %>
<%= form.input :export_source_collection,
prompt: 'Start typing ...',
label: t('bulkrax.exporter.labels.collection'),
required: true,
placeholder: @collection&.title&.first,
label_html: { class: 'collection export-source-option d-none' },
label_html: { class: 'collection export-source-option d-none hidden' },
input_html: {
class: 'collection export-source-option d-none form-control',
class: 'collection export-source-option d-none hidden form-control',
data: {
'autocomplete-url' => '/authorities/search/collections',
'autocomplete' => 'collection'
Expand All @@ -56,8 +56,8 @@
label: t('bulkrax.exporter.labels.worktype'),
required: true,
prompt: 'Select from the list',
label_html: { class: 'worktype export-source-option d-none' },
input_html: { class: 'worktype export-source-option d-none form-control' },
label_html: { class: 'worktype export-source-option d-none hidden' },
input_html: { class: 'worktype export-source-option d-none hidden form-control' },
collection: Bulkrax.curation_concerns.map { |cc| [cc.to_s, cc.to_s] } %>
<%= form.input :limit,
Expand All @@ -80,7 +80,7 @@
as: :boolean,
label: t('bulkrax.exporter.labels.filter_by_date') %>

<div id="date_filter_picker" class="d-none">
<div id="date_filter_picker" class="d-none hidden">
<%= form.input :start_date,
as: :date,
label: t('bulkrax.exporter.labels.start_date'),
Expand Down Expand Up @@ -136,13 +136,13 @@
// get the date filter option and show the corresponding date selectors
$('.exporter_date_filter').change(function () {
if ($('.exporter_date_filter').find(".boolean").is(":checked"))
$('#date_filter_picker').removeClass('d-none');
$('#date_filter_picker').removeClass('d-none hidden');
else
$('#date_filter_picker').addClass('d-none');
$('#date_filter_picker').addClass('d-none hidden');
});

if ($('.exporter_date_filter').find(".boolean").is(":checked"))
$('#date_filter_picker').removeClass('d-none');
$('#date_filter_picker').removeClass('d-none hidden');
});
});
</script>

0 comments on commit a6b44d1

Please sign in to comment.