Skip to content

Commit

Permalink
initial update to v.4.0
Browse files Browse the repository at this point in the history
Made core code changes to get application up to v4.0, following the upgrade guide: https://geoblacklight.org/docs/upgrading/Upgrading_to_version_4_0/
  • Loading branch information
rmseifried committed Apr 5, 2023
1 parent 5e68991 commit b8f91b1
Show file tree
Hide file tree
Showing 57 changed files with 800 additions and 244 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'blacklight', '~> 7.0'
gem 'geoblacklight', '~> 4.0.0.pre.rc2'
gem 'geoblacklight', '~> 4.0'
gem 'sprockets', '< 4.0'

group :development, :test do
Expand Down
36 changes: 20 additions & 16 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,10 @@ GEM
childprocess (3.0.0)
coderay (1.1.3)
concurrent-ruby (1.1.9)
config (4.0.0)
config (4.1.0)
deep_merge (~> 1.2, >= 1.2.1)
dry-validation (~> 1.0, >= 1.0.0)
connection_pool (2.4.0)
crass (1.0.6)
deep_merge (1.2.2)
deprecation (1.1.0)
Expand All @@ -121,22 +122,21 @@ GEM
dry-configurable (0.15.0)
concurrent-ruby (~> 1.0)
dry-core (~> 0.6)
dry-container (0.9.0)
dry-container (0.11.0)
concurrent-ruby (~> 1.0)
dry-configurable (~> 0.13, >= 0.13.0)
dry-core (0.7.1)
dry-core (0.8.1)
concurrent-ruby (~> 1.0)
dry-inflector (0.2.1)
dry-inflector (0.3.0)
dry-initializer (3.1.1)
dry-logic (1.2.0)
concurrent-ruby (~> 1.0)
dry-core (~> 0.5, >= 0.5)
dry-schema (1.9.3)
dry-schema (1.10.6)
concurrent-ruby (~> 1.0)
dry-configurable (~> 0.13, >= 0.13.0)
dry-core (~> 0.5, >= 0.5)
dry-initializer (~> 3.0)
dry-logic (~> 1.0)
dry-logic (~> 1.2)
dry-types (~> 1.5)
dry-types (1.5.1)
concurrent-ruby (~> 1.0)
Expand All @@ -157,19 +157,22 @@ GEM
multipart-post (>= 1.2, < 3)
ruby2_keywords
faraday-net_http (1.0.1)
faraday-net_http_persistent (2.0.2)
faraday-net_http (< 3)
net-http-persistent (~> 4.0)
ffi (1.15.0)
ffi-compiler (1.0.1)
ffi (>= 1.0.0)
rake
geo_combine (0.6.0)
geo_combine (0.7.0)
activesupport
faraday-net_http_persistent (~> 2.0)
json-schema
net-http-persistent (~> 2.0)
nokogiri
rsolr
sanitize
thor
geoblacklight (4.0.0.pre.rc2)
geoblacklight (4.0.0)
blacklight (~> 7.12)
coderay
config
Expand All @@ -178,7 +181,7 @@ GEM
geo_combine (~> 0.4)
handlebars_assets
mime-types
rails (>= 6.1, < 7)
rails (>= 6.1, < 7.1)
rgeo-geojson
globalid (1.0.0)
activesupport (>= 5.0)
Expand Down Expand Up @@ -232,14 +235,15 @@ GEM
method_source (1.0.0)
mime-types (3.4.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2022.0105)
mime-types-data (3.2023.0218.1)
mini_mime (1.1.2)
mini_portile2 (2.6.1)
minitest (5.14.4)
msgpack (1.4.2)
multipart-post (2.1.1)
mysql2 (0.5.3)
net-http-persistent (2.9.4)
net-http-persistent (4.0.2)
connection_pool (~> 2.2)
nio4r (2.5.8)
nokogiri (1.12.5)
mini_portile2 (~> 2.6.1)
Expand Down Expand Up @@ -293,7 +297,7 @@ GEM
actionpack (>= 5.0)
railties (>= 5.0)
retriable (3.1.2)
rgeo (2.4.0)
rgeo (3.0.0)
rgeo-geojson (2.1.1)
rgeo (>= 1.0.0)
rsolr (2.3.0)
Expand All @@ -302,7 +306,7 @@ GEM
ruby-progressbar (1.11.0)
ruby2_keywords (0.0.4)
rubyzip (2.3.0)
sanitize (6.0.0)
sanitize (6.0.1)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
sass-rails (6.0.0)
Expand Down Expand Up @@ -385,7 +389,7 @@ DEPENDENCIES
devise
devise-guests (~> 0.6)
dotenv-rails
geoblacklight (~> 4.0.0.pre.rc2)
geoblacklight (~> 4.0)
jbuilder (~> 2.7)
jquery-rails
listen (~> 3.3)
Expand Down
183 changes: 95 additions & 88 deletions app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,15 @@ class CatalogController < ApplicationController
config.index.title_field = Settings.FIELDS.TITLE

