From bca70aaada62d6418b0f35e2f1b2102869fbfe5a Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Mon, 4 Jan 2021 14:21:12 -0600 Subject: [PATCH 01/17] Search: do not filter suppressed_b true docs from admin.api Fixes: https://github.com/BTAA-Geospatial-Data-Project/geomg/issues/94 --- app/controllers/admin/api_controller.rb | 3 ++- .../concerns/geoblacklight/spatial_search_behavior.rb | 2 +- test/controllers/admin/api_controller_test.rb | 6 ++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/controllers/admin/api_controller.rb b/app/controllers/admin/api_controller.rb index 20d0a7faa..2c1e80eed 100644 --- a/app/controllers/admin/api_controller.rb +++ b/app/controllers/admin/api_controller.rb @@ -45,7 +45,8 @@ class ApiController < ApplicationController config.default_solr_params = { :start => 0, 'q.alt' => '*:*', - 'bf' => ['if(exists(b1g_child_record_b),0,100)^0.5'] + 'bf' => ['if(exists(b1g_child_record_b),0,100)^0.5'], + 'admin.api' => true } config.default_per_page = 20 # Works! diff --git a/app/models/concerns/geoblacklight/spatial_search_behavior.rb b/app/models/concerns/geoblacklight/spatial_search_behavior.rb index 7e0ad19d2..380b3aeed 100644 --- a/app/models/concerns/geoblacklight/spatial_search_behavior.rb +++ b/app/models/concerns/geoblacklight/spatial_search_behavior.rb @@ -64,7 +64,7 @@ def hide_suppressed_records(solr_params) return if solr_params[:q]&.include?('{!lucene}layer_slug_s:') solr_params[:fq] ||= [] - solr_params[:fq] << '-suppressed_b: true' + solr_params[:fq] << '-suppressed_b: true' unless solr_params['admin.api'] end end end diff --git a/test/controllers/admin/api_controller_test.rb b/test/controllers/admin/api_controller_test.rb index 1fa477eb5..846c22961 100644 --- a/test/controllers/admin/api_controller_test.rb +++ b/test/controllers/admin/api_controller_test.rb @@ -6,5 +6,11 @@ class ApiControllerTest < ActionDispatch::IntegrationTest get '/admin/api.json' assert_response :success end + + test "should include admin.api in solr_params" do + default_solr_params = Admin::ApiController.blacklight_config.default_solr_params + + assert_includes(default_solr_params, 'admin.api') + end end end From 6cba41d5b70495a972b2cc1bf5c81ac231887d2d Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Fri, 8 Jan 2021 15:17:47 -0600 Subject: [PATCH 02/17] AdminAPI: add advanced_search_facets json Addresses https://github.com/BTAA-Geospatial-Data-Project/geomg/issues/100 --- app/controllers/admin/api_controller.rb | 21 ++++- .../api/advanced_search_facets.json.jbuilder | 76 +++++++++++++++++++ config/routes.rb | 1 + test/controllers/admin/api_controller_test.rb | 5 ++ 4 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 app/views/admin/api/advanced_search_facets.json.jbuilder diff --git a/app/controllers/admin/api_controller.rb b/app/controllers/admin/api_controller.rb index 2c1e80eed..2e0033c9d 100644 --- a/app/controllers/admin/api_controller.rb +++ b/app/controllers/admin/api_controller.rb @@ -29,7 +29,7 @@ class ApiController < ApplicationController config.advanced_search[:url_key] ||= 'advanced' config.advanced_search[:query_parser] ||= 'edismax' config.advanced_search[:form_solr_parameters] ||= {} - config.advanced_search[:form_solr_parameters]['facet.field'] ||= %W[dct_provenance_s dc_type_sm b1g_genre_sm] + config.advanced_search[:form_solr_parameters]['facet.field'] ||= %W[dct_provenance_s dc_type_sm b1g_genre_sm b1g_code_s dct_isPartOf_sm] config.advanced_search[:form_solr_parameters]['facet.query'] ||= '' config.advanced_search[:form_solr_parameters]['facet.limit'] ||= -1 config.advanced_search[:form_solr_parameters]['facet.sort'] ||= 'index' @@ -344,5 +344,24 @@ def fetch end end end + + # Administrative view of adv search facets + def advanced_search_facets + # We want to find the facets available for the current search, but: + # * IGNORING current query (add in facets_for_advanced_search_form filter) + # * IGNORING current advanced search facets (remove add_advanced_search_to_solr filter) + @response, _ = search_service.search_results do |search_builder| + search_builder.except(:add_advanced_search_to_solr).append(:facets_for_advanced_search_form) + end + + @response + + respond_to do |format| + format.json do + @presenter = Blacklight::JsonPresenter.new(@response, + blacklight_config) + end + end + end end end diff --git a/app/views/admin/api/advanced_search_facets.json.jbuilder b/app/views/admin/api/advanced_search_facets.json.jbuilder new file mode 100644 index 000000000..99e73ad42 --- /dev/null +++ b/app/views/admin/api/advanced_search_facets.json.jbuilder @@ -0,0 +1,76 @@ +# frozen_string_literal: true + +json.data do + json.array! @presenter.documents do |document| + document_url = polymorphic_url(url_for_document(document)) + json.id document.id + json.type document[blacklight_config.view_config(:index).display_type_field] + json.attributes do + doc_presenter = index_presenter(document) + + doc_presenter.fields_to_render.each do |field_name, field| + json.partial! 'field', field: field, + field_name: field_name, + document_url: document_url, + doc_presenter: doc_presenter + end + end + + json.links do + json.self document_url + end + end +end + +json.included do + json.array! @presenter.search_facets do |facet| + json.type 'facet' + json.id facet.name + json.attributes do + facet_config = facet_configuration_for_field(facet.name) + json.label facet_field_label(facet_config.key) + json.items do + json.array! facet.items do |item| + json.id + json.attributes do + json.label item.label + json.value item.value + json.hits item.hits + end + json.links do + if facet_in_params?(facet.name, item.value) + json.remove search_action_path(search_state.remove_facet_params(facet.name, item.value)) + else + json.self path_for_facet(facet.name, item.value, only_path: false) + end + end + end + end + end + json.links do + json.self search_facet_path(id: facet.name, only_path: false) + end + end + + json.array! search_fields do |(label, key)| + json.type 'search_field' + json.id key + json.attributes do + json.label label + end + json.links do + json.self url_for(search_state.to_h.merge(search_field: key, only_path: false)) + end + end + + json.array! active_sort_fields do |key, field| + json.type 'sort' + json.id key + json.attributes do + json.label field.label + end + json.links do + json.self url_for(search_state.to_h.merge(sort: key, only_path: false)) + end + end +end diff --git a/config/routes.rb b/config/routes.rb index 061e770ad..2dceed82e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -21,6 +21,7 @@ namespace :admin do get '/api' => 'api#index', constraints: lambda { |req| req.format == :json } get '/api/fetch' => 'api#fetch', constraints: lambda { |req| req.format == :json } + get '/api/advanced_search_facets' => 'api#advanced_search_facets', constraints: lambda { |req| req.format == :json } get '/api/facet/:id' => 'api#facet', constraints: lambda { |req| req.format == :json } end diff --git a/test/controllers/admin/api_controller_test.rb b/test/controllers/admin/api_controller_test.rb index 846c22961..746a82864 100644 --- a/test/controllers/admin/api_controller_test.rb +++ b/test/controllers/admin/api_controller_test.rb @@ -7,6 +7,11 @@ class ApiControllerTest < ActionDispatch::IntegrationTest assert_response :success end + test "should return facet results for JSON" do + get '/admin/api/advanced_search_facets.json' + assert_response :success + end + test "should include admin.api in solr_params" do default_solr_params = Admin::ApiController.blacklight_config.default_solr_params From 29a140f5df22550756d01b0343358556fd7528e8 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Mon, 15 Feb 2021 09:14:15 -0600 Subject: [PATCH 03/17] Facets: update per Karen Addresses: https://github.com/BTAA-Geospatial-Data-Project/geomg/issues/100 --- app/controllers/admin/api_controller.rb | 57 +++++-------------------- 1 file changed, 11 insertions(+), 46 deletions(-) diff --git a/app/controllers/admin/api_controller.rb b/app/controllers/admin/api_controller.rb index 2e0033c9d..cb0132374 100644 --- a/app/controllers/admin/api_controller.rb +++ b/app/controllers/admin/api_controller.rb @@ -109,58 +109,23 @@ class ApiController < ApplicationController # # Publication State config.add_facet_field 'b1g_publication_state_s', :label => 'Publication State', :limit => 8, collapse: false - - # Genre - config.add_facet_field 'b1g_genre_sm', :label => 'Genre', :limit => 8, collapse: false - # Contributor - config.add_facet_field 'dct_provenance_s', label: 'Contributor', limit: 15 # Type config.add_facet_field 'dc_type_sm', label: 'Type', limit: 8 - # Code - config.add_facet_field 'b1g_code_s', label: 'Code', limit: 10 - # Is Part Of - config.add_facet_field 'dct_isPartOf_sm', label: 'Is Part Of', limit: 10 - # Date Accessioned - config.add_facet_field 'b1g_dateAccessioned_s', label: 'Date Accessioned', limit: 10 - # Date Retired - config.add_facet_field 'b1g_dateRetired_s', label: 'Date Retired', limit: 10 - # Access + # Contributor + config.add_facet_field 'dct_provenance_s', label: 'Contributor', limit: 15 + # Accrual Method + config.add_facet_field 'dct_accrualMethod_s', :label => 'Accrual Method' + # Public/Restricted config.add_facet_field 'dc_rights_s', :label => 'Public/Restricted' - config.add_facet_field 'dct_spatial_sm', :label => 'Place', :limit => 8, collapse: false + # ADVANCED SEARCH + # + # Code + config.add_facet_field 'b1g_code_s', label: 'Code', limit: 1000 + # Is Part Of + config.add_facet_field 'dct_isPartOf_sm', label: 'Is Part Of', limit: 1000 - config.add_facet_field 'solr_year_i', label: 'Year', limit: 10, collapse: false, all: 'Any year', range: { - assumed_boundaries: [1100, 2018] - # :num_segments => 6, - # :segments => true - } - config.add_facet_field 'dc_subject_sm', :label => 'Subject', :limit => 8, collapse: false - - config.add_facet_field 'time_period', :label => 'Time Period', :query => { - '1500s' => { :label => '1500s', :fq => "solr_year_i:[1500 TO 1599]" }, - '1600s' => { :label => '1600s', :fq => "solr_year_i:[1600 TO 1699]" }, - '1700s' => { :label => '1700s', :fq => "solr_year_i:[1700 TO 1799]" }, - '1800-1849' => { :label => '1800-1849', :fq => "solr_year_i:[1800 TO 1849]" }, - '1850-1899' => { :label => '1850-1899', :fq => "solr_year_i:[1850 TO 1899]" }, - '1900-1949' => { :label => '1900-1949', :fq => "solr_year_i:[1900 TO 1949]" }, - '1950-1999' => { :label => '1950-1999', :fq => "solr_year_i:[1950 TO 1999]" }, - '2000-2004' => { :label => '2000-2004', :fq => "solr_year_i:[2000 TO 2004]" }, - '2005-2009' => { :label => '2005-2009', :fq => "solr_year_i:[2005 TO 2009]" }, - '2010-2014' => { :label => '2010-2014', :fq => "solr_year_i:[2010 TO 2014]" }, - '2015-present' => { :label => '2015-present', :fq => "solr_year_i:[2015 TO #{Time.now.year}]"} - }, collapse: false - - # Trying range facet - #config.add_facet_field 'solr_year_i', :label => 'Year', :limit => 10 - - config.add_facet_field 'dc_publisher_sm', :label => 'Publisher', :limit => 8 - config.add_facet_field 'dc_creator_sm', :label => 'Creator', :limit => 8 - - #config.add_facet_field 'b1g_geom_type_sm', label: 'Geometry', limit: 8, partial: "icon_facet", collapse: false - #config.add_facet_field 'dc_format_s', :label => 'Format', :limit => 8 config.add_facet_field 'dct_mediator_sm', label: 'Institutional Access', limit: 15 - # Remove access facet until data is available - EWL - # config.add_facet_field 'dc_rights_s', label: 'Access', limit: 8, partial: "icon_facet" # Have BL send all facet field names to Solr, which has been the default # previously. Simply remove these lines if you'd rather use Solr request From 93ccaab1b2e3abeb27edd6b3b34e964629353d45 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Mon, 15 Feb 2021 10:16:12 -0600 Subject: [PATCH 04/17] Facets: cont. remove dct_mediator_sm --- app/controllers/admin/api_controller.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/controllers/admin/api_controller.rb b/app/controllers/admin/api_controller.rb index cb0132374..a61e21ad6 100644 --- a/app/controllers/admin/api_controller.rb +++ b/app/controllers/admin/api_controller.rb @@ -125,8 +125,6 @@ class ApiController < ApplicationController # Is Part Of config.add_facet_field 'dct_isPartOf_sm', label: 'Is Part Of', limit: 1000 - config.add_facet_field 'dct_mediator_sm', label: 'Institutional Access', limit: 15 - # Have BL send all facet field names to Solr, which has been the default # previously. Simply remove these lines if you'd rather use Solr request # handler defaults, or have no facets. From 39bb2e17420ad0630c42198e7561ee24b16c27a6 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Fri, 9 Apr 2021 08:21:50 -0500 Subject: [PATCH 05/17] Tests: b1g index map not rendering. Stanford index map does. B1G index map is returning 404. Switching test to Stanford map that does render. --- test/system/show_page_test.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/system/show_page_test.rb b/test/system/show_page_test.rb index 103e6b832..0673d9bca 100644 --- a/test/system/show_page_test.rb +++ b/test/system/show_page_test.rb @@ -185,6 +185,7 @@ def test_metadata_links end def test_b1g_show_index_map + skip('B1G Index Map not rendering') visit "/catalog/9702bb22-4305-4cc2-a8f4-fc10e4ef05df" # Help @@ -196,6 +197,20 @@ def test_b1g_show_index_map end end + def test_stanford_show_index_map + visit "/catalog/stanford-fb897vt9938" + + # Help + assert page.has_content?("Index Map") + + within('#map') do + assert page.has_selector?("svg.leaflet-zoom-animated") + assert page.has_selector?("path.leaflet-interactive") + end + end + + + def test_browse_descendants skip('Moving to dct_isPartOf_sm for relations') visit "/catalog/princeton-1r66j405w" From ee2a4734b2ae4ceeecb651f0dd575da1c926661d Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Fri, 9 Apr 2021 08:34:53 -0500 Subject: [PATCH 06/17] Update b1g_show_index_map.json Fixes #349 --- spec/fixtures/solr_documents/b1g_show_index_map.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/fixtures/solr_documents/b1g_show_index_map.json b/spec/fixtures/solr_documents/b1g_show_index_map.json index dcfd06591..50180dff3 100644 --- a/spec/fixtures/solr_documents/b1g_show_index_map.json +++ b/spec/fixtures/solr_documents/b1g_show_index_map.json @@ -3,7 +3,7 @@ "dc_description_s": "Atlas and farm directory with complete survey in township plats, Dakota County, Minnesota, containing plats of all townships with owners' names ... / published by The Farmer [magazine] ; engraved by The Kenyon Company, Des Moines, Iowa. St. Paul: Webb Publishing Co., c1916.", "layer_modified_dt": "2019-03-28T19:41:35Z", "solr_geom": "ENVELOPE(-93.3287, -92.7339, 44.9233, 44.4729)", - "dct_references_s": "{\"http://schema.org/url\":\"http://purl.umn.edu/193103\",\"https://openindexmaps.org\":\"https://raw.githubusercontent.com/BTAA-Geospatial-Data-Project/indexmaps/master/dakota.geojson\"}", + "dct_references_s": "{\"http://schema.org/url\":\"http://purl.umn.edu/193103\",\"https://openindexmaps.org\":\"https://raw.githubusercontent.com/BTAA-Geospatial-Data-Project/indexmaps/main/data/05d-01/dakota.geojson\"}", "dc_rights_s": "Public", "b1g_centroid_ss": "44.6981,-93.0313", "layer_geom_type_s": "Image", From ad0833b1053aaa3f0ca8390dc7434e826ddf6023 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Fri, 9 Apr 2021 08:40:08 -0500 Subject: [PATCH 07/17] Update results.js Per GBL v2.3.0 --- app/assets/javascripts/geoblacklight/modules/results.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/geoblacklight/modules/results.js b/app/assets/javascripts/geoblacklight/modules/results.js index a67cb642e..4a4b2ab54 100644 --- a/app/assets/javascripts/geoblacklight/modules/results.js +++ b/app/assets/javascripts/geoblacklight/modules/results.js @@ -75,8 +75,10 @@ Blacklight.onLoad(function() { // set hover listeners on map $('#content') .on('mouseenter', '#documents [data-layer-id]', function() { - var bounds = L.bboxToBounds($(this).data('bbox')); - geoblacklight.addBoundsOverlay(bounds); + if($(this).data('bbox').length > 0) { + var bounds = L.bboxToBounds($(this).data('bbox')); + geoblacklight.addBoundsOverlay(bounds); + } }) .on('mouseleave', '#documents [data-layer-id]', function() { geoblacklight.removeBoundsOverlay(); From f97d539e1a8532d740b83bbca3a3cd09801a3adc Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Fri, 9 Apr 2021 08:40:41 -0500 Subject: [PATCH 08/17] Update show_page_test.rb Remove skip for B1G Index Map. New Index Map URL works. --- test/system/show_page_test.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/test/system/show_page_test.rb b/test/system/show_page_test.rb index 0673d9bca..fffb11c97 100644 --- a/test/system/show_page_test.rb +++ b/test/system/show_page_test.rb @@ -185,7 +185,6 @@ def test_metadata_links end def test_b1g_show_index_map - skip('B1G Index Map not rendering') visit "/catalog/9702bb22-4305-4cc2-a8f4-fc10e4ef05df" # Help From 7a75a3e2aed0d02e85bd02f7ea591b2b18cfea6a Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Fri, 9 Apr 2021 08:41:38 -0500 Subject: [PATCH 09/17] Gems: bump GBL to 2.3.0; Rails to 5.2.5 --- Gemfile | 2 +- Gemfile.lock | 192 +++++++++++++++++++++++++++------------------------ 2 files changed, 102 insertions(+), 92 deletions(-) diff --git a/Gemfile b/Gemfile index aed9e4d47..a0a710840 100644 --- a/Gemfile +++ b/Gemfile @@ -62,7 +62,7 @@ gem 'chosen-rails' # jquery multiselect plugin for advanced search gem 'bootstrap', '~> 4.0' gem 'popper_js' gem 'twitter-typeahead-rails', '0.11.1.pre.corejavascript' -gem 'geoblacklight', '~> 2.2.0' +gem 'geoblacklight', '2.3.0' gem "rubyzip", ">= 1.3.0" gem "awesome_print" diff --git a/Gemfile.lock b/Gemfile.lock index c7d159040..c422ed643 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -28,43 +28,43 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (5.2.4.4) - actionpack (= 5.2.4.4) + actioncable (5.2.5) + actionpack (= 5.2.5) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailer (5.2.4.4) - actionpack (= 5.2.4.4) - actionview (= 5.2.4.4) - activejob (= 5.2.4.4) + actionmailer (5.2.5) + actionpack (= 5.2.5) + actionview (= 5.2.5) + activejob (= 5.2.5) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.2.4.4) - actionview (= 5.2.4.4) - activesupport (= 5.2.4.4) + actionpack (5.2.5) + actionview (= 5.2.5) + activesupport (= 5.2.5) rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.4.4) - activesupport (= 5.2.4.4) + actionview (5.2.5) + activesupport (= 5.2.5) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.2.4.4) - activesupport (= 5.2.4.4) + activejob (5.2.5) + activesupport (= 5.2.5) globalid (>= 0.3.6) - activemodel (5.2.4.4) - activesupport (= 5.2.4.4) - activerecord (5.2.4.4) - activemodel (= 5.2.4.4) - activesupport (= 5.2.4.4) + activemodel (5.2.5) + activesupport (= 5.2.5) + activerecord (5.2.5) + activemodel (= 5.2.5) + activesupport (= 5.2.5) arel (>= 9.0) - activestorage (5.2.4.4) - actionpack (= 5.2.4.4) - activerecord (= 5.2.4.4) - marcel (~> 0.3.1) - activesupport (5.2.4.4) + activestorage (5.2.5) + actionpack (= 5.2.5) + activerecord (= 5.2.5) + marcel (~> 1.0.0) + activesupport (5.2.5) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) @@ -123,7 +123,7 @@ GEM railties (>= 3.0) sass-rails (>= 3.2) chronic (0.10.2) - coderay (1.1.2) + coderay (1.1.3) coffee-rails (4.2.2) coffee-script (>= 2.2.0) railties (>= 4.0.0) @@ -131,16 +131,15 @@ GEM coffee-script-source execjs coffee-script-source (1.12.2) - concurrent-ruby (1.1.7) - config (2.0.0) - activesupport (>= 4.2) + concurrent-ruby (1.1.8) + config (3.0.0) deep_merge (~> 1.2, >= 1.2.1) - dry-schema (~> 1.0) + dry-validation (~> 1.0, >= 1.0.0) connection_pool (2.2.2) crass (1.0.6) database_cleaner (1.7.0) deep_merge (1.2.1) - deprecation (1.0.0) + deprecation (1.1.0) activesupport devise (4.7.1) bcrypt (~> 3.0) @@ -157,37 +156,41 @@ GEM railties (>= 3.2, < 6.1) down (4.8.1) addressable (~> 2.5) - dry-configurable (0.8.3) + dry-configurable (0.12.1) concurrent-ruby (~> 1.0) - dry-core (~> 0.4, >= 0.4.7) + dry-core (~> 0.5, >= 0.5.0) dry-container (0.7.2) concurrent-ruby (~> 1.0) dry-configurable (~> 0.1, >= 0.1.3) - dry-core (0.4.9) + dry-core (0.5.0) concurrent-ruby (~> 1.0) - dry-equalizer (0.2.2) + dry-equalizer (0.3.0) dry-inflector (0.2.0) - dry-initializer (3.0.1) - dry-logic (1.0.3) + dry-initializer (3.0.4) + dry-logic (1.1.0) concurrent-ruby (~> 1.0) - dry-core (~> 0.2) - dry-equalizer (~> 0.2) - dry-schema (1.4.1) + dry-core (~> 0.5, >= 0.5) + dry-schema (1.6.1) concurrent-ruby (~> 1.0) dry-configurable (~> 0.8, >= 0.8.3) - dry-core (~> 0.4) - dry-equalizer (~> 0.2) + dry-core (~> 0.5, >= 0.5) dry-initializer (~> 3.0) dry-logic (~> 1.0) - dry-types (~> 1.2) - dry-types (1.2.0) + dry-types (~> 1.5) + dry-types (1.5.1) concurrent-ruby (~> 1.0) dry-container (~> 0.3) - dry-core (~> 0.4, >= 0.4.4) - dry-equalizer (~> 0.2, >= 0.2.2) + dry-core (~> 0.5, >= 0.5) dry-inflector (~> 0.1, >= 0.1.2) dry-logic (~> 1.0, >= 1.0.2) - erubi (1.9.0) + dry-validation (1.6.0) + concurrent-ruby (~> 1.0) + dry-container (~> 0.7, >= 0.7.1) + dry-core (~> 0.4) + dry-equalizer (~> 0.2) + dry-initializer (~> 3.0) + dry-schema (~> 1.5, >= 1.5.2) + erubi (1.10.0) ethon (0.12.0) ffi (>= 1.3.0) exception_notification (4.3.0) @@ -199,16 +202,19 @@ GEM factory_bot_rails (5.0.2) factory_bot (~> 5.0.2) railties (>= 4.2.0) - faraday (0.17.0) + faraday (1.3.0) + faraday-net_http (~> 1.0) multipart-post (>= 1.2, < 3) - faraday_middleware (0.13.1) - faraday (>= 0.7.4, < 1.0) + ruby2_keywords + faraday-net_http (1.0.1) + faraday_middleware (1.0.0) + faraday (~> 1.0) ffi (1.11.1) - font-awesome-rails (4.7.0.5) - railties (>= 3.2, < 6.1) + font-awesome-rails (4.7.0.7) + railties (>= 3.2, < 7) foreman (0.85.0) thor (~> 0.19.1) - geo_combine (0.4.0) + geo_combine (0.5.1) activesupport json-schema net-http-persistent (~> 2.0) @@ -216,13 +222,13 @@ GEM rsolr sanitize thor - geoblacklight (2.2.1) + geoblacklight (2.3.0) blacklight (~> 7.0) coderay config deprecation - faraday - faraday_middleware + faraday (~> 1.0) + faraday_middleware (~> 1.0.0.rc1) font-awesome-rails geo_combine (~> 0.4) geoblacklight-icons (>= 0.2) @@ -242,17 +248,17 @@ GEM haml (5.1.1) temple (>= 0.8.0) tilt - handlebars_assets (0.23.5) + handlebars_assets (0.23.9) execjs (~> 2.0) sprockets (>= 2.0.0) tilt (>= 1.2) - i18n (1.8.5) + i18n (1.8.10) concurrent-ruby (~> 1.0) image_processing (1.9.3) mini_magick (>= 4.9.5, < 5) ruby-vips (>= 2.0.13, < 3) - jbuilder (2.9.1) - activesupport (>= 4.2.0) + jbuilder (2.11.2) + activesupport (>= 5.0.0) jquery-rails (4.3.5) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) @@ -279,7 +285,7 @@ GEM rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) ruby_dep (~> 1.2) - loofah (2.7.0) + loofah (2.9.1) crass (~> 1.0.2) nokogiri (>= 1.5.9) m (1.5.1) @@ -287,17 +293,18 @@ GEM rake (>= 0.9.2.2) mail (2.7.1) mini_mime (>= 0.1.1) - marcel (0.3.3) - mimemagic (~> 0.3.2) + marcel (1.0.1) method_source (1.0.0) - mime-types (3.3) + mime-types (3.3.1) mime-types-data (~> 3.2015) - mime-types-data (3.2019.1009) - mimemagic (0.3.5) + mime-types-data (3.2021.0225) + mimemagic (0.4.3) + nokogiri (~> 1) + rake mini_magick (4.9.5) - mini_mime (1.0.2) - mini_portile2 (2.4.0) - minitest (5.14.2) + mini_mime (1.1.0) + mini_portile2 (2.5.0) + minitest (5.14.4) minitest-ci (3.4.0) minitest (>= 5.0.6) minitest-reporters (1.3.6) @@ -309,10 +316,11 @@ GEM multipart-post (2.1.1) mysql2 (0.5.2) net-http-persistent (2.9.4) - nio4r (2.5.4) - nokogiri (1.10.10) - mini_portile2 (~> 2.4.0) - nokogumbo (2.0.2) + nio4r (2.5.7) + nokogiri (1.11.3) + mini_portile2 (~> 2.5.0) + racc (~> 1.4) + nokogumbo (2.0.5) nokogiri (~> 1.8, >= 1.8.4) orm_adapter (0.5.0) parslet (1.8.2) @@ -324,6 +332,7 @@ GEM public_suffix (3.1.1) puma (4.3.5) nio4r (~> 2.0) + racc (1.5.2) rack (2.2.3) rack-cors (1.0.5) rack (>= 1.6.0) @@ -333,27 +342,27 @@ GEM rack rack-test (1.1.0) rack (>= 1.0, < 3) - rails (5.2.4.4) - actioncable (= 5.2.4.4) - actionmailer (= 5.2.4.4) - actionpack (= 5.2.4.4) - actionview (= 5.2.4.4) - activejob (= 5.2.4.4) - activemodel (= 5.2.4.4) - activerecord (= 5.2.4.4) - activestorage (= 5.2.4.4) - activesupport (= 5.2.4.4) + rails (5.2.5) + actioncable (= 5.2.5) + actionmailer (= 5.2.5) + actionpack (= 5.2.5) + actionview (= 5.2.5) + activejob (= 5.2.5) + activemodel (= 5.2.5) + activerecord (= 5.2.5) + activestorage (= 5.2.5) + activesupport (= 5.2.5) bundler (>= 1.3.0) - railties (= 5.2.4.4) + railties (= 5.2.5) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) rails-html-sanitizer (1.3.0) loofah (~> 2.3) - railties (5.2.4.4) - actionpack (= 5.2.4.4) - activesupport (= 5.2.4.4) + railties (5.2.5) + actionpack (= 5.2.5) + activesupport (= 5.2.5) method_source rake (>= 0.8.7) thor (>= 0.19.0, < 2.0) @@ -367,7 +376,7 @@ GEM actionpack (>= 5.0) railties (>= 5.0) retriable (3.1.2) - rsolr (2.2.1) + rsolr (2.3.0) builder (>= 2.1.2) faraday (>= 0.9.0) rspec-core (3.8.2) @@ -390,9 +399,10 @@ GEM ruby-progressbar (1.10.1) ruby-vips (2.0.16) ffi (~> 1.9) + ruby2_keywords (0.0.4) ruby_dep (1.5.0) rubyzip (1.3.0) - sanitize (5.2.1) + sanitize (5.2.3) crass (~> 1.0.2) nokogiri (>= 1.8.0) nokogumbo (~> 2.0) @@ -453,7 +463,7 @@ GEM railties (>= 3.1) typhoeus (0.8.0) ethon (>= 0.8.0) - tzinfo (1.2.7) + tzinfo (1.2.9) thread_safe (~> 0.1) uglifier (4.1.20) execjs (>= 0.3.0, < 3) @@ -468,7 +478,7 @@ GEM nokogiri (~> 1.6) rubyzip (~> 1.0) selenium-webdriver (>= 3.0, < 4.0) - webpacker (4.0.7) + webpacker (4.3.0) activesupport (>= 4.2) rack-proxy (>= 0.6.1) railties (>= 4.2) @@ -507,7 +517,7 @@ DEPENDENCIES exception_notification (~> 4.3.0) factory_bot_rails foreman - geoblacklight (~> 2.2.0) + geoblacklight (= 2.3.0) geoblacklight-icons! geoblacklight_sidecar_images (~> 0.6.0) haml @@ -548,4 +558,4 @@ DEPENDENCIES whenever (~> 0.9.0) BUNDLED WITH - 2.1.4 + 2.2.9 From 168f67579022fe410523da7db458f62c97cbc0fd Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Fri, 9 Apr 2021 09:33:29 -0500 Subject: [PATCH 10/17] Gems: GBL 2.4.0, BL 7.9.0; resolve issues and fix tests Update to GBL 2.4.0 and BL 7.9.0. --- Gemfile | 4 +-- Gemfile.lock | 14 +++++----- app/assets/javascripts/geoblacklight.js | 1 - .../javascripts/geoblacklight/modules/home.js | 2 +- .../javascripts/geoblacklight/modules/item.js | 27 ++++++++++++++----- app/views/shared/_header_navbar.html.erb | 2 -- test/system/show_page_test.rb | 2 +- 7 files changed, 32 insertions(+), 20 deletions(-) diff --git a/Gemfile b/Gemfile index a0a710840..6db28ee81 100644 --- a/Gemfile +++ b/Gemfile @@ -55,14 +55,14 @@ group :development do gem 'letter_opener' end -gem 'blacklight', '~> 7.0.0' +gem 'blacklight', '7.9.0' gem 'blacklight_advanced_search', git: 'https://github.com/projectblacklight/blacklight_advanced_search.git', :branch => 'master' gem 'blacklight_range_limit', '~> 7.0.0' gem 'chosen-rails' # jquery multiselect plugin for advanced search gem 'bootstrap', '~> 4.0' gem 'popper_js' gem 'twitter-typeahead-rails', '0.11.1.pre.corejavascript' -gem 'geoblacklight', '2.3.0' +gem 'geoblacklight', '2.4.0' gem "rubyzip", ">= 1.3.0" gem "awesome_print" diff --git a/Gemfile.lock b/Gemfile.lock index c422ed643..9d22301a8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -78,13 +78,13 @@ GEM awesome_print (1.8.0) bcrypt (3.1.13) bindex (0.8.1) - blacklight (7.0.1) + blacklight (7.9.0) deprecation globalid jbuilder (~> 2.7) kaminari (>= 0.15) - nokogiri (~> 1.6) - rails (~> 5.1) + rails (>= 5.1, < 7) + view_component blacklight_range_limit (7.0.0) blacklight jquery-rails @@ -222,7 +222,7 @@ GEM rsolr sanitize thor - geoblacklight (2.3.0) + geoblacklight (2.4.0) blacklight (~> 7.0) coderay config @@ -467,6 +467,8 @@ GEM thread_safe (~> 0.1) uglifier (4.1.20) execjs (>= 0.3.0, < 3) + view_component (2.30.0) + activesupport (>= 5.0.0, < 7.0) warden (1.2.8) rack (>= 2.0.6) web-console (3.7.0) @@ -496,7 +498,7 @@ PLATFORMS DEPENDENCIES addressable (~> 2.5.0) awesome_print - blacklight (~> 7.0.0) + blacklight (= 7.9.0) blacklight_advanced_search! blacklight_range_limit (~> 7.0.0) bootsnap @@ -517,7 +519,7 @@ DEPENDENCIES exception_notification (~> 4.3.0) factory_bot_rails foreman - geoblacklight (= 2.3.0) + geoblacklight (= 2.4.0) geoblacklight-icons! geoblacklight_sidecar_images (~> 0.6.0) haml diff --git a/app/assets/javascripts/geoblacklight.js b/app/assets/javascripts/geoblacklight.js index d898c1309..0b549b58f 100644 --- a/app/assets/javascripts/geoblacklight.js +++ b/app/assets/javascripts/geoblacklight.js @@ -3,7 +3,6 @@ //= require geoblacklight/basemaps //= require geoblacklight/controls //= require geoblacklight/viewers -//= require geoblacklight/modules/collapse //= require geoblacklight/modules/download //= require geoblacklight/modules/metadata_download_button.js //= require geoblacklight/modules/metadata.js diff --git a/app/assets/javascripts/geoblacklight/modules/home.js b/app/assets/javascripts/geoblacklight/modules/home.js index e4e55300b..f5b02c1fc 100644 --- a/app/assets/javascripts/geoblacklight/modules/home.js +++ b/app/assets/javascripts/geoblacklight/modules/home.js @@ -11,7 +11,7 @@ Blacklight.onLoad(function() { searcher: function() { window.location.href = this.getSearchUrl(); }, - staticButton: '' + staticButton: '' })); var progress = document.getElementById('progress'); diff --git a/app/assets/javascripts/geoblacklight/modules/item.js b/app/assets/javascripts/geoblacklight/modules/item.js index 121d93c29..0301511d5 100644 --- a/app/assets/javascripts/geoblacklight/modules/item.js +++ b/app/assets/javascripts/geoblacklight/modules/item.js @@ -9,11 +9,24 @@ Blacklight.onLoad(function() { viewer = new window['GeoBlacklight']['Viewer'][viewerName](element); }); - // @TODO: Local GBL override to use Readme 3.0 syntax - new Readmore( - '.truncate-abstract', - { - maxHeight: 60 - } - ); + $('.truncate-abstract').each(function(i, element) { + var lines = 12 * parseFloat(getComputedStyle(element).fontSize); + if (element.getBoundingClientRect().height < lines) return; + var id = element.id || 'truncate-' + i; + + element.id = id; + $(element).addClass('collapse'); + + var control = $(''); + + $(element).on('shown.bs.collapse', function() { + control.text('Close'); + }); + $(element).on('hidden.bs.collapse', function() { + control.text('Read more'); + }); + + control.collapse(); + control.insertAfter(element); + }); }); diff --git a/app/views/shared/_header_navbar.html.erb b/app/views/shared/_header_navbar.html.erb index 4b77cd526..119790b8b 100644 --- a/app/views/shared/_header_navbar.html.erb +++ b/app/views/shared/_header_navbar.html.erb @@ -1,5 +1,3 @@ -<%= render_aria_labels(@aria_labels) %> - <%- header_classes = homepage? ? 'fixed-top' : nil %>
diff --git a/test/system/show_page_test.rb b/test/system/show_page_test.rb index fffb11c97..394ab8e8d 100644 --- a/test/system/show_page_test.rb +++ b/test/system/show_page_test.rb @@ -348,7 +348,7 @@ def test_b1g_access_rights_html_link def test_b1g_placename_readmore_link visit '/catalog/99-0011-minnesota' within('dd.blacklight-dct_spatial_sm') do - assert page.has_link?("Read More") + assert page.has_content?("Read more") end end From 44d7763b8c5ce76bea3d801a0657fe9fd132b52d Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Fri, 9 Apr 2021 11:46:27 -0500 Subject: [PATCH 11/17] Gems: GBL 3.0.0, GBLSCI 0.7.0 Gets us to GBL 3.0 with all tests passing. --- Gemfile | 4 +-- Gemfile.lock | 28 +++++++-------- app/assets/images/blacklight/mapview.svg | 2 +- app/assets/images/blacklight/split.svg | 2 +- app/assets/javascripts/geoblacklight.js | 1 - app/assets/stylesheets/_blacklight.scss | 1 + app/assets/stylesheets/_customizations.scss | 33 +++++++++++++++++ .../stylesheets/{gblsci.scss => _gblsci.scss} | 0 app/assets/stylesheets/_geoblacklight.scss | 1 + .../{geoblacklight.scss => _geoportal.scss} | 8 ++--- app/assets/stylesheets/application.scss | 26 ++++++-------- app/assets/stylesheets/blacklight.scss | 4 --- app/assets/stylesheets/geoportal/_navbar.scss | 2 +- .../stylesheets/geoportal/geoportal.scss | 5 +++ app/controllers/catalog_controller.rb | 6 ++-- .../catalog/_index_mapview_default.html.erb | 36 +++++++++++-------- app/views/relation/_descendants.html.erb | 17 --------- app/views/relation/index.html.erb | 13 ------- test/system/show_page_test.rb | 1 - 19 files changed, 96 insertions(+), 94 deletions(-) create mode 100644 app/assets/stylesheets/_blacklight.scss create mode 100644 app/assets/stylesheets/_customizations.scss rename app/assets/stylesheets/{gblsci.scss => _gblsci.scss} (100%) create mode 100644 app/assets/stylesheets/_geoblacklight.scss rename app/assets/stylesheets/{geoblacklight.scss => _geoportal.scss} (97%) delete mode 100644 app/assets/stylesheets/blacklight.scss delete mode 100644 app/views/relation/_descendants.html.erb delete mode 100644 app/views/relation/index.html.erb diff --git a/Gemfile b/Gemfile index 6db28ee81..f2fbae629 100644 --- a/Gemfile +++ b/Gemfile @@ -62,13 +62,13 @@ gem 'chosen-rails' # jquery multiselect plugin for advanced search gem 'bootstrap', '~> 4.0' gem 'popper_js' gem 'twitter-typeahead-rails', '0.11.1.pre.corejavascript' -gem 'geoblacklight', '2.4.0' +gem 'geoblacklight', '3.0.0' gem "rubyzip", ">= 1.3.0" gem "awesome_print" # Image migration -gem 'geoblacklight_sidecar_images', '~> 0.6.0' +gem 'geoblacklight_sidecar_images', '~> 0.7.0' gem 'carrierwave', '~> 1.2' gem 'mini_magick', '~> 4.9.4' diff --git a/Gemfile.lock b/Gemfile.lock index 9d22301a8..c1585e1ba 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -210,8 +210,6 @@ GEM faraday_middleware (1.0.0) faraday (~> 1.0) ffi (1.11.1) - font-awesome-rails (4.7.0.7) - railties (>= 3.2, < 7) foreman (0.85.0) thor (~> 0.19.1) geo_combine (0.5.1) @@ -222,27 +220,25 @@ GEM rsolr sanitize thor - geoblacklight (2.4.0) + geoblacklight (3.0.0) blacklight (~> 7.0) coderay config deprecation faraday (~> 1.0) faraday_middleware (~> 1.0.0.rc1) - font-awesome-rails geo_combine (~> 0.4) - geoblacklight-icons (>= 0.2) handlebars_assets mime-types - rails (~> 5.0) - webpacker - geoblacklight_sidecar_images (0.6.2) - geoblacklight (~> 2.0) + rails (>= 5.2.4, < 6.1) + webpacker (~> 4.0) + geoblacklight_sidecar_images (0.7.0) + geoblacklight (>= 2.0) image_processing (~> 1.6) mimemagic (~> 0.3) mini_magick (~> 4.9.4) - rails (>= 5.2, < 6) - statesman (~> 3.4) + rails (>= 5.2, < 6.2) + statesman (>= 3.4) globalid (0.4.2) activesupport (>= 4.2.0) haml (5.1.1) @@ -254,9 +250,9 @@ GEM tilt (>= 1.2) i18n (1.8.10) concurrent-ruby (~> 1.0) - image_processing (1.9.3) + image_processing (1.12.1) mini_magick (>= 4.9.5, < 5) - ruby-vips (>= 2.0.13, < 3) + ruby-vips (>= 2.0.17, < 3) jbuilder (2.11.2) activesupport (>= 5.0.0) jquery-rails (4.3.5) @@ -397,7 +393,7 @@ GEM rspec-support (~> 3.8.0) rspec-support (3.8.2) ruby-progressbar (1.10.1) - ruby-vips (2.0.16) + ruby-vips (2.0.17) ffi (~> 1.9) ruby2_keywords (0.0.4) ruby_dep (1.5.0) @@ -519,9 +515,9 @@ DEPENDENCIES exception_notification (~> 4.3.0) factory_bot_rails foreman - geoblacklight (= 2.4.0) + geoblacklight (= 3.0.0) geoblacklight-icons! - geoblacklight_sidecar_images (~> 0.6.0) + geoblacklight_sidecar_images (~> 0.7.0) haml handlebars_assets (~> 0.23.0) jbuilder (~> 2.5) diff --git a/app/assets/images/blacklight/mapview.svg b/app/assets/images/blacklight/mapview.svg index b9d89b53e..72800903d 100644 --- a/app/assets/images/blacklight/mapview.svg +++ b/app/assets/images/blacklight/mapview.svg @@ -1,5 +1,5 @@ mapview - + diff --git a/app/assets/images/blacklight/split.svg b/app/assets/images/blacklight/split.svg index b5b9c8ef9..9ccd47a3a 100644 --- a/app/assets/images/blacklight/split.svg +++ b/app/assets/images/blacklight/split.svg @@ -1,5 +1,5 @@ split - + diff --git a/app/assets/javascripts/geoblacklight.js b/app/assets/javascripts/geoblacklight.js index 0b549b58f..fd98b36ce 100644 --- a/app/assets/javascripts/geoblacklight.js +++ b/app/assets/javascripts/geoblacklight.js @@ -13,7 +13,6 @@ //= require geoblacklight/modules/util //= require geoblacklight/downloaders -//= require readmore // additional leaflet base layers GeoBlacklight.Basemaps.esri = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}', { diff --git a/app/assets/stylesheets/_blacklight.scss b/app/assets/stylesheets/_blacklight.scss new file mode 100644 index 000000000..e97a2afe6 --- /dev/null +++ b/app/assets/stylesheets/_blacklight.scss @@ -0,0 +1 @@ +@import 'blacklight/blacklight'; diff --git a/app/assets/stylesheets/_customizations.scss b/app/assets/stylesheets/_customizations.scss new file mode 100644 index 000000000..3e0058d05 --- /dev/null +++ b/app/assets/stylesheets/_customizations.scss @@ -0,0 +1,33 @@ +// Local Application Customizations + +// Set Header Logo +$logo-image: image_url('UMass_logo.svg') !default; + +.navbar-brand { /* The main logo image for the Blacklight instance */ + @if $logo-image { + background: transparent $logo-image no-repeat top left; + } +} + +.navbar-logo { + height: 80px !important; + margin-top: 0.6rem !important; +} + +// Optional +// Override default Bootstrap variables here + +// Example: Bootstrap Colors +$blue: #007bff !default; +$indigo: #6610f2 !default; +$purple: #6f42c1 !default; +$pink: #e83e8c !default; +$red: #dc3545 !default; +$orange: #fd7e14 !default; +$yellow: #ffc107 !default; +$green: #28a745 !default; +$teal: #20c997 !default; +$cyan: #17a2b8 !default; + +// Example: Bootstrap Link color +$link-color:#0088ce; diff --git a/app/assets/stylesheets/gblsci.scss b/app/assets/stylesheets/_gblsci.scss similarity index 100% rename from app/assets/stylesheets/gblsci.scss rename to app/assets/stylesheets/_gblsci.scss diff --git a/app/assets/stylesheets/_geoblacklight.scss b/app/assets/stylesheets/_geoblacklight.scss new file mode 100644 index 000000000..6df199980 --- /dev/null +++ b/app/assets/stylesheets/_geoblacklight.scss @@ -0,0 +1 @@ +@import 'geoblacklight/geoblacklight'; diff --git a/app/assets/stylesheets/geoblacklight.scss b/app/assets/stylesheets/_geoportal.scss similarity index 97% rename from app/assets/stylesheets/geoblacklight.scss rename to app/assets/stylesheets/_geoportal.scss index 4df1f603c..152c186ba 100644 --- a/app/assets/stylesheets/geoblacklight.scss +++ b/app/assets/stylesheets/_geoportal.scss @@ -1,15 +1,13 @@ -$link-color:#0088ce; +@import 'geoportal/geoportal'; -@import 'geoblacklight/application'; -@import 'geoblacklight-icons-rails'; +// GEOPORTAL BELOW +$link-color:#0088ce; @import 'leaflet-label'; @import 'Leaflet.fullscreen/leaflet.fullscreen'; @import 'leaflet.markercluster/MarkerCluster'; @import 'leaflet.prunecluster/LeafletStyleSheet'; -@import 'geoportal/geoportal'; - /* ------- customize primary buttons -------- */ $mynewcolor:#0088ce; diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 9a11d6cc0..9159d7824 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -1,17 +1,11 @@ /* - * This is a manifest file that'll be compiled into application.css, which will include all the files - * listed below. - * - * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's - * vendor/assets/stylesheets directory can be referenced here using a relative path. - * - * You're free to add application-wide styles to this file and they'll appear at the bottom of the - * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS - * files in this directory. Styles in this file should be added after the last require_* statement. - * It is generally better to create a new file per style scope. - * - *= require_tree . - *= require chosen - *= require 'blacklight_advanced_search' - *= require_self - */ +*= require leaflet-label +*= require chosen +*= require 'blacklight_advanced_search' +*/ +@import 'customizations'; +@import 'bootstrap'; +@import 'blacklight'; +@import 'geoblacklight'; +@import 'geoportal'; +@import 'gblsci'; diff --git a/app/assets/stylesheets/blacklight.scss b/app/assets/stylesheets/blacklight.scss deleted file mode 100644 index 9824fd912..000000000 --- a/app/assets/stylesheets/blacklight.scss +++ /dev/null @@ -1,4 +0,0 @@ -// Big Ten Academic Alliance -$brand-primary: #0088ce; -@import 'bootstrap'; -@import 'blacklight/blacklight'; diff --git a/app/assets/stylesheets/geoportal/_navbar.scss b/app/assets/stylesheets/geoportal/_navbar.scss index ff02a81f5..fef0382e4 100644 --- a/app/assets/stylesheets/geoportal/_navbar.scss +++ b/app/assets/stylesheets/geoportal/_navbar.scss @@ -43,7 +43,7 @@ div#application-header { overflow:visible; text-indent:0; border:none; - + height: 50px; } .navbar-brand:hover { color: $white !important; diff --git a/app/assets/stylesheets/geoportal/geoportal.scss b/app/assets/stylesheets/geoportal/geoportal.scss index c4385a5ee..a7ca2f25e 100644 --- a/app/assets/stylesheets/geoportal/geoportal.scss +++ b/app/assets/stylesheets/geoportal/geoportal.scss @@ -14,3 +14,8 @@ @import 'tools'; @import 'universal_viewer'; @import 'viewer'; + +// Fix missing pull-right +.pull-right { + float: right; +} diff --git a/app/controllers/catalog_controller.rb b/app/controllers/catalog_controller.rb index 6a7bb5243..843719d1d 100644 --- a/app/controllers/catalog_controller.rb +++ b/app/controllers/catalog_controller.rb @@ -262,11 +262,13 @@ class CatalogController < ApplicationController config.add_show_tools_partial :more_details, partial: 'more_details', if: proc { |_context, _config, options| options[:document] && (!options[:document].references.nil? & !options[:document].references.url.nil?)} config.add_show_tools_partial :metadata, if: proc { |_context, _config, options| options[:document] && (Settings.METADATA_SHOWN & options[:document].references.refs.map(&:type).map(&:to_s)).any? } config.add_show_tools_partial :web_services, if: proc { |_context, _config, options| options[:document] && (Settings.WEBSERVICES_SHOWN & options[:document].references.refs.map(&:type).map(&:to_s)).any? } - config.add_show_tools_partial :exports, partial: 'exports', if: proc { |_context, _config, options| options[:document] } - config.add_show_tools_partial :data_dictionary, partial: 'data_dictionary', if: proc { |_context, _config, options| options[:document] && options[:document].data_dictionary_download.present?} + config.add_show_tools_partial :carto, partial: 'carto', if: proc { |_context, _config, options| options[:document] && options[:document].carto_reference.present? } + config.add_show_tools_partial :arcgis, partial: 'arcgis', if: proc { |_context, _config, options| options[:document] && options[:document].arcgis_urls.present? } + config.add_show_tools_partial :data_dictionary, partial: 'data_dictionary', if: proc { |_context, _config, options| options[:document] && options[:document].data_dictionary_download.present? } config.add_show_tools_partial(:citation) config.add_show_tools_partial(:access_links, partial: 'access_links', if: proc { |_context, _config, options| options[:document] && options[:document].access_links.present?}) + # Remove nav actions config.add_nav_action(:bookmark, partial: 'blacklight/nav/bookmark', if: false) diff --git a/app/views/catalog/_index_mapview_default.html.erb b/app/views/catalog/_index_mapview_default.html.erb index 58d97d71b..0a8c3694a 100644 --- a/app/views/catalog/_index_mapview_default.html.erb +++ b/app/views/catalog/_index_mapview_default.html.erb @@ -1,22 +1,30 @@ <% # header bar for doc items in index view -%> -<%= content_tag :div, class: 'documentHeader row', data: { layer_id: document.id, bbox: document.bounding_box_as_wsen } do %> -
- <%= render partial: 'header_icons', locals: { document: document } %> -
-

