geoblacklight 6.0.0.pre.alpha.1 → 6.0.0.pre.alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +2 -1
  3. data/app/components/blacklight/icons/arrow_circle_down_component.rb +1 -1
  4. data/app/components/blacklight/icons/book_component.rb +1 -1
  5. data/app/components/blacklight/icons/cd_rom_component.rb +1 -1
  6. data/app/components/blacklight/icons/child_item_component.rb +1 -1
  7. data/app/components/blacklight/icons/citation_component.rb +1 -1
  8. data/app/components/blacklight/icons/collection_component.rb +1 -1
  9. data/app/components/blacklight/icons/collections_component.rb +1 -1
  10. data/app/components/blacklight/icons/datasets_component.rb +4 -4
  11. data/app/components/blacklight/icons/dvd_rom_component.rb +1 -1
  12. data/app/components/blacklight/icons/email_component.rb +1 -1
  13. data/app/components/blacklight/icons/fire_solid_component.rb +1 -1
  14. data/app/components/blacklight/icons/globe_component.rb +1 -1
  15. data/app/components/blacklight/icons/home_component.rb +1 -1
  16. data/app/components/blacklight/icons/image_component.rb +1 -1
  17. data/app/components/blacklight/icons/imagery_component.rb +1 -1
  18. data/app/components/blacklight/icons/leaf_component.rb +1 -1
  19. data/app/components/blacklight/icons/lightbulb_solid_component.rb +1 -1
  20. data/app/components/blacklight/icons/line_component.rb +2 -2
  21. data/app/components/blacklight/icons/map_component.rb +1 -1
  22. data/app/components/blacklight/icons/map_marker_component.rb +1 -1
  23. data/app/components/blacklight/icons/maps_component.rb +1 -1
  24. data/app/components/blacklight/icons/metadata_component.rb +1 -1
  25. data/app/components/blacklight/icons/mixed_component.rb +3 -3
  26. data/app/components/blacklight/icons/multilinestring_component.rb +4 -4
  27. data/app/components/blacklight/icons/multipoint_component.rb +1 -1
  28. data/app/components/blacklight/icons/multipolygon_component.rb +4 -4
  29. data/app/components/blacklight/icons/pagelines_brands_component.rb +1 -1
  30. data/app/components/blacklight/icons/paper_map_component.rb +1 -1
  31. data/app/components/blacklight/icons/parent_item_component.rb +1 -1
  32. data/app/components/blacklight/icons/point_component.rb +1 -1
  33. data/app/components/blacklight/icons/polygon_component.rb +2 -2
  34. data/app/components/blacklight/icons/polyline_component.rb +4 -4
  35. data/app/components/blacklight/icons/public_component.rb +1 -1
  36. data/app/components/blacklight/icons/raster_component.rb +1 -1
  37. data/app/components/blacklight/icons/restricted_component.rb +1 -1
  38. data/app/components/blacklight/icons/table_component.rb +1 -1
  39. data/app/components/blacklight/icons/tags_component.rb +1 -1
  40. data/app/components/blacklight/icons/triangle_exclamation_solid_component.rb +1 -1
  41. data/app/components/blacklight/icons/web_services_component.rb +1 -1
  42. data/app/components/blacklight/icons/websites_component.rb +1 -1
  43. data/app/components/geoblacklight/attribute_table_component.html.erb +1 -1
  44. data/app/components/geoblacklight/document/relations_container_component.html.erb +1 -0
  45. data/app/components/geoblacklight/document/relations_container_component.rb +12 -0
  46. data/app/components/geoblacklight/document/sidebar_component.html.erb +2 -3
  47. data/app/components/geoblacklight/download_links_component.html.erb +1 -1
  48. data/app/components/geoblacklight/download_links_component.rb +5 -2
  49. data/app/components/geoblacklight/homepage_feature_facet_component.rb +1 -1
  50. data/app/components/geoblacklight/index_map_inspect_component.html.erb +8 -1
  51. data/app/components/geoblacklight/index_map_legend_component.html.erb +6 -6
  52. data/app/components/geoblacklight/location_leaflet_map_component.rb +8 -1
  53. data/app/components/geoblacklight/login_link_component.rb +1 -1
  54. data/app/components/geoblacklight/static_map_component.html.erb +1 -1
  55. data/app/components/geoblacklight/web_services_link_component.rb +1 -1
  56. data/app/controllers/relation_controller.rb +1 -1
  57. data/app/helpers/geoblacklight_helper.rb +5 -2
  58. data/app/javascript/geoblacklight/controllers/downloads_controller.js +3 -3
  59. data/app/javascript/geoblacklight/core.js +0 -2
  60. data/app/javascript/geoblacklight/initializers/truncation.js +5 -3
  61. data/app/javascript/geoblacklight/leaflet/controls/geosearch.js +4 -2
  62. data/app/javascript/geoblacklight/leaflet/inspection.js +10 -5
  63. data/app/javascript/geoblacklight/leaflet/layer_index_map.js +15 -12
  64. data/app/javascript/geoblacklight/leaflet/utils.js +8 -2
  65. data/app/javascript/geoblacklight/openlayers/inspection.js +3 -5
  66. data/app/views/catalog/metadata/_markup.html.erb +1 -1
  67. data/app/views/catalog/metadata.html.erb +1 -1
  68. data/app/views/relation/index.html.erb +4 -2
  69. data/config/locales/geoblacklight.en.yml +31 -0
  70. data/geoblacklight.gemspec +3 -3
  71. data/lib/generators/geoblacklight/templates/settings.yml +285 -270
  72. data/lib/geoblacklight/configuration/case_insensitive_settings.rb +59 -0
  73. data/lib/geoblacklight/configuration/fields_config.rb +33 -33
  74. data/lib/geoblacklight/configuration/layer_config.rb +28 -0
  75. data/lib/geoblacklight/configuration/leaflet_config.rb +24 -25
  76. data/lib/geoblacklight/configuration/leaflet_layers_config.rb +15 -3
  77. data/lib/geoblacklight/configuration/leaflet_sleep_config.rb +1 -1
  78. data/lib/geoblacklight/configuration/relationship_config.rb +15 -0
  79. data/lib/geoblacklight/configuration/relationships_config.rb +123 -0
  80. data/lib/geoblacklight/configuration/settings_builder.rb +118 -0
  81. data/lib/geoblacklight/configuration.rb +7 -2
  82. data/lib/geoblacklight/deprecation.rb +7 -0
  83. data/lib/geoblacklight/engine.rb +1 -0
  84. data/lib/geoblacklight/metadata/base.rb +1 -1
  85. data/lib/geoblacklight/version.rb +1 -1
  86. data/lib/geoblacklight.rb +1 -2
  87. data/solr/conf/schema.xml +8 -7
  88. data/solr/conf/solrconfig.xml +1 -1
  89. data/spec/components/geoblacklight/document/sidebar_component_spec.rb +48 -0
  90. data/spec/components/geoblacklight/download_links_component_spec.rb +4 -1
  91. data/spec/components/geoblacklight/login_link_component_spec.rb +1 -1
  92. data/spec/helpers/geoblacklight_helper_spec.rb +1 -1
  93. data/spec/lib/geoblacklight/configuration/layer_config_spec.rb +71 -0
  94. data/spec/lib/geoblacklight/configuration/leaflet_config_spec.rb +129 -0
  95. data/spec/lib/geoblacklight/configuration/leaflet_layers_config_spec.rb +63 -0
  96. data/spec/lib/geoblacklight/configuration/settings_builder_spec.rb +284 -0
  97. data/spec/lib/geoblacklight/configuration_spec.rb +35 -0
  98. data/spec/lib/geoblacklight/metadata/base_spec.rb +1 -1
  99. data/spec/lib/geoblacklight/relation/relation_response_spec.rb +4 -4
  100. data/spec/spec_helper.rb +5 -0
  101. metadata +32 -24
  102. data/app/javascript/geoblacklight/initializers/relations.js +0 -40
  103. data/app/views/catalog/_relations_container.html.erb +0 -1
  104. data/lib/geoblacklight/configuration/legacy_settings_builder.rb +0 -94
  105. data/lib/geoblacklight/faraday_middleware/follow_redirects.rb +0 -179
  106. data/spec/features/show_page_sidebar_static_map_spec.rb +0 -21