# solr field configuration for document/show views

# This sets the metadata to display below the map viewer.
# To move metadata above the map viewer,
# remove the lines deleting and re-adding the :show partial
config.show.display_type_field = 'format'
config.show.partials.delete(:show)
config.show.partials << 'show_default_viewer_container'
config.show.partials << 'show_default_attribute_table'
config.show.partials << 'show_default_viewer_information'
config.show.partials << :show

##
# Configure the index document presenter.
Expand Down Expand Up @@ -102,102 +106,107 @@ class CatalogController < ApplicationController
config.add_facet_field Settings.FIELDS.THEME, :label => 'Theme', :limit =>20, :sort => 'index'
config.add_facet_field Settings.FIELDS.CREATOR, :label => 'Creator', :limit => 8
# config.add_facet_field Settings.FIELDS.PUBLISHER, :label => 'Publisher', :limit => 8
config.add_facet_field Settings.FIELDS.MEMBER_OF, :label => 'Collection', :limit => 8
config.add_facet_field Settings.FIELDS.PROVIDER, :label => 'Provider', :limit => 8, item_component: Geoblacklight::IconFacetItemComponent
config.add_facet_field Settings.FIELDS.GEOREFERENCED, :label => 'Georeferenced', :limit => 3
# config.add_facet_field Settings.FIELDS.SOURCE, :label => 'Collection', :limit => 8, :show => false
config.add_facet_field Settings.FIELDS.ANNOTATION, :label => 'Annotated', :limit => 8

# GEOBLACKLIGHT APPLICATION FACETS

# Map-Based "Search Here" Feature
# item_presenter - Defines how the facet appears in the GBL UI
# filter_query_builder - Defines the query generated for Solr
# filter_class - Defines how to add/remove facet from query
# label - Defines the label used in contstraints container
config.add_facet_field Settings.FIELDS.GEOMETRY, item_presenter: Geoblacklight::BboxItemPresenter, filter_class: Geoblacklight::BboxFilterField, filter_query_builder: Geoblacklight::BboxFilterQuery, within_boost: Settings.BBOX_WITHIN_BOOST, overlap_boost: Settings.OVERLAP_RATIO_BOOST, overlap_field: Settings.FIELDS.OVERLAP_FIELD, label: 'Bounding Box'

# Item Relationship Facets
# * Not displayed to end user (show: false)
# * Must be present for relationship "Browse all 4 records" links to work
# * Label value becomes the search contraint filter name
config.add_facet_field Settings.FIELDS.MEMBER_OF, label: 'Member Of', show: false
config.add_facet_field Settings.FIELDS.IS_PART_OF, label: 'Is Part Of', show: false
config.add_facet_field Settings.FIELDS.RELATION, label: 'Related', show: false
config.add_facet_field Settings.FIELDS.REPLACES, label: 'Replaces', show: false
config.add_facet_field Settings.FIELDS.IS_REPLACED_BY, label: 'Is Replaced By', show: false
config.add_facet_field Settings.FIELDS.SOURCE, label: 'Source', show: false
config.add_facet_field Settings.FIELDS.VERSION, label: 'Is Version Of', show: false

# 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.
config.add_facet_fields_to_solr_request!

#SEARCH RESULTS FIELDS

# solr fields to be displayed in the index (search results) view
# The ordering of the field names is the order of the display
# config.add_index_field Settings.FIELDS.PROVIDER, :label => 'Institution:'
# config.add_index_field Settings.FIELDS.RIGHTS, :label => 'Access:'
# # config.add_index_field 'Area', :label => 'Area:'
# config.add_index_field Settings.FIELDS.SUBJECT, :label => 'Keywords:'
config.add_index_field Settings.FIELDS.INDEX_YEAR
config.add_index_field Settings.FIELDS.CREATOR
config.add_index_field Settings.FIELDS.DESCRIPTION, helper_method: :snippit
#config.add_index_field Settings.FIELDS.PUBLISHER