- +<%= content_tag :div, class: 'documentHeader index-split row', data: { layer_id: document.id, bbox: document.bounding_box_as_wsen } do %> +

<% counter = document_counter_with_offset(document_counter) %> <%= t('blacklight.search.documents.counter', :counter => counter) if counter %> - <%= link_to_document document, counter: counter, title: document[blacklight_config.index.title_field] %> + <%= link_to_document document, counter: counter %>

+ + <%= render partial: 'header_icons', locals: { document: document } %> -
-
- - <%= geoblacklight_present(:index_fields_display, document) %> - -
-
+ +
<% end %> + +
+
+ + <%= geoblacklight_present(:index_fields_display, document) %> + +
+
diff --git a/app/views/relation/_descendants.html.erb b/app/views/relation/_descendants.html.erb deleted file mode 100644 index 35cf26b1d..000000000 --- a/app/views/relation/_descendants.html.erb +++ /dev/null @@ -1,17 +0,0 @@ -
  • - <%= t('geoblacklight.relations.descendant', count: @relations.descendants['numFound']) %> -
  • -<% @relations.descendants['docs'][0..2].each do |descendant| %> -
  • - <%= link_to solr_document_path(descendant['layer_slug_s']) do %> - <%= descendant['dc_title_s'] %> - <% end %> -
  • -<% end %> -<% unless (@relations.descendants['numFound'].to_i <= 3) %> -
  • - <%= link_to search_catalog_path({f: {"#{Settings.FIELDS.SOURCE}" => [@relations.link_id]}}) do %> - <%= t('geoblacklight.relations.browse_all', count: @relations.descendants['numFound']) %> - <% end %> -
  • -<% end %> diff --git a/app/views/relation/index.html.erb b/app/views/relation/index.html.erb deleted file mode 100644 index f1338c5a7..000000000 --- a/app/views/relation/index.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -<% unless @relations.empty? %> -
    -

    - <%= t('geoblacklight.relations.title') %> -

    - -
      - <%= render 'ancestors' unless @relations.ancestors['numFound'].to_i == 0 %> - <%= render 'descendants' unless @relations.descendants['numFound'].to_i == 0 %> -
    - -
    -<% end %> diff --git a/test/system/show_page_test.rb b/test/system/show_page_test.rb index 394ab8e8d..89d4078e8 100644 --- a/test/system/show_page_test.rb +++ b/test/system/show_page_test.rb @@ -265,7 +265,6 @@ def test_collection_ancestor visit '/catalog/e84a24f0-1c00-4235-a584-db5d7551cbe6' # Data Relations - assert page.has_content?("Related Items") assert page.has_content?("Collection") end From 3d34971ffc812e28bdec4423b6f6e53ede705432 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Fri, 9 Apr 2021 12:48:29 -0500 Subject: [PATCH 12/17] GEMS: GBL to 3.2.0 --- Gemfile | 2 +- Gemfile.lock | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index f2fbae629..73d5ca5be 100644 --- a/Gemfile +++ b/Gemfile @@ -62,7 +62,7 @@ gem 'chosen-rails' # jquery multiselect plugin for advanced search gem 'bootstrap', '~> 4.0' gem 'popper_js' gem 'twitter-typeahead-rails', '0.11.1.pre.corejavascript' -gem 'geoblacklight', '3.0.0' +gem 'geoblacklight', '3.2.0' gem "rubyzip", ">= 1.3.0" gem "awesome_print" diff --git a/Gemfile.lock b/Gemfile.lock index c1585e1ba..1a82062a1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -220,7 +220,7 @@ GEM rsolr sanitize thor - geoblacklight (3.0.0) + geoblacklight (3.2.0) blacklight (~> 7.0) coderay config @@ -230,8 +230,7 @@ GEM geo_combine (~> 0.4) handlebars_assets mime-types - rails (>= 5.2.4, < 6.1) - webpacker (~> 4.0) + rails (>= 5.2.4, < 6.2) geoblacklight_sidecar_images (0.7.0) geoblacklight (>= 2.0) image_processing (~> 1.6) @@ -515,7 +514,7 @@ DEPENDENCIES exception_notification (~> 4.3.0) factory_bot_rails foreman - geoblacklight (= 3.0.0) + geoblacklight (= 3.2.0) geoblacklight-icons! geoblacklight_sidecar_images (~> 0.7.0) haml From ce59590bbac560553e947c0027a81394d6d43dde Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Fri, 9 Apr 2021 14:38:56 -0500 Subject: [PATCH 13/17] Gems: GBL to 3.3.0 --- Gemfile | 2 +- Gemfile.lock | 8 +- app/assets/javascripts/application.js | 14 ++- .../geoblacklight/modules/results.js | 38 ++++----- .../javascripts/geoblacklight/viewers/esri.js | 2 +- .../viewers/esri/dynamic_map_layer.js | 85 ------------------- .../catalog/_index_mapview_default.html.erb | 2 +- .../catalog/_index_split_default.html.erb | 2 +- .../_show_default_viewer_container.html.erb | 6 +- .../catalog/_show_static_map_bbox.html.erb | 2 +- 10 files changed, 42 insertions(+), 119 deletions(-) delete mode 100644 app/assets/javascripts/geoblacklight/viewers/esri/dynamic_map_layer.js diff --git a/Gemfile b/Gemfile index 73d5ca5be..5d4bada36 100644 --- a/Gemfile +++ b/Gemfile @@ -62,7 +62,7 @@ gem 'chosen-rails' # jquery multiselect plugin for advanced search gem 'bootstrap', '~> 4.0' gem 'popper_js' gem 'twitter-typeahead-rails', '0.11.1.pre.corejavascript' -gem 'geoblacklight', '3.2.0' +gem 'geoblacklight', '3.3.0' gem "rubyzip", ">= 1.3.0" gem "awesome_print" diff --git a/Gemfile.lock b/Gemfile.lock index 1a82062a1..1007d7ba9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -220,7 +220,7 @@ GEM rsolr sanitize thor - geoblacklight (3.2.0) + geoblacklight (3.3.0) blacklight (~> 7.0) coderay config @@ -231,6 +231,7 @@ GEM handlebars_assets mime-types rails (>= 5.2.4, < 6.2) + rgeo-geojson geoblacklight_sidecar_images (0.7.0) geoblacklight (>= 2.0) image_processing (~> 1.6) @@ -371,6 +372,9 @@ GEM actionpack (>= 5.0) railties (>= 5.0) retriable (3.1.2) + rgeo (2.2.0) + rgeo-geojson (2.1.1) + rgeo (>= 1.0.0) rsolr (2.3.0) builder (>= 2.1.2) faraday (>= 0.9.0) @@ -514,7 +518,7 @@ DEPENDENCIES exception_notification (~> 4.3.0) factory_bot_rails foreman - geoblacklight (= 3.2.0) + geoblacklight (= 3.3.0) geoblacklight-icons! geoblacklight_sidecar_images (~> 0.7.0) haml diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index f22016529..207dcd2f1 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -63,8 +63,8 @@ GeoBlacklight.Viewer.Map = GeoBlacklight.Viewer.extend({ overlay: L.layerGroup(), load: function() { - if (this.data.mapBbox) { - this.options.bbox = L.bboxToBounds(this.data.mapBbox); + if (this.data.mapGeom) { + this.options.bbox = L.geoJSONToBounds(this.data.mapGeom); } this.map = L.map(this.element, {scrollWheelZoom:false, noWrap: true}).fitBounds(this.options.bbox); this.map.addLayer(this.selectBasemap()); @@ -103,6 +103,16 @@ GeoBlacklight.Viewer.Map = GeoBlacklight.Viewer.extend({ this.map.addControl(new L.Control.LayerOpacity(this.overlay)); }, + /** + * Add a GeoJSON overlay to map. + * @param {string} geojson GeoJSON string + */ + addGeoJsonOverlay: function(geojson) { + var layer = L.geoJSON(); + layer.addData(geojson); + this.overlay.addLayer(layer); + }, + /** * Selects basemap if specified in data options, if not return mapquest */ diff --git a/app/assets/javascripts/geoblacklight/modules/results.js b/app/assets/javascripts/geoblacklight/modules/results.js index 4a4b2ab54..c43a4e5e0 100644 --- a/app/assets/javascripts/geoblacklight/modules/results.js +++ b/app/assets/javascripts/geoblacklight/modules/results.js @@ -11,35 +11,29 @@ Blacklight.onLoad(function() { $('[data-map="index"]').each(function() { var data = $(this).data(), opts = { baseUrl: data.catalogPath }, + world = L.latLngBounds([[-90, -180], [90, 180]]), geoblacklight, bbox; - var lngRe = '(-?[0-9]{1,2}(\\.[0-9]+)?)'; - var latRe = '(-?[0-9]{1,3}(\\.[0-9]+)?)'; - - var parseableBbox = new RegExp( - [lngRe,latRe,lngRe,latRe].join('\\s+') - ); - - if (typeof data.mapBbox === 'string') { - bbox = L.bboxToBounds(data.mapBbox); + if (typeof data.mapGeom === 'string') { + bbox = L.geoJSONToBounds(data.mapGeom); } else { - $('.document [data-bbox]').each(function() { - var currentBbox = $(this).data().bbox; - if (parseableBbox.test(currentBbox)) { + $('.document [data-geom]').each(function() { + try { + var currentBounds = L.geoJSONToBounds($(this).data().geom); + if (!world.contains(currentBounds)) { + throw "Invalid bounds"; + } if (typeof bbox === 'undefined') { - bbox = L.bboxToBounds(currentBbox); + bbox = currentBounds; } else { - bbox.extend(L.bboxToBounds(currentBbox)); + bbox.extend(currentBounds); } - } else { - // bbox not parseable, use default value. - // [[-180, -90], [180, 90]]; + } catch (e) { bbox = L.bboxToBounds("-180 -90 180 90"); } }); } - if (!historySupported) { $.extend(opts, { dynamic: false, @@ -75,9 +69,9 @@ Blacklight.onLoad(function() { // set hover listeners on map $('#content') .on('mouseenter', '#documents [data-layer-id]', function() { - if($(this).data('bbox').length > 0) { - var bounds = L.bboxToBounds($(this).data('bbox')); - geoblacklight.addBoundsOverlay(bounds); + if($(this).data('bbox') !== "") { + var geom = $(this).data('geom') + geoblacklight.addGeoJsonOverlay(geom) } }) .on('mouseleave', '#documents [data-layer-id]', function() { @@ -96,6 +90,7 @@ Blacklight.onLoad(function() { $('#sidebar').replaceWith($doc.find('#sidebar')); $('#sortAndPerPage').replaceWith($doc.find('#sortAndPerPage')); $('#appliedParams').replaceWith($doc.find('#appliedParams')); + $('#pagination').replaceWith($doc.find('#pagination')); if ($('#map').next().length) { $('#map').next().replaceWith($doc.find('#map').next()); } else { @@ -103,5 +98,4 @@ Blacklight.onLoad(function() { } }); } - }); diff --git a/app/assets/javascripts/geoblacklight/viewers/esri.js b/app/assets/javascripts/geoblacklight/viewers/esri.js index b0628c510..444b33583 100644 --- a/app/assets/javascripts/geoblacklight/viewers/esri.js +++ b/app/assets/javascripts/geoblacklight/viewers/esri.js @@ -5,7 +5,7 @@ GeoBlacklight.Viewer.Esri = GeoBlacklight.Viewer.Map.extend({ load: function() { this.displayLayerLoading(); - this.options.bbox = L.bboxToBounds(this.data.mapBbox); + this.options.bbox = L.geoJSONToBounds(this.data.mapGeom); this.map = L.map(this.element).fitBounds(this.options.bbox); this.map.addLayer(this.selectBasemap()); this.map.addLayer(this.overlay); diff --git a/app/assets/javascripts/geoblacklight/viewers/esri/dynamic_map_layer.js b/app/assets/javascripts/geoblacklight/viewers/esri/dynamic_map_layer.js deleted file mode 100644 index de3e381fc..000000000 --- a/app/assets/javascripts/geoblacklight/viewers/esri/dynamic_map_layer.js +++ /dev/null @@ -1,85 +0,0 @@ -//= require geoblacklight/viewers/esri - -GeoBlacklight.Viewer.DynamicMapLayer = GeoBlacklight.Viewer.Esri.extend({ - - // override to parse between dynamic layer types - getEsriLayer: function() { - var _this = this; - - // remove any trailing slash from endpoint url - _this.data.url = _this.data.url.replace(/\/$/, ''); - - // get last segment from url - var pathArray = this.data.url.replace(/\/$/, '').split('/'); - var lastSegment = pathArray[pathArray.length - 1]; - - // if the last seg is an integer, slice and save as dynamicLayerId - if (Number(lastSegment) === parseInt(lastSegment, 10)) { - this.dynamicLayerId = lastSegment; - this.data.url = this.data.url.slice(0,-(lastSegment.length + 1)); - } - - L.esri.get(_this.data.url, {}, function(error, response){ - if(!error) { - _this.layerInfo = response; - - // get layer - var layer = _this.getPreviewLayer(); - - // add layer to map - if (_this.addPreviewLayer(layer)) { - - // add controls if layer is added - _this.loadControls(); - } - } - }); - }, - - getPreviewLayer: function() { - - // set layer url - this.options.url = this.data.url; - - // show only single layer, if specified - if (this.dynamicLayerId) { - this.options.layers = [this.dynamicLayerId]; - } - - var esriDynamicMapLayer = L.esri.dynamicMapLayer(this.options); - - // setup feature inspection - this.setupInspection(esriDynamicMapLayer); - return esriDynamicMapLayer; - }, - - setupInspection: function(layer) { - var _this = this; - this.map.on('click', function(e) { - _this.appendLoadingMessage(); - - // query layer at click location - var identify = L.esri.identifyFeatures({ - url: layer.options.url, - useCors: true - }) - .tolerance(2) - .returnGeometry(false) - .on(_this.map) - .at(e.latlng); - - // query specific layer if dynamicLayerId is set - if (_this.dynamicLayerId) { - identify.layers('all: ' + _this.dynamicLayerId); - } - - identify.run(function(error, featureCollection, response){ - if (error) { - _this.appendErrorMessage(); - } else { - _this.populateAttributeTable(featureCollection.features[0]); - } - }); - }); - } -}); diff --git a/app/views/catalog/_index_mapview_default.html.erb b/app/views/catalog/_index_mapview_default.html.erb index 0a8c3694a..b087dd0a6 100644 --- a/app/views/catalog/_index_mapview_default.html.erb +++ b/app/views/catalog/_index_mapview_default.html.erb @@ -1,5 +1,5 @@ <% # header bar for doc items in index view -%> -<%= content_tag :div, class: 'documentHeader index-split row', data: { layer_id: document.id, bbox: document.bounding_box_as_wsen } do %> +<%= content_tag :div, class: 'documentHeader index-split row', data: { layer_id: document.id, geom: document.geometry.geojson } do %>

    <% counter = document_counter_with_offset(document_counter) %> diff --git a/app/views/catalog/_index_split_default.html.erb b/app/views/catalog/_index_split_default.html.erb index 6f05544e6..451553e8e 100644 --- a/app/views/catalog/_index_split_default.html.erb +++ b/app/views/catalog/_index_split_default.html.erb @@ -1,5 +1,5 @@ <% # header bar for doc items in index view -%> -<%= content_tag :div, class: 'documentHeader row', data: { layer_id: document.id, bbox: document.bounding_box_as_wsen } do %> +<%= content_tag :div, class: 'documentHeader row', data: { layer_id: document.id, geom: document.geometry.geojson } do %>
    <% counter = document_counter_with_offset(document_counter) %> diff --git a/app/views/catalog/_show_default_viewer_container.html.erb b/app/views/catalog/_show_default_viewer_container.html.erb index 7629c68a7..2a71a23ca 100644 --- a/app/views/catalog/_show_default_viewer_container.html.erb +++ b/app/views/catalog/_show_default_viewer_container.html.erb @@ -13,15 +13,15 @@ <% end %> <% if document.viewer_protocol == "b1g_image" %> - <%= content_tag :div, id: 'map', class: "b1g_image", data: { map: 'item', protocol: "B1gImage", url: "#{remote_image_link(document.b1g_image)}", 'layer-id' => document.wxs_identifier, 'map-bbox' => document.bounding_box_as_wsen, 'catalog-path'=> search_catalog_path, available: document_available?, inspect: show_attribute_table?, basemap: geoblacklight_basemap, leaflet_options: leaflet_options } do %> + <%= content_tag :div, id: 'map', class: "b1g_image", data: { map: 'item', protocol: "B1gImage", url: "#{remote_image_link(document.b1g_image)}", 'layer-id' => document.wxs_identifier, 'map-geom' => document.geometry.geojson, 'catalog-path'=> search_catalog_path, available: document_available?, inspect: show_attribute_table?, basemap: geoblacklight_basemap, leaflet_options: leaflet_options } do %> <% end %> <% elsif document.viewer_protocol != "download" %> - <%= content_tag :div, id: 'map', data: { map: 'item', protocol: document.viewer_protocol.camelize, url: document.viewer_endpoint, 'layer-id' => document.wxs_identifier, 'map-bbox' => document.bounding_box_as_wsen, 'catalog-path'=> search_catalog_path, available: document_available?, inspect: show_attribute_table?, basemap: geoblacklight_basemap, leaflet_options: leaflet_options } do %> + <%= content_tag :div, id: 'map', data: { map: 'item', protocol: document.viewer_protocol.camelize, url: document.viewer_endpoint, 'layer-id' => document.wxs_identifier, 'map-geom' => document.geometry.geojson, 'catalog-path'=> search_catalog_path, available: document_available?, inspect: show_attribute_table?, basemap: geoblacklight_basemap, leaflet_options: leaflet_options } do %> <% end %> <% else %> - <%= content_tag :div, id: 'map', class: "", data: { map: 'item', protocol: document.viewer_protocol.camelize, url: "#{remote_image_link(document.viewer_endpoint)}", 'layer-id' => document.wxs_identifier, 'map-bbox' => document.bounding_box_as_wsen, 'catalog-path'=> search_catalog_path, available: document_available?, inspect: show_attribute_table?, basemap: geoblacklight_basemap, leaflet_options: leaflet_options } do %> + <%= content_tag :div, id: 'map', class: "", data: { map: 'item', protocol: document.viewer_protocol.camelize, url: "#{remote_image_link(document.viewer_endpoint)}", 'layer-id' => document.wxs_identifier, 'map-geom' => document.geometry.geojson, 'catalog-path'=> search_catalog_path, available: document_available?, inspect: show_attribute_table?, basemap: geoblacklight_basemap, leaflet_options: leaflet_options } do %> <% end %> <% end %>
    diff --git a/app/views/catalog/_show_static_map_bbox.html.erb b/app/views/catalog/_show_static_map_bbox.html.erb index 6e3c750f7..db7d5ac82 100644 --- a/app/views/catalog/_show_static_map_bbox.html.erb +++ b/app/views/catalog/_show_static_map_bbox.html.erb @@ -13,7 +13,7 @@

    - <%= content_tag :div, id: 'static-map', data: { map: 'item', protocol: 'Map', url: @document.viewer_endpoint, 'layer-id' => @document.wxs_identifier, 'map-bbox' => @document.bounding_box_as_wsen, 'catalog-path'=> search_catalog_path, available: document_available?, inspect: show_attribute_table?, basemap: 'esri', leaflet_options: leaflet_options } do %> + <%= content_tag :div, id: 'static-map', data: { map: 'item', protocol: 'Map', url: @document.viewer_endpoint, 'layer-id' => @document.wxs_identifier, 'map-geom' => @document.geometry.geojson, 'catalog-path'=> search_catalog_path, available: document_available?, inspect: show_attribute_table?, basemap: 'esri', leaflet_options: leaflet_options } do %> <% end %>
    From 449fa792a093dcaeaaf39e756fa8350e92f1ab1c Mon Sep 17 00:00:00 2001 From: Gene Cheng <55412116+Ziiiiing@users.noreply.github.com> Date: Tue, 13 Apr 2021 02:23:05 +0800 Subject: [PATCH 14/17] Add 4th input box for Advanced Search (#351) --- app/helpers/advanced_helper.rb | 29 +++++++++++++++++-- .../advanced/_guided_search_fields.html.erb | 11 +++++++ 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/app/helpers/advanced_helper.rb b/app/helpers/advanced_helper.rb index 09531a6ed..a6a6efd65 100644 --- a/app/helpers/advanced_helper.rb +++ b/app/helpers/advanced_helper.rb @@ -46,7 +46,7 @@ def advanced_key_value # carries over original search field and original guided search fields if user switches to guided search from regular search def guided_field(field_num, default_val) - if field_num == :f1 && params[:f1].nil? && params[:f2].nil? && params[:f3].nil? && params[:search_field] && search_fields_for_advanced_search[params[:search_field]] + if field_num == :f1 && params[:f1].nil? && params[:f2].nil? && params[:f3].nil? && params[:f4].nil? && params[:search_field] && search_fields_for_advanced_search[params[:search_field]] return search_fields_for_advanced_search[params[:search_field]].key || default_val end params[field_num] || default_val @@ -54,7 +54,7 @@ def guided_field(field_num, default_val) # carries over original search query if user switches to guided search from regular search def guided_context(key) - key == :q1 && params[:f1].nil? && params[:f2].nil? && params[:f3].nil? && + key == :q1 && params[:f1].nil? && params[:f2].nil? && params[:f3].nil? && params[:f4].nil? && params[:search_field] && search_fields_for_advanced_search[params[:search_field]] end @@ -81,7 +81,10 @@ def keyword_op unless @params[:q3].blank? || @params[:op3] == 'NOT' || (@params[:q1].blank? && @params[:q2].blank?) @keyword_op << @params[:op3] unless [@params[:f1], @params[:f2]].include?(@params[:f3]) && ((@params[:f1] == @params[:f3] && @params[:q1].present?) || (@params[:f2] == @params[:f3] && @params[:q2].present?)) end - @keyword_op + unless @params[:q4].blank? || @params[:op4] == 'NOT' || (@params[:q1].blank? && @params[:q2].blank? && @params[:q3].blank?) + @keyword_op << @params[:op4] unless [@params[:f1], @params[:f2], @params[:f3]].include?(@params[:f4]) && ((@params[:f1] == @params[:f4] && @params[:q1].present?) || (@params[:f2] == @params[:f4] && @params[:q2].present?) || (@params[:f3] == @params[:f4] && @params[:q3].present?)) + end + @keyword_op end def keyword_queries @@ -93,6 +96,7 @@ def keyword_queries q1 = @params[:q1] q2 = @params[:q2] q3 = @params[:q3] + q4 = @params[:q4] been_combined = false @keyword_queries[@params[:f1]] = q1 if @params[:q1].present? @@ -116,6 +120,16 @@ def keyword_queries @keyword_queries[@params[:f3]] = q3 end end + if @params[:q4].present? + if @keyword_queries.key?(@params[:f4]) + @keyword_queries[@params[:f4]] = "(#{@keyword_queries[@params[:f4]]})" unless been_combined + @keyword_queries[@params[:f4]] = "#{@keyword_queries[@params[:f4]]} " + @params[:op4] + " (#{q4})" + elsif @params[:op4] == 'NOT' + @keyword_queries[@params[:f4]] = 'NOT ' + q4 + else + @keyword_queries[@params[:f4]] = q4 + end + end end @keyword_queries @@ -179,6 +193,15 @@ def guided_search(my_params = params) remove: search_catalog_path(remove_guided_keyword_query(%i[f3 q3 op3], my_params)) ) end + if my_params[:q4].present? + label = blacklight_config.search_fields[my_params[:f4]][:label] + query = my_params[:q4] + query = 'NOT ' + my_params[:q4] if my_params[:op4] == 'NOT' + constraints << render_constraint_element( + label, query, + remove: search_catalog_path(remove_guided_keyword_query(%i[f4 q4 op4], my_params)) + ) + end constraints end diff --git a/app/views/advanced/_guided_search_fields.html.erb b/app/views/advanced/_guided_search_fields.html.erb index c7e76c7bc..bfa2e5320 100644 --- a/app/views/advanced/_guided_search_fields.html.erb +++ b/app/views/advanced/_guided_search_fields.html.erb @@ -28,4 +28,15 @@ <%= text_field_tag "q3", label_tag_default_for(:q3), :class => 'form-control', autocorrect: "off", autocapitalize: "off", spellcheck: "false" %> +
    + + + +
    +
    + <%= select_tag('f4', options_for_select(advanced_key_value, guided_field(:f4, 'placename')), {class: 'form-control'}) %> +
    + <%= text_field_tag "q4", label_tag_default_for(:q4), :class => 'form-control', autocorrect: "off", autocapitalize: "off", spellcheck: "false" %> +
    +
    From a367c31be41626cdad03318974a74cb4ad31cbc1 Mon Sep 17 00:00:00 2001 From: Gene Cheng <55412116+Ziiiiing@users.noreply.github.com> Date: Tue, 4 May 2021 00:43:12 +0800 Subject: [PATCH 15/17] Add Twitter logo to footer (#350) * Add Twitter to footer * Add an alt text to twitter logo * Update search_results_test.rb Add footer Twitter link test. Closes #350 Co-authored-by: Eric Larson --- app/assets/images/twitter-logo.png | Bin 0 -> 7272 bytes app/assets/stylesheets/geoportal/_footer.scss | 4 ++++ app/views/shared/_footer_app.html.haml | 3 +++ test/system/search_results_test.rb | 1 + 4 files changed, 8 insertions(+) create mode 100644 app/assets/images/twitter-logo.png diff --git a/app/assets/images/twitter-logo.png b/app/assets/images/twitter-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..a9f08a1bd4e2434f743e4b72f013f58fc617814f GIT binary patch literal 7272 zcmbVRXH*kgv<8$GS^}X+C$u2aMMG}^0xCtNN|6rI5kl_-f(Qfz5or=ouF{n%O^^=K zlwv?Sf)_(Klu+Jy|GgjY&zrSo_Bu1??3r`Ux4&H`*~Cbn3B(PeprBwfKq2n}vj6W1 zrU9;J{Q*A!aoJ7ljur()Z92oL12xd5e0*15o1$uj_ZQF*bVA*|LqQQHMnMsiKtXW= z+=|(tpa_zsp!oM81%>hp3JOlY{Ew!pzylh`Tlz>q0>`mVOEe(p{ZLkq0g3wW)En?r zr=Z}WH9%_J4tfHQ@O&;A3o&K5c zR{7yDj6|-gpP%M}{r?USzrG43Y)`|pvc3TYaY|KehzMQb>O+X$TAqCGQfo^vFbFx@ zF!j<1yZ$k9=heM#iDl?O|Jc0D6D9^aQ>qUTp4yE4(LVZiT?Q}jZ*;YKslT0S9k)(N z0@291CJ4smEUfOPx3>DN97por8XQq(>?t7gq?bxNi^2q6)y5(I)8|J`y_sb9$sb4x z$K;4YxPF?Tv<>#?R~h`;c1L>G`^RPIL?kjcN!zqpJ~2O$Q7im24Ub{RY249nA66|) z@Z+S8A#X@g{$u8}B1TP+zgjE#4%TA$WD4D@^lc=spCKgrg6NBF zCEl1p6SZ4U_vS92mrO+}=Q zlC%{>nnGCJY$$6ey}-;=rQG4SBmqayyP0UatcMk~y*{&vy^|JBTQ#4Pew^&;whnyM zXX)UahCLI{XfZ)lHPcjDeE?e_P@mu4!#4i-iCzM4ae_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UNKSYhj!)GEaG~YjIpDnl7h>#5@AxCvN{9qFzYS_kk?TE7=n--u7uA%^w zIc|?xy^MK{_O5d-V7>x+rt|?jCo*aqu|rAlZH+|)ONVjDyU>|B(s@x14ETZ=!mr&2 z?;#t3($R1MkF9K}39s6_04_O|yAOZ2ebv#@!;OO7kO*a!-FIV23uXdj8u zmUCk!d~ho{>*2J~Oosaw%Ls;Q#Y))misNXQ{HQz#P~ueOxX(D%#mU^``u*3ZIJS%4 zRP5WgN8x}ypBFN4ywc=Fyeg0|#fe5x4&3?~c-YJ31o&k74T9&m&kR`nO(Iimn~f4N z;`0}4-fbW)-L-4uCMtT$&jKBvU(l2BjU zW-jGbZO1q3qLzgeZT#S~kk;h=z_kvD3_REf@_D}r^-VOpe@$U`3M)IS`d4Ut+`DW`gjjJp>Wj)G44MW+gmWx5VlKcfUB_@aQ?* z>WM;ylhLj1-aHLuuXn94nflenBtR4AGc*10(pK`(7m~v9;(`CaUrR6;UY4x!kAeH2 zkd*VEz`rrkKwZl~XNN!+Wv2iaKv2lb%F9W~UYC-Sy)SoDSx#12{<@?rLRnT;-2CwL ze+}^Vb@p%#{l5p8GZr8O>bFunZRI=z(AJ(X+Vu;1sf}%mBK*R2wA25 HFz$Z Date: Fri, 7 May 2021 10:41:28 -0500 Subject: [PATCH 16/17] Ruby 2.7.3 Updated Ruby and bundle update bootsnap --- .ruby-version | 2 +- Gemfile.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.ruby-version b/.ruby-version index 6a6a3d8e3..2c9b4ef42 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.6.1 +2.7.3 diff --git a/Gemfile.lock b/Gemfile.lock index 1007d7ba9..6420ab7e8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -90,7 +90,7 @@ GEM jquery-rails rails (>= 3.0) tether-rails - bootsnap (1.4.4) + bootsnap (1.7.5) msgpack (~> 1.0) bootstrap (4.3.1) autoprefixer-rails (>= 9.1.0) @@ -308,7 +308,7 @@ GEM builder minitest (>= 5.0) ruby-progressbar - msgpack (1.3.0) + msgpack (1.4.2) multipart-post (2.1.1) mysql2 (0.5.2) net-http-persistent (2.9.4) @@ -559,4 +559,4 @@ DEPENDENCIES whenever (~> 0.9.0) BUNDLED WITH - 2.2.9 + 2.2.17 From de2dee522d80e8c13ffd92fbf72fd08b7c653dd5 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Fri, 7 May 2021 10:43:14 -0500 Subject: [PATCH 17/17] README: bump for 2.4.0 release 2.4.0 is Ruby 2.7.3 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 794c17453..504dda4da 100644 --- a/README.md +++ b/README.md @@ -29,4 +29,4 @@ Visit the [project wiki](https://github.com/BTAA-Geospatial-Data-Project/geoport #### Release Version -B1G Geoportal Version 2.3.14 / GeoBlacklight 2.2.1 +B1G Geoportal Version 2.4.0 / GeoBlacklight 2.2.1