@@ -11,41 +11,41 @@ module Geoblacklight
11
11
  attribute :date_issued, :string, default: "dct_issued_s"
12
12
  attribute :date_range, :string, default: "gbl_dateRange_drsim"
13
13
  attribute :description, :string, default: "dct_description_sm"
14
- attribute :display_note, :string, default: "gbl_displayNote_s"
14
+ attribute :display_note, :string, default: "gbl_displayNote_sm"
15
15
  attribute :format, :string, default: "dct_format_s"
16
- attribute :file_size, :string, default: "gbl_fileSize_drsim"
17
- attribute :georeferenced, :string, default: "gbl_georeferenced_drsim"
16
+ attribute :file_size, :string, default: "gbl_fileSize_s"
17
+ attribute :georeferenced, :string, default: "gbl_georeferenced_b"
18
18
  attribute :id, :string, default: "id"
19
- attribute :identifier, :string, default: "dct_identifier_s"
20
- attribute :index_year, :string, default: "gbl_indexYear_drsim"
21
- attribute :is_part_of, :string, default: "gbl_isPartOf_drsim"
22
- attribute :is_replaced_by, :string, default: "gbl_isReplacedBy_drsim"
23
- attribute :theme, :string, default: "gbl_theme_drsim"
24
- attribute :keyword, :string, default: "dct_keyword_sm"
25
- attribute :language, :string, default: "dct_language_s"
26
- attribute :license, :string, default: "dct_license_s"
27
- attribute :member_of, :string, default: "gbl_memberOf_drsim"
28
- attribute :metadata_version, :string, default: "gbl_metadataVersion_drsim"
29
- attribute :modified, :string, default: "gbl_modified_drsim"
30
- attribute :overlap_field, :string, default: "gbl_overlapField_drsim"
31
- attribute :publisher, :string, default: "gbl_publisher_drsim"
32
- attribute :provider, :string, default: "gbl_provider_drsim"
33
- attribute :references, :string, default: "gbl_references_drsim"
34
- attribute :relation, :string, default: "gbl_relation_drsim"
35
- attribute :replaces, :string, default: "gbl_replaces_drsim"
36
- attribute :resource_class, :string, default: "gbl_resourceClass_drsim"
37
- attribute :resource_type, :string, default: "gbl_resourceType_drsim"
38
- attribute :rights, :string, default: "gbl_rights_drsim"
39
- attribute :rights_holder, :string, default: "gbl_rightsHolder_drsim"
40
- attribute :source, :string, default: "gbl_source_drsim"
41
- attribute :spatial_coverage, :string, default: "gbl_spatialCoverage_drsim"
42
- attribute :geometry, :string, default: "gbl_geometry_drsim"
43
- attribute :subject, :string, default: "gbl_subject_drsim"
44
- attribute :suppressed, :string, default: "gbl_suppressed_drsim"
45
- attribute :temporal_coverage, :string, default: "gbl_temporalCoverage_drsim"
46
- attribute :title, :string, default: "gbl_title_drsim"
47
- attribute :version, :string, default: "gbl_version_drsim"
48
- attribute :wxs_identifier, :string, default: "gbl_wxsIdentifier_drsim"
19
+ attribute :identifier, :string, default: "dct_identifier_sm"
20
+ attribute :index_year, :string, default: "gbl_indexYear_im"
21
+ attribute :is_part_of, :string, default: "dct_isPartOf_sm"
22
+ attribute :is_replaced_by, :string, default: "dct_isReplacedBy_sm"
23
+ attribute :theme, :string, default: "dcat_theme_sm"
24
+ attribute :keyword, :string, default: "dcat_keyword_sm"
25
+ attribute :language, :string, default: "dct_language_sm"
26
+ attribute :license, :string, default: "dct_license_sm"
27
+ attribute :member_of, :string, default: "pcdm_memberOf_sm"
28
+ attribute :metadata_version, :string, default: "gbl_mdVersion_s"
29
+ attribute :modified, :string, default: "gbl_mdModified_dt"
30
+ attribute :overlap_field, :string, default: "solr_bboxtype"
31
+ attribute :publisher, :string, default: "dct_publisher_sm"
32
+ attribute :provider, :string, default: "schema_provider_s"
33
+ attribute :references, :string, default: "dct_references_s"
34
+ attribute :relation, :string, default: "dct_relation_sm"
35
+ attribute :replaces, :string, default: "dct_replaces_sm"
36
+ attribute :resource_class, :string, default: "gbl_resourceClass_sm"
37
+ attribute :resource_type, :string, default: "gbl_resourceType_sm"
38
+ attribute :rights, :string, default: "dct_rights_sm"
39
+ attribute :rights_holder, :string, default: "dct_rightsHolder_sm"
40
+ attribute :source, :string, default: "dct_source_sm"
41
+ attribute :spatial_coverage, :string, default: "dct_spatial_sm"
42
+ attribute :geometry, :string, default: "locn_geometry"
43
+ attribute :subject, :string, default: "dct_subject_sm"
44
+ attribute :suppressed, :string, default: "gbl_suppressed_b"
45
+ attribute :temporal_coverage, :string, default: "dct_temporal_sm"
46
+ attribute :title, :string, default: "dct_title_s"
47
+ attribute :version, :string, default: "dct_isVersionOf_sm"
48
+ attribute :wxs_identifier, :string, default: "gbl_wxsIdentifier_s"
49
49
  end