#ITEM VIEW FIELDS

# solr fields to be displayed in the show (single result) view
# The ordering of the field names is the order of the display
# item_prop: [String] property given to span with Schema.org item property
# link_to_search: [Boolean] that can be passed to link to a facet search
# helper_method: [Symbol] method that can be used to render the value

config.add_show_field Settings.FIELDS.CREATOR, label: 'Creator(s)', itemprop: 'creator'
config.add_show_field Settings.FIELDS.TEMPORAL_COVERAGE, label: 'Year', itemprop: 'temporal'
config.add_show_field Settings.FIELDS.DESCRIPTION, label: 'Description', itemprop: 'description', helper_method: :render_value_as_truncate_abstract
config.add_show_field Settings.FIELDS.PUBLISHER, label: 'Publisher', itemprop: 'publisher'
config.add_show_field Settings.FIELDS.MEMBER_OF, label: 'Collection', itemprop: 'memberOf', link_to_facet: true
config.add_show_field Settings.FIELDS.SPATIAL_COVERAGE, label: 'Place(s)', itemprop: 'spatial', link_to_facet: true
config.add_show_field Settings.FIELDS.THEME, label: 'Theme(s)', itemprop: 'keywords', link_to_facet: true
config.add_show_field Settings.FIELDS.RIGHTS, label: 'Rights', itemprop: 'rights'
config.add_show_field Settings.FIELDS.PROVIDER, label: 'Provider', link_to_facet: true
config.add_show_field Settings.FIELDS.FILE_SIZE, label: 'File size'

config.add_show_field(
Settings.FIELDS.REFERENCES,
label: 'More details at',
accessor: [:external_url],
if: proc { |_, _, doc| doc.external_url },
helper_method: :render_references_url
)

# OPTIONAL FIELDS
#optional fields to add to the item view display

