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

Blacklight 8 #495

Merged
merged 129 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
129 commits
Select commit Hold shift + click to select a range
827d67d
Install BL8
Aug 16, 2024
2750c27
Fix constraints
Aug 20, 2024
6ea5c87
Fix the item page
Sep 17, 2024
8645047
Merge pull request #430 from trln/TD-1342
seanaery Sep 18, 2024
24b0691
Add tools to the index page
Sep 20, 2024
cf760ae
Merge pull request #431 from trln/TD-1343
lfarrell Sep 23, 2024
257e92c
Update skip links to use BL component
lfarrell Sep 23, 2024
912dc45
Merge pull request #432 from trln/skip-links
kazymovae Sep 23, 2024
db60b69
Update search result layout for BL 8
lfarrell Sep 23, 2024
ee57006
Merge pull request #433 from trln/search-result-layout
kazymovae Sep 23, 2024
b858c26
Remove workarounds for ruby 2.x, bootstrap 4 and rails versions below 7
lfarrell Sep 25, 2024
89170cc
Create helper method for trln solr doc url
lfarrell Sep 25, 2024
037bcfb
Merge pull request #434 from trln/TD-1354
kazymovae Sep 25, 2024
ac484c3
Merge pull request #435 from trln/TD-1346
kazymovae Sep 27, 2024
53f6d3f
Get basic Javascript working in BL8 using Sprockets. Closes TD-1355.
seanaery Oct 1, 2024
dec1f1f
Merge pull request #438 from trln/TD-1355-js-with-sprockets
kazymovae Oct 1, 2024
afca196
Recreate removed jumbotron class
lfarrell Sep 27, 2024
14bba0a
BS 5 updates for forms, badges, buttons and close button
lfarrell Sep 27, 2024
6b68f78
BS 5 updates for tooltips and utilities
lfarrell Sep 27, 2024
2c7e730
BS 5 updates for helpers
lfarrell Sep 27, 2024
6691e9b
BS 5 updates for bootstrap data attributes
lfarrell Sep 27, 2024
eaf7150
BS 5 grid updates
lfarrell Sep 27, 2024
2ca5c9a
BS 5 sass updates
lfarrell Sep 27, 2024
2789a71
Fix issue with main search box being too small.
lfarrell Oct 2, 2024
3e7ebec
Remove bg-info class
lfarrell Oct 2, 2024
416121b
Merge pull request #437 from trln/BL-8-css
seanaery Oct 3, 2024
f7ce21e
Get auto-complete working again.
lfarrell Oct 3, 2024
614bd00
Remove generator overrides as BL 8 doesn't ship an autocomplete.js fi…
lfarrell Oct 3, 2024
6fc4038
Merge pull request #440 from trln/auto-complete
seanaery Oct 3, 2024
7870568
Remove partial that's now in core BL.
lfarrell Oct 4, 2024
1794e45
Merge pull request #441 from trln/bookmarks
seanaery Oct 4, 2024
ea162e0
Fix various build issues (esp JS related), improving support for Ruby…
seanaery Oct 4, 2024
67784bd
Bump the default Docker ruby version to 3.1.6 (3.0 is EOL).
seanaery Oct 7, 2024
8ffd9bb
Merge pull request #442 from trln/TD-1358-docker-assets
kazymovae Oct 7, 2024
456f712
TD-1337 restore local filter (#436)
zinc-glaze Oct 9, 2024
b893d12
Add icons to tools
Oct 1, 2024
64426ba
Merge pull request #439 from trln/TD-1349-Tools-on-the-item-page-need…
lfarrell Oct 9, 2024
b27902f
Just return the response documents and not the entire solr response
lfarrell Oct 9, 2024
7cb4b08
Merge pull request #444 from trln/action-tools
kazymovae Oct 10, 2024
7bcde67
Fix layout of citation modal
lfarrell Oct 10, 2024
ef96ea4
Merge pull request #445 from trln/citation-modal
kazymovae Oct 10, 2024
b69d6c1
Pin rails to 7.1.x as rails 7.2.x doesn't support ruby 3.0.x
lfarrell Oct 10, 2024
262054e
Merge pull request #446 from trln/rails-7-pin
kazymovae Oct 10, 2024
77eca4b
Make per page widget compatible with ruby 3.0.x
lfarrell Oct 10, 2024
e12a610
Update screen reader only classes and fix spacing of email and text a…
lfarrell Oct 11, 2024
188e40c
Fix display of range limit submit button
lfarrell Oct 11, 2024
fa7e046
Merge pull request #447 from trln/ruby3-per-page
seanaery Oct 11, 2024
313d95f
Remove BS 4 classes that interfere with skip link display
lfarrell Oct 11, 2024
4c0c365
Merge pull request #449 from trln/range-limit-button
seanaery Oct 11, 2024
08f3e2a
Merge pull request #450 from trln/css-cleanup
seanaery Oct 11, 2024
0c3e700
Merge pull request #448 from trln/skip-links-redux
seanaery Oct 11, 2024
b60e9a8
Improve BetterErrors support, especially when using Docker. Closes TD…
seanaery Oct 14, 2024
8b4327f
Merge pull request #451 from trln/TD-1132-better-errors
kazymovae Oct 15, 2024
a7be042
Fix missing title on search page
Oct 17, 2024
0c68cc7
Merge pull request #453 from trln/TD-1340-Title-on-the-main-page
lfarrell Oct 18, 2024
2047641
Fix layout of search thumbnails
lfarrell Oct 18, 2024
af0cf8f
Merge pull request #454 from trln/thumbnail-fix
seanaery Oct 18, 2024
1a9bee8
Replace sass-rails & sassc-rails with dartsass-sprockets, and accommo…
seanaery Oct 18, 2024
837504b
Merge pull request #456 from trln/TD-1345-dartsass-sprockets
kazymovae Oct 18, 2024
f66bb05
Restore Access Type (Available Online) facet (TD-1368)
zinc-glaze Oct 23, 2024
6729eb0
Remove a bunch of old facet style hacks & ensure checkbox facets use …
seanaery Oct 23, 2024
2df822f
Merge pull request #457 from trln/facet-style-followup
kazymovae Oct 23, 2024
ab22123
Remove app/views/catalog/_constraints_element.html
Oct 23, 2024
c951b54
Merge pull request #458 from trln/TD-1377-Remove-app/views/catalog/_c…
seanaery Oct 23, 2024
e24325d
Merge branch 'main' into TD-1376-holdings-bs5-a11y
seanaery Oct 25, 2024
dbebbb7
Merge pull request #460 from trln/TD-1376-holdings-bs5-a11y
kazymovae Oct 25, 2024
f22ffda
Remove an empty metadata DL field at the end of the metadata display …
Oct 25, 2024
c68b1cd
Merge pull request #461 from trln/TD-1370-An-empty-metadata-DL-field
seanaery Oct 28, 2024
386148c
override Blacklight CSS to remove underlines from hierarchical facet …
zinc-glaze Oct 31, 2024
a2c298e
Merge pull request #462 from trln/TD-1370-facet-links
kazymovae Oct 31, 2024
ea7ba91
clean up rendering and on-click behavior for trln/local toggle; resol…
zinc-glaze Nov 5, 2024
da5a4b4
Merge pull request #464 from trln/TD-1371-hide-toggle-icons
kazymovae Nov 6, 2024
28e45fb
Fix unit tests and rubocop
Oct 29, 2024
52db2ef
Get GitHub CI passing for Ruby 3.0, 3.1, 3.2, 3.3
seanaery Nov 7, 2024
12c075b
Merge pull request #466 from trln/TD-1300-fix-ci
adjam Nov 8, 2024
702ffe5
move def of isInViewport function to safer scope
Nov 11, 2024
a4e1ca1
Merge pull request #468 from trln/rescope-viewport-js-function
kazymovae Nov 11, 2024
a76a6cf
Add dependency trln-chosen-rails 1.30.0
Nov 11, 2024
fb86284
Merge pull request #469 from trln/update-chosen-rails
seanaery Nov 11, 2024
73bedfb
add CSS to make Advanced Search Publication Year input fields shorter…
zinc-glaze Nov 15, 2024
4716a96
Merge pull request #470 from trln/TD-1383-pub-year-input-fields
kazymovae Nov 15, 2024
ccf303b
Fix DartSass-Sprockets compilation errors in production ENV.
seanaery Nov 19, 2024
4c4ef67
Merge pull request #471 from trln/fix-prod-dartsass-precompile
adjam Nov 19, 2024
c8a86ec
Upgrade blacklight_range_limit plugin to v9.0.0.beta so it works with…
seanaery Nov 20, 2024
d6dc461
Merge pull request #473 from trln/TD-1382-blacklight-range-limit
kazymovae Nov 21, 2024
44e286f
Replace deprecated lighten() & darken() with BS5 tint-color() & shade…
seanaery Nov 22, 2024
59c3aeb
Merge pull request #474 from trln/TD-1379-sass-deprecations
kazymovae Dec 3, 2024
9690e04
Remove workarounds for dartsass-sprockets prod compilation added in #471
seanaery Dec 4, 2024
ea5c143
Update blacklight_range_limit to v9.0.0.beta2
seanaery Dec 4, 2024
7e7df6b
Merge pull request #475 from trln/update-blacklight-and-range-limit
kazymovae Dec 6, 2024
622e057
Bugfix for BL8 bookmark actions; replace @document_list. Fixes TD-1390.
seanaery Dec 10, 2024
cc5b972
Fix RSS feeds. Fixes TD-1392.
seanaery Dec 10, 2024
bf8aa8f
Fix caching for homepage Solr query & advanced search facet query. Fi…
seanaery Dec 10, 2024
d7600b8
Fix the color of the bookmark action buttons.
Dec 10, 2024
f9787b7
Merge pull request #476 from trln/TD-1390-bugfix-bookmarks-page
kazymovae Dec 11, 2024
bc0ff53
Merge pull request #477 from trln/TD-1392-rss
kazymovae Dec 11, 2024
77a1195
Merge pull request #478 from trln/TD-1393-bugfix-caching
kazymovae Dec 11, 2024
019dd06
Merge pull request #479 from trln/TD-1389-Fix-the-color-of-the-bookma…
seanaery Dec 11, 2024
3042206
Allow configured advanced search facets & home facets to be different…
seanaery Dec 12, 2024
736bbd1
Merge pull request #480 from trln/TD-1394-advanced-subject-media
kazymovae Dec 12, 2024
cc878df
Fix WAVE-flagged accessibility issues in Advanced Search page. Fixes …
seanaery Dec 12, 2024
482fddc
Merge pull request #481 from trln/advanced-search-a11y
kazymovae Dec 13, 2024
259b097
Fix keyboard nav & icons for Chosen fields in Advanced Search. Fixes …
seanaery Dec 13, 2024
8822548
Use empty alt tags for thumbnail images rather than repetitive non-de…
seanaery Dec 16, 2024
4032d96
Merge pull request #482 from trln/TD-1402-vendor-chosen
kazymovae Dec 16, 2024
adff78e
Refactors trln/local toggle for accessibility. Fixes TD-1403.
seanaery Dec 17, 2024
241d6e5
Fix color accessibility in selected constraints; fixes TD-1404.
seanaery Dec 17, 2024
6bb3238
Fix masthead a11y warning; remove duplicate link. Fixes TD-1399.
seanaery Dec 17, 2024
b05a5dd
Followup bugfix to remove skip to search on *only* advanced search pa…
seanaery Dec 17, 2024
ef45c1b
Merge pull request #483 from trln/TD-1406-thumbnail-empty-alt
kazymovae Dec 18, 2024
dc87334
Merge pull request #485 from trln/TD-1404-constraints-a11y
kazymovae Dec 18, 2024
a5d6092
Merge pull request #484 from trln/TD-1403-orphaned-form-labels
kazymovae Dec 18, 2024
73d159a
Merge pull request #487 from trln/TD-1396-followup-skip-link
kazymovae Dec 18, 2024
b2b41a3
Merge pull request #486 from trln/TD-1399-masthead-fix
kazymovae Dec 18, 2024
61d5c29
Bugfix for chosen.css - was not compiling in production env
seanaery Dec 18, 2024
ca3b58c
Merge pull request #488 from trln/bugfix-chosen-css
kazymovae Dec 18, 2024
dd9bf2e
Bugfix for share bookmarks URLs; permit doc_ids parameter. Fixes TD-1…
seanaery Dec 18, 2024
478a5f7
Merge pull request #489 from trln/TD-1391-share-bookmarks
zinc-glaze Dec 18, 2024
3fbb85c
Permit id & debug parameters to be used. Fixes TD-1316.
seanaery Dec 18, 2024
9229722
Merge pull request #490 from trln/TD-1316-permit-parameters
kazymovae Dec 19, 2024
6fa2c58
Fix skip link display during keyboard navigation. Fixes TD-1412.
seanaery Dec 19, 2024
83868be
Bugfix for checking Available Online from homepage. Fixes TD-1413.
seanaery Dec 19, 2024
8995f7d
Merge pull request #492 from trln/TD-1413-bugfix-checkbox-facet
kazymovae Dec 19, 2024
1b66c5c
Merge pull request #491 from trln/TD-1412-skip-link-component
kazymovae Dec 19, 2024
90276ad
Quiet Sass deprecation warnings from dependencies like Bootstrap. Fol…
seanaery Jan 7, 2025
0412c60
Use stable 9.x release of blacklight_range_limit plugin, no longer in…
seanaery Jan 8, 2025
f15b9de
Merge pull request #493 from trln/TD-1379-suppress-sass-warnings
kazymovae Jan 8, 2025
696d2c7
Merge pull request #494 from trln/blacklight_range_limit_9
kazymovae Jan 8, 2025
f1a9e11
Bump version
Jan 9, 2025
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
Binary file added .DS_Store
Binary file not shown.
12 changes: 7 additions & 5 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,27 @@ on:
jobs:
tests:
runs-on: ubuntu-latest
env:
ENGINE_CART_RAILS_OPTIONS: '--skip-javascript --skip-bundle'
strategy:
fail-fast: false
matrix:
ruby: ['3.0', '3.1', '3.2', '3.3']
name: Ruby ${{ matrix.ruby }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}

- name: Install dependencies
run: bundle install

- name: Run rubocop
run: rake rubocop
run: rake rubocop

- name: Generate a Rails testing application
run: rake engine_cart:generate
Expand Down
5 changes: 4 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ inherit_from: .rubocop_todo.yml
require: rubocop-rspec

AllCops:
TargetRubyVersion: 2.6
TargetRubyVersion: 3.0
# TODO: review this later
NewCops: disable
Exclude:
Expand Down Expand Up @@ -116,3 +116,6 @@ Lint/MissingCopEnableDirective:

Lint/ConstantDefinitionInBlock:
Enabled: false

RSpec/IndexedLet:
Enabled: false
11 changes: 8 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG RUBY_VERSION=2.7.6
ARG RUBY_VERSION=3.1.6
FROM ruby:${RUBY_VERSION} AS app_bootstrap

RUN apt-get update && apt-get install -y nodejs vim less
Expand All @@ -18,15 +18,20 @@ FROM app_bootstrap AS runnable
COPY --from=builder /gems /gems
COPY ./bundler_config.rb .

# This line is a workaround that seems to be needed when using
# using ruby:3.1.x Docker images, to prevent this error:
# `check_for_activated_spec!': You have already activated error_highlight 0.3.0, but your Gemfile requires error_highlight 0.6.0 ...
RUN gem update error_highlight

RUN $(./bundler_config.rb path /gems)

WORKDIR /app

EXPOSE 3000

ENV ENGINE_CART_RAILS_OPTIONS="--skip-webpack-install --skip-javascript"
ENV ENGINE_CART_RAILS_OPTIONS="--skip-webpack-install --skip-javascript --skip-bundle"

ENV BOOTSTRAP_VERSION="~> 4.1"
ENV BOOTSTRAP_VERSION="~> 5.3"

# allows setting options for caching HTTP operations
# used in unit testing with 'vcr', a ruby framework for recording
Expand Down
22 changes: 11 additions & 11 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ gemspec
# engine_cart stanza: 2.5.0
# the below comes from engine_cart, a gem used to test this Rails engine gem in the context of a Rails app.
file = File.expand_path('Gemfile', ENV['ENGINE_CART_DESTINATION'] || ENV['RAILS_ROOT'] || File.expand_path('.internal_test_app', File.dirname(__FILE__)))

if File.exist?(file)
begin
eval_gemfile file
Expand All @@ -28,23 +29,22 @@ if File.exist?(file)
else
Bundler.ui.warn "[EngineCart] Unable to find test application dependencies in #{file}, using placeholder dependencies"

# TRLN CUSTOMIZATION:
# We'll use the Rails --skip-javascript flag so when generated we
# won't get the default JS files in app/javascript. We are sticking
# with Sprockets for now; our JS is in app/assets/javascripts.
# We also run --skip-bundle to avoid running `bundle install` upon the
# initial creation of the Rails app. We'll run it later in our generator
# steps after customizing the Gemfile.
ENV['ENGINE_CART_RAILS_OPTIONS'] = '--skip-javascript --skip-bundle'

if ENV['RAILS_VERSION']
if ENV['RAILS_VERSION'] == 'edge'
gem 'rails', github: 'rails/rails'
ENV['ENGINE_CART_RAILS_OPTIONS'] = '--edge --skip-turbolinks'
ENV['ENGINE_CART_RAILS_OPTIONS'] = '--edge --skip-turbolinks --skip-javascript'
else
gem 'rails', ENV['RAILS_VERSION']
end

case ENV['RAILS_VERSION']
when /^6.0/
gem 'sass-rails', '>= 6'
gem 'webpacker', '~> 4.0'
when /^5.[12]/
gem 'sass-rails', '~> 5.0'
gem 'sprockets', '~> 3.7'
gem 'thor', '~> 0.20'
end
end
end
# END ENGINE_CART BLOCK
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ gem 'trln_argon', git: 'https://github.com/trln/trln_argon'
3. Run the following:

$ bundle install
$ bundle exec rails generate blacklight:install --devise --skip-solr
$ bundle exec rails generate blacklight:install --devise --skip-solr --skip-javascript
$ bundle exec rails generate trln_argon:install
$ bundle exec rake db:migrate

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.4.5
3.0.0
10 changes: 7 additions & 3 deletions app/assets/javascripts/trln_argon/advanced_search_scope.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
Blacklight.onLoad(function() {
$(window).on('load', function(){

//remove default mast search to fix duplicate IDs
// remove default mast search to fix duplicate IDs
$(".blacklight-catalog-advanced_search #search-navbar").remove();
$(".blacklight-trln-advanced_search #search-navbar").remove();


// remove the skip link that leads to that mast search field
$(".blacklight-catalog-advanced_search #skip-link a[href='#search_field']").remove();
$(".blacklight-trln-advanced_search #skip-link a[href='#search_field']").remove();

// change adv search scope
$(".blacklight-trln-advanced_search").length > 0 ? $('#option_trln').attr('checked',true) : $('#option_catalog').attr('checked',true);

$("input[type='radio'][name='option']").change(function() {
var action = $(this).val();
$(".advanced").attr("action", "/" + action);
Expand Down
12 changes: 2 additions & 10 deletions app/assets/javascripts/trln_argon/advanced_search_select.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
Blacklight.onLoad(function() {
$('.advanced-search-facet-select').chosen({
allow_single_deselect: true,
no_results_text: 'No results matched'
no_results_text: 'No results matched',
width: '100%'
});

resizeChosen();
jQuery(window).on('resize', resizeChosen);
});

function resizeChosen() {
$(".chosen-container").each(function() {
$(this).attr('style', 'width: 100%');
});
}
2 changes: 1 addition & 1 deletion app/assets/javascripts/trln_argon/bookmark_share.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ $(document).on('click', '#share_bookmarksLink', function( e ){


// create modal
$('#content').append('<div class="modal fade" id="bookmark-modal" tabindex="-1" role="dialog"><div class="modal-dialog" role="document"><div class="modal-content"><div class="modal-header"><h4 class="modal-title">' + shareBookmarksText + '</h4><button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button></div><div class="modal-body"><p class="form-text">' + shareBookmarksHelperText + '</p><div class="input-group"><input id="sharing-url-holder" type="text" class="form-control" data-autoselect="" value="' + bookmarkShareURL + '" aria-label="' + shareBookmarksText + '" readonly=""><span class="input-group-btn"><button id="copy-to-clipboard" class="btn btn-outline-secondary" type="button" data-toggle="tooltip" data-placement="bottom" title="Copy to clipboard"><i class="fa fa-clipboard" aria-hidden="true"></i></button></span></div></div><div class="modal-footer"><button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Close</button></div></div></div></div>');
$('#content').append('<div class="modal fade" id="bookmark-modal" tabindex="-1" role="dialog"><div class="modal-dialog" role="document"><div class="modal-content"><div class="modal-header"><h4 class="modal-title">' + shareBookmarksText + '</h4><button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button></div><div class="modal-body"><p class="form-text">' + shareBookmarksHelperText + '</p><div class="input-group"><input id="sharing-url-holder" type="text" class="form-control" data-autoselect="" value="' + bookmarkShareURL + '" aria-label="' + shareBookmarksText + '" readonly=""><span class="input-group-btn"><button id="copy-to-clipboard" class="btn btn-outline-secondary" type="button" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Copy to clipboard"><i class="fa fa-clipboard" aria-hidden="true"></i></button></span></div></div><div class="modal-footer"><button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal">Close</button></div></div></div></div>');

// open modal
$('#bookmark-modal').modal('show');
Expand Down
67 changes: 33 additions & 34 deletions app/assets/javascripts/trln_argon/enable_facet_checkbox.js
Original file line number Diff line number Diff line change
@@ -1,45 +1,44 @@
Blacklight.onLoad(function() {
Blacklight.onLoad(function () {
/**
* Ensures that checkbox-only facets (currently, access_type which is either
* online or not)
* (a) do not display a header and
* (b) automatically select/deselect based on whether the value of the checkbox
* (b) automatically select/deselect based on whether the value of the checkbox
* changes.
*/
$(window).on('load', function() {
$('#facet-panel-collapse .facet-checkbox-wrapper').each(
function(index, element) {
var wrapper = $(this);

// hide the header
wrapper.closest('div.card').find('.facet-field-heading').hide();

var fieldName = wrapper.data('facetField');
if ( !fieldName ) {
return;
}
var fieldValue = wrapper.data('checkboxField');
var field = wrapper.find(":checkbox");
var parameter = "f[" + fieldName + "][]";
var currentURL = new URL(window.location);
var currentParams = currentURL.searchParams;
if ( currentParams.has(parameter) ) {
field.attr("checked", "checked");
$(window).on('load', function () {
// Target the updated facet-checkbox list structure
$('#facet-panel-collapse .blacklight-facet-checkboxes li').each(function (index, element) {
var listItem = $(this);

// hide the header
listItem.closest('div.card').find('.facet-field-heading').hide();

var fieldName = "access_type_f";
var fieldValue = listItem.find('input').val();
var field = listItem.find(":checkbox");
var parameter = "f_inclusive[" + fieldName + "][]";

var currentURL = new URL(window.location);
var currentParams = currentURL.searchParams;

// Check the checkbox if it exists in the URL
if (currentParams.has(parameter) && currentParams.getAll(parameter).includes(fieldValue)) {
field.prop("checked", true);
} else {
field.prop("checked", false);
}

// Add change listener to reload the page when checkbox is checked/unchecked
field.on('change', function () {
if (field.is(':checked')) {
currentParams.append(parameter, fieldValue);
} else {
field.removeAttr("checked");
currentParams.delete(parameter);
}
field.on('change', () => {
if ( field.is(':checked')) {
currentParams.set(parameter, fieldValue);
currentURL.searchParams = currentParams;
window.location.searchParams = currentParams;
} else {
currentParams.delete(parameter);
currentURL.searchParams = currentParams;
}
console.log("sending to ", currentURL);
window.location.assign(currentURL.toString());
});
currentURL.search = currentParams.toString();
window.location.assign(currentURL.toString());
});
});
});
}); // END Blacklight.onLoad
21 changes: 12 additions & 9 deletions app/assets/javascripts/trln_argon/expand_contract.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
// test if an element is in the viewport
$.fn.isInViewport = function() {
var elementTop = $(this).offset().top;
var elementBottom = elementTop + $(this).outerHeight();
var viewportTop = $(window).scrollTop();
var viewportBottom = viewportTop + $(window).height();
return elementBottom > viewportTop && elementTop < viewportBottom;
};

Blacklight.onLoad(function() {

/**
* Tests whether an element is vertically
* contained within the current viewport
**/
$.fn.isInViewport = function() {
var elementTop = $(this).offset().top;
var elementBottom = elementTop + $(this).outerHeight();
var viewportTop = $(window).scrollTop();
var viewportBottom = viewportTop + $(window).height();
return elementBottom > viewportTop && elementTop < viewportBottom;
};

$("#documents .hider, #holdings .hider").click(function(evt) {
evt.preventDefault();
var theAnchorID = $(this).attr('href');
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/trln_argon/location_facet.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Blacklight.onLoad(function() {
facetLocationWrapper.find('ul.facet-hierarchy > .twiddle-open > ul > li').slice( parseInt(locationFacetLimit) ).hide();

// add 'more' and 'less' button at end
facetLocationWrapper.find('ul.facet-hierarchy > .twiddle-open > ul').append( "<li role='treeitem' class='location-more-toggle-wrapper'><a class='more_locations_link'>more <span class='sr-only'>Locations</span> »</a><a class='less_locations_link' style='display: none;'>less <span class='sr-only'>Locations</span> »</a></li>" );
facetLocationWrapper.find('ul.facet-hierarchy > .twiddle-open > ul').append( "<li role='treeitem' class='location-more-toggle-wrapper'><a class='more_locations_link'>more <span class='visually-hidden'>Locations</span> »</a><a class='less_locations_link' style='display: none;'>less <span class='visually-hidden'>Locations</span> »</a></li>" );

// click 'more' to show all
facetLocationWrapper.find('.more_locations_link').click(function() {
Expand Down
4 changes: 2 additions & 2 deletions app/assets/javascripts/trln_argon/results_count_for_toggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ Blacklight.onLoad(function() {
}
}

fetch_and_display_toggle_count($('.blacklight-catalog-index #trln-toggle .toggle-trln label'));
fetch_and_display_toggle_count($('.blacklight-trln-index #trln-toggle .toggle-local label'));
fetch_and_display_toggle_count($('.blacklight-catalog-index #trln-toggle .toggle-trln .toggle-label'));
fetch_and_display_toggle_count($('.blacklight-trln-index #trln-toggle .toggle-local .toggle-label'));
});
2 changes: 1 addition & 1 deletion app/assets/javascripts/trln_argon/trln_argon.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//= require trln_argon/progressive_links.js
//= require trln_argon/physical_media_facet.js
//= require bootstrap
//= require chosen-jquery
//= require chosen.jquery.js
//= require blacklight/hierarchy/hierarchy.js
//= require trln_argon/location_facet.js
//= require trln_argon/advanced_search_select.js
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ h2.query-criteria-heading label {
width: 100%;
}

@include media-breakpoint-down(xs) {
@include media-breakpoint-down(sm) {
.submit-buttons {
margin-top: 15px;
text-align: left;
Expand All @@ -53,8 +53,6 @@ h2.query-criteria-heading label {
}

.sorting {
display: inline-flex;

label {
margin-right: 8px;
font-weight: 700;
Expand Down
2 changes: 1 addition & 1 deletion app/assets/stylesheets/trln_argon/trln_argon.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
@import 'trln_argon/trln_argon_variables_defaults';

/* trln_argon dependences: blacklight_advanced_search, blacklight_range_limit, etc. */
/* trln_argon dependences: bootstrap, blacklight, plugins, etc. */
@import 'trln_argon/trln_argon_dependencies';

/* additional trln_argon stylesheets */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

@import 'bootstrap';

@import 'blacklight/blacklight';

@import 'blacklight_advanced_search';

@import 'blacklight/hierarchy/hierarchy';
Expand Down
Loading
Loading