50
50
  end
51
51
  end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Geoblacklight
4
+ class Configuration
5
+ # Configuration for Leaflet map layer styles.
6
+ class LayerConfig
7
+ include ActiveModel::Model
8
+ include ActiveModel::Attributes
9
+
10
+ attribute :color, :string
11
+ attribute :weight, :integer, default: 1
12
+ attribute :radius, :integer, default: 4
13
+ attribute :sr_color_name, :string
14
+
15
+ # Supports Hash-like access for backward compatibility
16
+ # @param [Symbol, String] key
17
+ def [](key)
18
+ respond_to?(key) ? send(key) : nil
19
+ end
20
+
21
+ # Returns the attributes as a symbolized hash
22
+ # @return [Hash]
23
+ def to_h
24
+ attributes.symbolize_keys
25
+ end
26
+ end
27
+ end
28
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Geoblacklight
2
4
  class Configuration
3
5
  class LeafletConfig
@@ -11,43 +13,40 @@ module Geoblacklight
11
13
  attribute :sidebar, :boolean, default: false
12
14
  attribute :selected_color, :string, default: "#2C7FB8"
13
15
 
14
- DEFAULT_LAYERS_CONFIG = {
15
- index: {
16
- DEFAULT: {
17
- color: "#7FCDBB",
18
- weight: 1,
19
- radius: 4,
20
- sr_color_name: "Green"
21
- },
22
- UNAVAILABLE: {
23
- weight: 1,
24
- radius: 4,
25
- color: "#EDF8B1",
26
- sr_color_name: "Yellow"
27
- },
28
- SELECTED: {
29
- weight: 1,
30
- radius: 4,
31
- color: "#2C7FB8",
32
- sr_color_name: "Blue"
33
- }
34
- }
35
- }.freeze
36
-
37
16
  DEFAULT_SLEEP_CONFIG = {
38
17
  sleep: true, # set to false to disable
39
18
  margin_distance: 100, # set to zero / false if you want to disable this check
40
19
  sleeptime: 750,
41
20
  waketime: 750,
42
21
  hovertowake: false,
43
- message: "Click to Wake",
44
22
  background: "rgba(214, 214, 214, .7)"
45
23
  }.freeze