# config.add_show_field Settings.FIELDS.ACCESS_RIGHTS, label: 'Access Rights', itemprop: 'access_rights'
# config.add_show_field Settings.FIELDS.ALTERNATIVE_TITLE, label: 'Alternative Title', itemprop: 'alt_title'
# config.add_show_field Settings.FIELDS.CENTROID, label: 'Centroid', itemprop: 'centroid'
# config.add_show_field Settings.FIELDS.CREATOR, label: 'Creator(s)', itemprop: 'creator'
# config.add_show_field Settings.FIELDS.DATE_ISSUED, label: 'Date Issued', itemprop: 'issued'
# config.add_show_field Settings.FIELDS.DATE_RANGE, label: 'Date Range', itemprop: 'date_range'
# config.add_show_field Settings.FIELDS.DESCRIPTION, label: 'Description', itemprop: 'description', helper_method: :render_value_as_truncate_abstract
# config.add_show_field Settings.FIELDS.FORMAT, label: 'Format', itemprop: 'format'
# config.add_show_field Settings.FIELDS.FILE_SIZE, label: 'File Size', itemprop: 'file_size'
# config.add_show_field Settings.FIELDS.GEOREFERENCED, label: 'Georeferenced', itemprop: 'georeferenced'
# config.add_show_field Settings.FIELDS.ID, label: 'ID', itemprop: 'id'
# config.add_show_field Settings.FIELDS.IDENTIFIER, label: 'Identifier', itemprop: 'identifier'
# config.add_show_field Settings.FIELDS.INDEX_YEAR, label: 'Year', itemprop: 'year'
# config.add_show_field Settings.FIELDS.IS_PART_OF, label: 'Is Part Of', itemprop: 'is_part_of'
# config.add_show_field Settings.FIELDS.IS_REPLACED_BY, label: 'Is Replaced By', itemprop: 'is_replaced_by'
# config.add_show_field Settings.FIELDS.THEME, label: 'Theme', itemprop: 'theme'
# config.add_show_field Settings.FIELDS.KEYWORD, label: 'Keyword(s)', itemprop: 'keyword'
# config.add_show_field Settings.FIELDS.LANGUAGE, label: 'Language', itemprop: 'language'
# config.add_show_field Settings.FIELDS.LICENSE, label: 'License', itemprop: 'license'
# config.add_show_field Settings.FIELDS.MEMBER_OF, label: 'Member Of', itemprop: 'member_of'
# config.add_show_field Settings.FIELDS.METADATA_VERSION, label: 'Metadata Version', itemprop: 'metadata_version'
# config.add_show_field Settings.FIELDS.MODIFIED, label: 'Date Modified', itemprop: 'modified'
# config.add_show_field Settings.FIELDS.OVERLAP_FIELD, label: 'Overlap BBox', itemprop: 'overlap_field'
# config.add_show_field Settings.FIELDS.PUBLISHER, label: 'Publisher', itemprop: 'publisher'
# config.add_show_field Settings.FIELDS.PROVIDER, label: 'Provider', itemprop: 'provider'
# config.add_show_field Settings.FIELDS.REFERENCES, label: 'References', itemprop: 'references'
# config.add_show_field Settings.FIELDS.RELATION, label: 'Relation', itemprop: 'relation'
# config.add_show_field Settings.FIELDS.REPLACES, label: 'Replaces', itemprop: 'replaces'
# config.add_show_field Settings.FIELDS.RESOURCE_CLASS, label: 'Resource Class', itemprop: 'class'
# config.add_show_field Settings.FIELDS.RESOURCE_TYPE, label: 'Resource Type', itemprop: 'type'
# config.add_show_field Settings.FIELDS.RIGHTS, label: 'Rights', itemprop: 'rights'
# config.add_show_field Settings.FIELDS.RIGHTS_HOLDER, label: 'Rights Holder', itemprop: 'rights_holder'
# config.add_show_field Settings.FIELDS.SPATIAL_COVERAGE, label: 'Place(s)', itemprop: 'spatial_coverage'
# config.add_show_field Settings.FIELDS.GEOMETRY, label: 'Geometry', itemprop: 'geometry'
# config.add_show_field Settings.FIELDS.SUBJECT, label: 'Subject', itemprop: 'subject'
# config.add_show_field Settings.FIELDS.SUPPRESSED, label: 'Suppressed', itemprop: 'suppresed'
# config.add_show_field Settings.FIELDS.TEMPORAL_COVERAGE, label: 'Temporal Coverage', itemprop: 'temporal'
# config.add_show_field Settings.FIELDS.TITLE, label: 'Title', itemprop: 'title'
# config.add_show_field Settings.FIELDS.VERSION, label: 'Version', itemprop: 'version'
# config.add_show_field Settings.FIELDS.WXS_IDENTIFIER, label: 'Web Service Layer', itemprop: 'wxs_identifier'
# SEARCH RESULTS FIELDS

# solr fields to be displayed in the index (search results) view
# The ordering of the field names is the order of the display
# config.add_index_field Settings.FIELDS.PROVIDER, :label => 'Institution:'
# config.add_index_field Settings.FIELDS.RIGHTS, :label => 'Access:'
# # config.add_index_field 'Area', :label => 'Area:'
# config.add_index_field Settings.FIELDS.SUBJECT, :label => 'Keywords:'
config.add_index_field Settings.FIELDS.INDEX_YEAR
config.add_index_field Settings.FIELDS.CREATOR
config.add_index_field Settings.FIELDS.DESCRIPTION, helper_method: :snippit
config.add_index_field Settings.FIELDS.PUBLISHER

# ITEM VIEW FIELDS

# solr fields to be displayed in the show (single result) view
# The ordering of the field names is the order of the display
# item_prop: [String] property given to span with Schema.org item property
# link_to_search: [Boolean] that can be passed to link to a facet search
# helper_method: [Symbol] method that can be used to render the value

# DEFAULT FIELDS
# The following fields all feature string values. If there is a value present in the metadata, they fields will show up on the item show page.
# The labels and order can be customed. Comment out fields to hide them.

config.add_show_field Settings.FIELDS.CREATOR, label: 'Creator(s)', itemprop: 'creator'
config.add_show_field Settings.FIELDS.TEMPORAL_COVERAGE, label: 'Year', itemprop: 'temporal'
config.add_show_field Settings.FIELDS.DESCRIPTION, label: 'Description', itemprop: 'description', helper_method: :render_value_as_truncate_abstract
config.add_show_field Settings.FIELDS.PUBLISHER, label: 'Publisher', itemprop: 'publisher'
config.add_show_field Settings.FIELDS.SPATIAL_COVERAGE, label: 'Place(s)', itemprop: 'spatial', link_to_facet: true
config.add_show_field Settings.FIELDS.THEME, label: 'Theme(s)', itemprop: 'keywords', link_to_facet: true
config.add_show_field Settings.FIELDS.RIGHTS, label: 'Rights', itemprop: 'rights'
config.add_show_field Settings.FIELDS.PROVIDER, label: 'Provider', link_to_facet: true
config.add_show_field Settings.FIELDS.FILE_SIZE, label: 'File size'

