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

Update to support blacklight 7 #50

Merged
merged 6 commits into from
Jan 14, 2020
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
1 change: 1 addition & 0 deletions app/assets/images/blacklight/heatmaps.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions app/assets/javascripts/blacklight_heatmaps/viewers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ Blacklight.onLoad(function () {
initialize: function (el, options) {
var _this = this;
var $el = $(el);
var requestUrl = $el.data().searchUrl + '&format=json';
var requestUrl = $el.data().searchUrl + '&format=heatmaps';
var geometryField = $el.data().geometryField;
var template = $el.data().sidebarTemplate;
var colorRamp = $el.data().colorRamp;

// Blank out page link content first and disable pagination
$('#sortAndPerPage .page_links').html('');
$('#sortAndPerPage .page-links').html('');
$('ul.pagination li').addClass('disabled');

var map = L.map($el[0].id).setView([0, 0], 1);
Expand Down Expand Up @@ -64,7 +64,7 @@ Blacklight.onLoad(function () {
sidebar.setContent(html);

var docCount = e.response.pages.total_count;
$('#sortAndPerPage .page_links').html(
$('#sortAndPerPage .page-links').html(
parseInt(docCount).toLocaleString() + ' ' +
_this.pluralize(docCount, 'item') + ' found'
);
Expand Down
12 changes: 2 additions & 10 deletions app/helpers/blacklight/maps_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ def sidebar_template
<div class='media'>
<div class='media-body'>
<h3 class='media-heading'>
<a href=\"#{document_path}\"}>
{#{blacklight_config.index.title_field}}
<a href=\"{url}\"}>
{title}
</a>
</h3>
</div>
Expand All @@ -34,14 +34,6 @@ def sidebar_template

private

##
# Document path used for creating client side links to documents from a
# template
# @return String
def document_path
"#{search_catalog_path}/{#{blacklight_config.document_unique_id_param}}"
end

##
# Data attributes used in displaying the index map
# @return Hash
Expand Down
11 changes: 11 additions & 0 deletions app/views/catalog/index.heatmaps.jbuilder
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
presenter = Blacklight::JsonPresenter.new(@response, blacklight_config)

json.response do
json.docs(presenter.documents) do |document|
json.url polymorphic_url(url_for_document(document))
json.title index_presenter(document).heading
end

json.facet_heatmaps @response['facet_counts']['facet_heatmaps']
json.pages presenter.pagination_info
end
10 changes: 0 additions & 10 deletions app/views/catalog/index.json.jbuilder

This file was deleted.

2 changes: 1 addition & 1 deletion blacklight_heatmaps.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Gem::Specification.new do |s|
s.test_files = Dir['spec/**/*']

s.add_dependency 'rails', '>= 4.2.6', '< 6'
s.add_dependency 'blacklight', '~> 6.0'
s.add_dependency 'blacklight', '~> 7.0'
s.add_dependency 'leaflet-rails', '~> 1.2.0'
s.add_dependency 'leaflet-sidebar-rails', '~> 0.2'

Expand Down
1 change: 1 addition & 0 deletions lib/blacklight_heatmaps/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class Engine < ::Rails::Engine
isolate_namespace BlacklightHeatmaps
initializer 'blacklight-maps.helpers' do |app|
ActionView::Base.send :include, Blacklight::MapsHelper
Mime::Type.register 'application/vnd.heatmaps+json', :heatmaps
end
end
end
1 change: 1 addition & 0 deletions lib/generators/blacklight_heatmaps/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def configuration
"\n # Basemaps configured include: 'positron', 'darkMatter', 'OpenStreetMap.HOT'" \
"\n config.basemap_provider = 'positron'" \
"\n config.show.partials.insert(1, :show_leaflet_map)" \
"\n config.index.respond_to.heatmaps = true" \
"\n config.view.heatmaps.partials = []" \
"\n #Heatmap color ramp. For best results, use http://colorbrewer2.org or http://tristen.ca/hcl-picker/#/hlc/5/1" \
"\n config.view.heatmaps.color_ramp = ['#ffffcc', '#a1dab4', '#41b6c4', '#2c7fb8', '#253494']" \
Expand Down
902 changes: 326 additions & 576 deletions solr/conf/schema.xml

Large diffs are not rendered by default.

Loading