46
24
 
25
+ # Built lazily (rather than as a frozen constant) so the sr_color_name
26
+ # values pick up the current I18n locale each time a config is built.
27
+ def self.default_layers_config
28
+ {
29
+ index: {
30
+ DEFAULT: LayerConfig.new(
31
+ color: "#7FCDBB",
32
+ sr_color_name: I18n.t("geoblacklight.map.legend.colors.default")
33
+ ),
34
+ UNAVAILABLE: LayerConfig.new(
35
+ color: "#EDF8B1",
36
+ sr_color_name: I18n.t("geoblacklight.map.legend.colors.unavailable")
37
+ ),
38
+ SELECTED: LayerConfig.new(
39
+ color: "#2C7FB8",
40
+ sr_color_name: I18n.t("geoblacklight.map.legend.colors.selected")
41
+ )
42
+ }
43
+ }
44
+ end
45
+
47
46
  def initialize
48
47
  super
49
48
  @sleep = LeafletSleepConfig.new(DEFAULT_SLEEP_CONFIG)
50
- @layers = LeafletLayersConfig.new(DEFAULT_LAYERS_CONFIG)
49
+ @layers = LeafletLayersConfig.new(self.class.default_layers_config)
51
50
  end
52
51
 
53
52
  def sleep=(attributes)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Geoblacklight
2
4
  class Configuration
3
5
  class LeafletLayersConfig
@@ -6,15 +8,25 @@ module Geoblacklight
6
8
 
7
9
  attribute :detect_retina, :boolean, default: true
8
10
 
9
- attr_accessor :index
11
+ attr_reader :index
10
12
 
11
13
  def initialize(attributes = {})
12
14
  super
13
- @index = attributes[:index]
15
+ self.index = attributes[:index]
16
+ end
17
+
18
+ def index=(values)
19
+ @index = (values || {}).transform_values do |val|
20
+ if val.is_a?(LayerConfig)
21
+ val
22
+ else
23
+ LayerConfig.new(val)
24
+ end
25
+ end
14
26
  end
15
27
 
16
28
  def to_h
17
- attributes.merge({"index" => index})
29
+ attributes.merge({"index" => index.transform_values(&:to_h)})
18
30
  end
19
31
  end
20
32
  end
@@ -9,7 +9,7 @@ module Geoblacklight
9
9
  attribute :sleeptime, :integer, default: 750
10
10
  attribute :waketime, :integer, default: 750
11
11
  attribute :hovertowake, :boolean, default: false
12
- attribute :message, :string, default: "Click to Wake"
12
+ attribute :message, :string, default: -> { I18n.t("geoblacklight.map.sleep.click_to_wake") }
13
13
  attribute :background, :string, default: "rgba(214, 214, 214, .7)"
14
14
 
15
15
  def to_h