config.add_show_field(
Settings.FIELDS.REFERENCES,
label: 'More details at',
accessor: [:external_url],
if: proc { |_, _, doc| doc.external_url },
helper_method: :render_references_url
)

# ADDITIONAL FIELDS
# The following fields are not user friendly and are not set to appear on the item show page. They contain non-literal values, codes, URIs, or are otherwise designed to power features in the interface.
# These values might need a translations to be readable by users.

# config.add_show_field Settings.FIELDS.LANGUAGE, label: 'Language', itemprop: 'language'
# config.add_show_field Settings.FIELDS.KEYWORD, label: 'Keyword(s)', itemprop: 'keyword'

# config.add_show_field Settings.FIELDS.INDEX_YEAR, label: 'Year', itemprop: 'year'
# config.add_show_field Settings.FIELDS.DATE_RANGE, label: 'Date Range', itemprop: 'date_range'

# config.add_show_field Settings.FIELDS.CENTROID, label: 'Centroid', itemprop: 'centroid'
# config.add_show_field Settings.FIELDS.OVERLAP_FIELD, label: 'Overlap BBox', itemprop: 'overlap_field'

# config.add_show_field Settings.FIELDS.RELATION, label: 'Relation', itemprop: 'relation'
# config.add_show_field Settings.FIELDS.MEMBER_OF, label: 'Member Of', itemprop: 'member_of'
# config.add_show_field Settings.FIELDS.IS_PART_OF, label: 'Is Part Of', itemprop: 'is_part_of'
# config.add_show_field Settings.FIELDS.VERSION, label: 'Version', itemprop: 'version'
# config.add_show_field Settings.FIELDS.REPLACES, label: 'Replaces', itemprop: 'replaces'
# config.add_show_field Settings.FIELDS.IS_REPLACED_BY, label: 'Is Replaced By', itemprop: 'is_replaced_by'

# config.add_show_field Settings.FIELDS.WXS_IDENTIFIER, label: 'Web Service Layer', itemprop: 'wxs_identifier'
# config.add_show_field Settings.FIELDS.ID, label: 'ID', itemprop: 'id'
# config.add_show_field Settings.FIELDS.IDENTIFIER, label: 'Identifier', itemprop: 'identifier'

# config.add_show_field Settings.FIELDS.MODIFIED, label: 'Date Modified', itemprop: 'modified'
# config.add_show_field Settings.FIELDS.METADATA_VERSION, label: 'Metadata Version', itemprop: 'metadata_version'
# config.add_show_field Settings.FIELDS.SUPPRESSED, label: 'Suppressed', itemprop: 'suppresed'

# "fielded" search configuration. Used by pulldown among other places.
# For supported keys in hash, see rdoc for Blacklight::SearchFields
Expand Down Expand Up @@ -294,8 +303,6 @@ class CatalogController < ApplicationController
config.add_show_tools_partial(:sms, if: :render_sms_action?, callback: :sms_action, validator: :validate_sms_params)

# Custom tools for GeoBlacklight
# This line was recommended to be deleted per the GBL upgrade guide
# 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 :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 :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? }
Expand Down
2 changes: 2 additions & 0 deletions config/locales/geoblacklight.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ en:
export_shapefile_link: 'Shapefile'
export_kmz_link: 'KMZ'
export_geojson_link: 'GeoJSON'
export_geotiff_link: 'GeoTIFF'
home:
headline: 'Explore and discover...'
search_heading: 'Find the maps and data you need'
Expand Down Expand Up @@ -133,6 +134,7 @@ en:
cornell: Cornell University
dvd-rom: DVD-Rom
esri-globe: Esri Global
george-mason: George Mason University
harvard: Harvard University
illinois: University of Illinois
indiana: Indiana University
Expand Down
Loading

0 comments on commit b8f91b1

Please sign in to comment.