Skip to content

Commit

Permalink
πŸ› Bring in blacklight_range_limit js files
Browse files Browse the repository at this point in the history
When we have the blacklight_range_limit require in the application.js
before the require for blacklight/blacklight, we got a Blacklight not
found error (underestandably).  However when we put it under the
blacklight require then we got a typeahead error.  I couldn't get both
to work right so instead I'm bringing over the js files from the range
limit gem into our app and requiring them in the application.js.
  • Loading branch information
kirkkwang committed Feb 21, 2024
1 parent 6e7d920 commit 1065636
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
//= require codemirror-autorefresh
//= require codemirror/modes/css
//= require jquery3
//= require 'blacklight_range_limit'
//= require range_limit_distro_facets
//= require range_limit_slider
//= require jquery_ujs
//= require jquery.fontselect
//= require flot/jquery.flot.js
//= require flot/jquery.flot.selection.js
//= require bootstrap-slider
//= require bootstrap/tooltip
//= require_tree ./blacklight_range_limit
//= require dataTables/jquery.dataTables
//= require dataTables/bootstrap/3/jquery.dataTables.bootstrap
//= require stat_slider
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

// takes a string and parses into an integer, but throws away commas first, to avoid truncation when there is a comma
// use in place of javascript's native parseInt
!function(global) {
'use strict';

var previousBlacklightRangeLimit = global.BlacklightRangeLimit;

function BlacklightRangeLimit(options) {
this.options = options || {};
}

BlacklightRangeLimit.noConflict = function noConflict() {
global.BlacklightRangeLimit = previousBlacklightRangeLimit;
return BlacklightRangeLimit;
};

BlacklightRangeLimit.parseNum = function parseNum(str) {
str = String(str).replace(/[^0-9]/g, '');
return parseInt(str, 10);
};

global.BlacklightRangeLimit = BlacklightRangeLimit;
}(this);

0 comments on commit 1065636

Please sign in to comment.