@@ -0,0 +1,15 @@
1
+ module Geoblacklight
2
+ class Configuration
3
+ # Configuration for an individual relationship displayed on a document's show page.
4
+ class RelationshipConfig
5
+ include ActiveModel::Model
6
+ include ActiveModel::Attributes
7
+
8
+ attribute :field, :string
9
+ attribute :icon, :string
10
+ attribute :inverse, :string
11
+ attribute :label, :string
12
+ attribute :query_type, :string
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,123 @@
1
+ module Geoblacklight
2
+ class Configuration
3
+ # Hash-like configuration for the relationships displayed on a document's
4
+ # show page. By default it carries all of the relationships defined in the
5
+ # RELATIONSHIPS_SHOWN section of settings.yml, using lowercase keys.
6
+ class RelationshipsConfig
7
+ include Enumerable
8
+
9
+ DEFAULT_RELATIONSHIPS = {
10
+ member_of_ancestors: {
11
+ field: "pcdm_memberOf_sm",
12
+ icon: "parent-item",
13
+ inverse: :member_of_descendants,
14
+ label: "geoblacklight.relations.member_of_ancestors",
15
+ query_type: "ancestors"
16
+ },
17
+ member_of_descendants: {
18
+ field: "pcdm_memberOf_sm",
19
+ icon: "child-item",
20
+ inverse: :member_of_ancestors,
21
+ label: "geoblacklight.relations.member_of_descendants",
22
+ query_type: "descendants"
23
+ },
24
+ part_of_ancestors: {
25
+ field: "dct_isPartOf_sm",
26
+ icon: "parent-item",
27
+ inverse: :part_of_descendants,
28
+ label: "geoblacklight.relations.part_of_ancestors",
29
+ query_type: "ancestors"
30
+ },
31
+ part_of_descendants: {
32
+ field: "dct_isPartOf_sm",
33
+ icon: "child-item",
34
+ inverse: :part_of_ancestors,
35
+ label: "geoblacklight.relations.part_of_descendants",
36
+ query_type: "descendants"
37
+ },
38
+ relation_ancestors: {
39
+ field: "dct_relation_sm",
40
+ icon: nil,
41
+ inverse: :relation_descendants,
42
+ label: "geoblacklight.relations.relation_ancestors",
43
+ query_type: "ancestors"
44
+ },
45
+ relation_descendants: {
46
+ field: "dct_relation_sm",
47
+ icon: nil,
48
+ inverse: :relation_ancestors,
49
+ label: "geoblacklight.relations.relation_descendants",
50
+ query_type: "descendants"
51
+ },
52
+ replaces_ancestors: {
53
+ field: "dct_replaces_sm",
54
+ icon: nil,
55
+ inverse: :replaces_descendants,
56
+ label: "geoblacklight.relations.replaces_ancestors",
57
+ query_type: "ancestors"
58
+ },
59
+ replaces_descendants: {
60
+ field: "dct_replaces_sm",
61
+ icon: nil,
62
+ inverse: :replaces_ancestors,
63
+ label: "geoblacklight.relations.replaces_descendants",
64
+ query_type: "descendants"
65
+ },
66
+ source_ancestors: {
67
+ field: "dct_source_sm",
68
+ icon: "parent-item",
69
+ inverse: :source_descendants,
70
+ label: "geoblacklight.relations.source_ancestors",
71
+ query_type: "ancestors"
72
+ },
73
+ source_descendants: {
74
+ field: "dct_source_sm",
75
+ icon: "child-item",
76
+ inverse: :source_ancestors,
77
+ label: "geoblacklight.relations.source_descendants",
78
+ query_type: "descendants"
79
+ },
80
+ version_of_ancestors: {
81
+ field: "dct_isVersionOf_sm",
82
+ icon: "parent-item",
83
+ inverse: :version_of_descendants,
84
+ label: "geoblacklight.relations.version_of_ancestors",
85
+ query_type: "ancestors"
86
+ },
87
+ version_of_descendants: {
88
+ field: "dct_isVersionOf_sm",
89
+ icon: "child-item",
90
+ inverse: :version_of_ancestors,
91
+ label: "geoblacklight.relations.version_of_descendants",
92
+ query_type: "descendants"
93
+ }
94
+ }.freeze
95
+
96
+ def initialize(relationships = DEFAULT_RELATIONSHIPS)
97
+ @relationships = relationships.to_h.transform_values do |attrs|
98
+ attrs.is_a?(RelationshipConfig) ? attrs : RelationshipConfig.new(attrs)
99
+ end
100
+ end
101
+
102
+ def each(&block)
103
+ @relationships.each(&block)
104
+ end
105
+
106
+ def each_key(&block)
107
+ @relationships.each_key(&block)
108
+ end
109
+
110
+ def key?(key)
111
+ @relationships.key?(key)
112
+ end
113
+
114
+ def [](key)
115
+ @relationships[key]
116
+ end
117
+
118
+ def method_missing(name, *args, **kwargs, &block) # rubocop:disable Style/MissingRespondToMissing
119
+ @relationships.key?(name) ? @relationships[name] : super
120
+ end
121
+ end
122
+ end
123
+ end
@@ -0,0 +1,118 @@
1
+ module Geoblacklight
2
+ class Configuration
3
+ # Builds a configuration from legacy (uppercase) settings
4
+ class SettingsBuilder
5
+ def self.build
6
+ new.build
7
+ end
8
+
9
+ def initialize(settings: Settings)
10
+ @configuration = Configuration.new
11
+ @settings = CaseInsensitiveSettings.new(settings, deprecation: Geoblacklight::Deprecation)
12
+ end
13
+
14
+ def build
15
+ @configuration.tap do |config|
16
+ assign(config, :arcgis_base_url, settings.ARCGIS_BASE_URL)
17
+ assign(config, :bbox_within_boost, settings.BBOX_WITHIN_BOOST)
18
+ assign(config, :overlap_ratio_boost, settings.OVERLAP_RATIO_BOOST)
19
+ assign(config, :display_notes_shown, build_display_notes)
20
+ assign(config, :institution, settings.INSTITUTION)
21
+ assign(config, :help_text, settings.HELP_TEXT&.to_h)
22
+ assign(config, :sidebar_static_map, settings.SIDEBAR_STATIC_MAP)
23
+ assign(config, :iiif_drag_drop_link, settings.IIIF_DRAG_DROP_LINK)
24
+ assign(config, :homepage_map_geom, settings.HOMEPAGE_MAP_GEOM)
25
+ assign(config, :vector_download_formats, settings.DOWNLOAD_FORMATS&.VECTOR)
26
+ assign(config, :metadata_shown, settings.METADATA_SHOWN)
27
+ assign(config, :webservices_shown, settings.WEBSERVICES_SHOWN)
28
+ assign(config, :relationships_shown, build_relationships)
29
+ assign(config, :timeout_download, settings.TIMEOUT_DOWNLOAD)
30
+ assign(config, :download_path, settings.DOWNLOAD_PATH)
31
+ assign(config, :gbl_params, settings.GBL_PARAMS)
32
+ assign(config, :wms_params, settings.WMS_PARAMS&.to_h)
33
+ assign(config, :timeout_wms, settings.TIMEOUT_WMS)
34
+
35
+ build_fields(config)
36
+ build_leaflet_options(config)
37
+ end
38
+ end
39
+
40
+ private
41
+
42
+ attr_reader :settings
43
+
44
+ # Assigns the value to the target's attribute unless it is nil, so that
45
+ # missing settings do not overwrite the defaults provided by Configuration.
46
+ def assign(target, attribute, value)
47
+ target.public_send("#{attribute}=", value) unless value.nil?
48
+ end
49
+
50
+ def build_display_notes
51
+ settings.DISPLAY_NOTES_SHOWN&.to_h&.transform_values do |value|
52
+ DisplayNoteShownConfig.new(value.to_h)
53
+ end
54
+ end
55
+
56
+ def build_relationships
57
+ RelationshipsConfig.new(settings.RELATIONSHIPS_SHOWN.to_h) if settings.RELATIONSHIPS_SHOWN
58
+ end
59
+
60
+ def build_leaflet_options(config)
61
+ return unless settings.LEAFLET
62
+
63
+ assign(config.leaflet_options, :bounds_overlay, settings.LEAFLET.BOUNDSOVERLAY&.to_h)
64
+ assign(config.leaflet_options, :selected_color, settings.LEAFLET.SELECTED_COLOR)
65
+ assign(config.leaflet_options, :sleep, settings.LEAFLET.SLEEP&.to_h&.transform_keys(&:downcase))
66
+ assign(config.leaflet_options, :sidebar, settings.LEAFLET.SIDEBAR)
67
+ assign(config.leaflet_options, :layers, settings.LEAFLET.LAYERS&.to_h&.transform_keys(&:downcase))
68
+ end
69
+
70
+ def build_fields(config)
71
+ return unless settings.FIELDS
72
+
73
+ assign(config.fields, :access_rights, settings.FIELDS.ACCESS_RIGHTS)
74
+ assign(config.fields, :alternative_title, settings.FIELDS.ALTERNATIVE_TITLE)
75
+ assign(config.fields, :centroid, settings.FIELDS.CENTROID)
76
+ assign(config.fields, :creator, settings.FIELDS.CREATOR)
77
+ assign(config.fields, :date_issued, settings.FIELDS.DATE_ISSUED)
78
+ assign(config.fields, :date_range, settings.FIELDS.DATE_RANGE)
79
+ assign(config.fields, :description, settings.FIELDS.DESCRIPTION)
80
+ assign(config.fields, :display_note, settings.FIELDS.DISPLAY_NOTE)
81
+ assign(config.fields, :format, settings.FIELDS.FORMAT)
82
+ assign(config.fields, :file_size, settings.FIELDS.FILE_SIZE)
83
+ assign(config.fields, :georeferenced, settings.FIELDS.GEOREFERENCED)
84
+ assign(config.fields, :id, settings.FIELDS.ID)
85
+ assign(config.fields, :identifier, settings.FIELDS.IDENTIFIER)
86
+ assign(config.fields, :index_year, settings.FIELDS.INDEX_YEAR)
87
+ assign(config.fields, :is_part_of, settings.FIELDS.IS_PART_OF)
88
+ assign(config.fields, :is_replaced_by, settings.FIELDS.IS_REPLACED_BY)
89
+ assign(config.fields, :theme, settings.FIELDS.THEME)
90
+ assign(config.fields, :keyword, settings.FIELDS.KEYWORD)
91
+ assign(config.fields, :language, settings.FIELDS.LANGUAGE)
92
+ assign(config.fields, :license, settings.FIELDS.LICENSE)
93
+ assign(config.fields, :member_of, settings.FIELDS.MEMBER_OF)
94
+ assign(config.fields, :metadata_version, settings.FIELDS.METADATA_VERSION)
95
+ assign(config.fields, :modified, settings.FIELDS.MODIFIED)
96
+ assign(config.fields, :overlap_field, settings.FIELDS.OVERLAP_FIELD)
97
+ assign(config.fields, :publisher, settings.FIELDS.PUBLISHER)
98
+ assign(config.fields, :provider, settings.FIELDS.PROVIDER)
99
+ assign(config.fields, :references, settings.FIELDS.REFERENCES)
100
+ assign(config.fields, :relation, settings.FIELDS.RELATION)
101
+ assign(config.fields, :replaces, settings.FIELDS.REPLACES)
102
+ assign(config.fields, :resource_class, settings.FIELDS.RESOURCE_CLASS)
103
+ assign(config.fields, :resource_type, settings.FIELDS.RESOURCE_TYPE)
104
+ assign(config.fields, :rights, settings.FIELDS.RIGHTS)
105
+ assign(config.fields, :rights_holder, settings.FIELDS.RIGHTS_HOLDER)
106
+ assign(config.fields, :source, settings.FIELDS.SOURCE)
107
+ assign(config.fields, :spatial_coverage, settings.FIELDS.SPATIAL_COVERAGE)
108
+ assign(config.fields, :geometry, settings.FIELDS.GEOMETRY)
109
+ assign(config.fields, :subject, settings.FIELDS.SUBJECT)
110
+ assign(config.fields, :suppressed, settings.FIELDS.SUPPRESSED)
111
+ assign(config.fields, :temporal_coverage, settings.FIELDS.TEMPORAL_COVERAGE)
112
+ assign(config.fields, :title, settings.FIELDS.TITLE)
113
+ assign(config.fields, :version, settings.FIELDS.VERSION)
114
+ assign(config.fields, :wxs_identifier, settings.FIELDS.WXS_IDENTIFIER)
115
+ end
116
+ end
117
+ end
118
+ end
@@ -54,13 +54,14 @@ module Geoblacklight
54
54
  attr_accessor :webservices_shown # typed as Array
55
55
 
56
56
  # Relationships to display
57
- attr_accessor :relationships_shown # typed as Hash
57
+ attr_accessor :relationships_shown # typed as RelationshipsConfig
58
58
 
59
59
  attribute :download_path, :string
60
60
 
61
61
  def initialize
62
62
  super
63
63
  self.download_path ||= Rails.root.join("tmp", "cache", "downloads")
64
+ @relationships_shown = RelationshipsConfig.new
64
65
  @gbl_params = [
65
66
  :bbox, :email, :file, :format, :id, :logo, :provider, :type,
66
67
  :BBOX, :HEIGHT, :LAYERS, :QUERY_LAYERS, :URL, :WIDTH, :X, :Y
@@ -94,6 +95,8 @@ module Geoblacklight
94
95
  ]
95
96
  }
96
97
 
98
+ @vector_download_formats = ["Shapefile", "KMZ", "GeoJSON", "CSV"]
99
+ @metadata_shown = ["mods", "fgdc", "iso19139", "html"]
97
100
  @webservices_shown = %w[
98
101
  wms
99
102
  tms
@@ -107,7 +110,7 @@ module Geoblacklight
107
110
  dynamic_map_layer
108
111
  image_map_layer
109
112
  cog
110
- pmtile
113
+ pmtiles
111
114
  ]
112
115
 
113
116
  @display_notes_shown = {
@@ -132,6 +135,8 @@ module Geoblacklight
132
135
  note_prefix: "Warning: "
133
136
  )
134
137
  }
138
+
139
+ @sidebar_static_map = ["iiif", "iiif_manifest"]
135
140
  end
136
141
 
137
142
  def fields
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "active_support/deprecation"
4
+
5
+ module Geoblacklight
6
+ Deprecation = ActiveSupport::Deprecation.new("7.0", "GeoBlacklight")
7
+ end
@@ -4,6 +4,7 @@ require "blacklight"
4
4
  require "coderay"
5
5
  require "config"
6
6
  require "faraday"
7
+ require "faraday/follow_redirects"
7
8
  require "geoblacklight/version"
8
9
  require "nokogiri"
9
10
  require "mime/types"
@@ -48,7 +48,7 @@ module Geoblacklight
48
48
  # connection error
49
49
  def retrieve_metadata
50
50
  connection = Faraday.new(url: @reference.endpoint) do |conn|
51
- conn.use Geoblacklight::FaradayMiddleware::FollowRedirects
51
+ conn.response :follow_redirects
52
52
  conn.adapter Faraday.default_adapter
53
53
  end
54
54
  begin
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Geoblacklight
4
- VERSION = "6.0.0-alpha.1"
4
+ VERSION = "6.0.0-alpha.3"
5
5
  end
data/lib/geoblacklight.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "active_support/dependencies"
4
3
  require "zeitwerk"
5
4
  loader = Zeitwerk::Loader.for_gem
6
5
  loader.ignore("#{__dir__}/generators")
@@ -14,7 +13,7 @@ module Geoblacklight
14
13
  ::Rails.logger
15
14
  end
16
15
 
17
- mattr_accessor :configuration_builder, default: Geoblacklight::Configuration::LegacySettingsBuilder
16
+ mattr_accessor :configuration_builder, default: Geoblacklight::Configuration::SettingsBuilder
18
17
 
19
18
  def self.configuration
20
19
  @configuration ||= configuration_builder.build
data/solr/conf/schema.xml CHANGED
@@ -66,15 +66,15 @@
66
66
  <fieldType name="string" class="solr.StrField" sortMissingLast="true" />
67
67
  <fieldType name="boolean" class="solr.BoolField" sortMissingLast="true"/>
68
68
 
69
- <fieldType name="int" class="solr.TrieIntField" precisionStep="8" positionIncrementGap="0"/>
70
- <fieldType name="float" class="solr.TrieFloatField" precisionStep="8" positionIncrementGap="0"/>
71
- <fieldType name="long" class="solr.TrieLongField" precisionStep="8" positionIncrementGap="0"/>
72
- <fieldType name="double" class="solr.TrieDoubleField" precisionStep="8" positionIncrementGap="0"/>
69
+ <fieldType name="int" class="solr.IntPointField" docValues="true"/>
70
+ <fieldType name="float" class="solr.FloatPointField" docValues="true"/>
71
+ <fieldType name="long" class="solr.LongPointField" docValues="true"/>
72
+ <fieldType name="double" class="solr.DoublePointField" docValues="true"/>
73
73
 
74
74
  <!-- The format for this date field is of the form 1995-12-31T23:59:59Z.
75
75
  The trailing "Z" designates UTC time and is mandatory.
76
- A Trie based date field for faster date range queries and date faceting. -->
77
- <fieldType name="date" class="solr.TrieDateField" precisionStep="6" positionIncrementGap="0"/>
76
+ A Point based date field for faster date range queries and date faceting. -->
77
+ <fieldType name="date" class="solr.DatePointField" docValues="true"/>
78
78
 
79
79
  <!-- A DateRange based date field for truly faster date range queries. -->
80
80
  <fieldType name="dateRange" class="solr.DateRangeField"/>
@@ -98,7 +98,8 @@
98
98
  </analyzer>
99
99
  <analyzer type="query">
100
100
  <tokenizer class="solr.StandardTokenizerFactory"/>
101
- <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
101
+ <filter class="solr.SynonymGraphFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
102
+ <filter class="solr.FlattenGraphFilterFactory"/>
102
103
  <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords_en.txt"/>
103
104
  <filter class="solr.LowerCaseFilterFactory"/>
104
105
  <filter class="solr.EnglishPossessiveFilterFactory"/>
@@ -27,7 +27,7 @@
27
27
  that you fully re-index after changing this setting as it can
28
28
  affect both how text is indexed and queried.
29
29
  -->
30
- <luceneMatchVersion>7.6</luceneMatchVersion>
30
+ <luceneMatchVersion>9.0</luceneMatchVersion>
31
31
 
32
32
  <lib dir="${solr.install.dir:../../../..}/contrib/analysis-extras/lib" />
33
33
  <lib dir="${solr.install.dir:../../../..}/contrib/analysis-extras/lucene-libs" />
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "spec_helper"
4
+
5
+ RSpec.describe Geoblacklight::Document::SidebarComponent, type: :component do
6
+ subject(:component) { described_class.new(presenter: presenter) }
7
+
8
+ let(:view_context) { vc_test_controller.view_context }
9
+ let(:presenter) { view_context.document_presenter(document) }
10
+ let(:document) { SolrDocument.new(JSON.parse(read_fixture(fixture))) }
11
+
12
+ before do
13
+ allow_any_instance_of(Geoblacklight::DownloadLinksComponent).to receive(:render?).and_return(false)
14
+ allow_any_instance_of(Geoblacklight::LoginLinkComponent).to receive(:render?).and_return(false)
15
+
16
+ allow(document).to receive(:more_like_this).and_return([])
17
+ allow_any_instance_of(Blacklight::DocumentHelperBehavior).to receive(:current_bookmarks).and_return([])
18
+
19
+ with_controller_class(CatalogController) do
20
+ allow(vc_test_controller).to receive_messages(current_or_guest_user: User.new)
21
+ render_inline(component)
22
+ end
23
+ end
24
+
25
+ context "when the document viewer protocol is IIIF" do
26
+ let(:fixture) { "solr_documents/public_iiif_princeton.json" }
27
+
28
+ it "renders the static map" do
29
+ expect(page).to have_css("#static-map")
30
+ end
31
+
32
+ it "renders the Location label" do
33
+ expect(page).to have_content("Location")
34
+ end
35
+ end
36
+
37
+ context "when the document viewer protocol is WMS" do
38
+ let(:fixture) { "solr_documents/restricted-line.json" }
39
+
40
+ it "does not render the static map" do
41
+ expect(page).to have_no_css("#static-map")
42
+ end
43
+
44
+ it "does not render the Location label" do
45
+ expect(page).to have_no_content("Location")
46
+ end
47
+ end
48
+ end