geoblacklight_admin 0.0.1 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +59 -36
- data/Rakefile +47 -14
- data/app/assets/javascripts/geoblacklight_admin.js +2 -1
- data/app/assets/stylesheets/geoblacklight_admin/_core.scss +5 -0
- data/app/assets/stylesheets/geoblacklight_admin/modules/_chosen.scss +425 -0
- data/app/assets/stylesheets/geoblacklight_admin/modules/_forms.scss +108 -0
- data/app/controllers/admin/admin_controller.rb +4 -2
- data/app/controllers/admin/advanced_search_controller.rb +123 -103
- data/app/controllers/admin/api_controller.rb +123 -108
- data/app/controllers/admin/bookmarks_controller.rb +4 -4
- data/app/controllers/admin/bulk_actions_controller.rb +9 -4
- data/app/controllers/admin/concerns/upload_util.rb +2 -0
- data/app/controllers/admin/document_accesses_controller.rb +10 -4
- data/app/controllers/admin/document_assets_controller.rb +14 -11
- data/app/controllers/admin/document_downloads_controller.rb +12 -10
- data/app/controllers/admin/documents_controller.rb +32 -15
- data/app/controllers/admin/elements_controller.rb +6 -5
- data/app/controllers/admin/form_elements_controller.rb +4 -4
- data/app/controllers/admin/ids_controller.rb +107 -87
- data/app/controllers/admin/import_documents_controller.rb +1 -1
- data/app/controllers/admin/imports_controller.rb +7 -3
- data/app/controllers/admin/mappings_controller.rb +6 -4
- data/app/controllers/admin/notifications_controller.rb +1 -1
- data/app/controllers/admin/search_controller.rb +3 -2
- data/app/controllers/admin/users_controller.rb +2 -2
- data/app/helpers/form_input_helper.rb +4 -4
- data/app/helpers/geoblacklight_admin_helper.rb +1 -1
- data/app/indexers/document_indexer.rb +1 -1
- data/app/jobs/export_job.rb +9 -6
- data/app/jobs/export_json_bulk_job.rb +95 -0
- data/app/jobs/export_json_job.rb +14 -12
- data/app/models/admin/bookmark.rb +18 -0
- data/app/models/api_search_builder.rb +3 -1
- data/app/models/blacklight_api.rb +6 -6
- data/app/models/blacklight_api_facets.rb +7 -2
- data/app/models/blacklight_api_ids.rb +3 -4
- data/app/models/bulk_action.rb +1 -1
- data/app/models/document/bbox_validator.rb +9 -5
- data/app/models/document/date_range_validator.rb +13 -10
- data/app/models/document/geom_validator.rb +4 -2
- data/app/models/document.rb +15 -7
- data/app/models/element.rb +9 -7
- data/app/models/form_control.rb +2 -0
- data/app/models/form_element.rb +2 -0
- data/app/models/form_feature.rb +2 -0
- data/app/models/form_group.rb +2 -0
- data/app/models/form_header.rb +2 -0
- data/app/models/geoblacklight_admin/schema.rb +5 -2
- data/app/models/geoblacklight_admin.rb +2 -0
- data/app/models/import/csv_duplicates_validator.rb +2 -1
- data/app/models/import/csv_header_validator.rb +2 -1
- data/app/models/import.rb +4 -7
- data/app/models/user.rb +1 -1
- data/app/services/export_csv_service.rb +5 -1
- data/app/views/admin/advanced_search/facets.json.jbuilder +9 -8
- data/app/views/admin/advanced_search/index.json.jbuilder +8 -7
- data/app/views/admin/api/_field.json.jbuilder +1 -1
- data/app/views/admin/api/fetch.json.jbuilder +8 -7
- data/app/views/admin/api/index.json.jbuilder +8 -7
- data/app/views/admin/bookmarks/index.html.erb +2 -2
- data/app/views/admin/bulk_actions/index.html.erb +3 -3
- data/app/views/admin/bulk_actions/show.html.erb +1 -1
- data/app/views/admin/document_accesses/_form.html.erb +1 -1
- data/app/views/admin/document_accesses/destroy_all.html.erb +3 -3
- data/app/views/admin/document_accesses/edit.html.erb +1 -1
- data/app/views/admin/document_accesses/import.html.erb +2 -2
- data/app/views/admin/document_accesses/index.html.erb +9 -9
- data/app/views/admin/document_accesses/new.html.erb +1 -1
- data/app/views/admin/document_downloads/_form.html.erb +1 -1
- data/app/views/admin/document_downloads/destroy_all.html.erb +2 -2
- data/app/views/admin/document_downloads/edit.html.erb +2 -3
- data/app/views/admin/document_downloads/import.html.erb +1 -1
- data/app/views/admin/document_downloads/index.html.erb +9 -9
- data/app/views/admin/document_downloads/new.html.erb +1 -1
- data/app/views/admin/document_downloads/show.html.erb +2 -2
- data/app/views/admin/documents/_document_bookmark.html.erb +1 -1
- data/app/views/admin/documents/_form_nav.html.erb +3 -1
- data/app/views/admin/documents/_json_btaa_aardvark.jbuilder +1 -3
- data/app/views/admin/documents/_json_file.jbuilder +14 -0
- data/app/views/admin/documents/_result_selected_options.html.erb +3 -1
- data/app/views/admin/documents/edit.html.erb +1 -1
- data/app/views/admin/documents/features/_multiple_download_links.html.erb +2 -2
- data/app/views/admin/documents/fetch.json_file.jbuilder +9 -0
- data/app/views/admin/documents/index.html.erb +2 -4
- data/app/views/admin/documents/index.json_file.jbuilder +9 -0
- data/app/views/admin/documents/versions.html.erb +1 -1
- data/app/views/admin/elements/_element.json.jbuilder +4 -1
- data/app/views/admin/elements/_form.html.erb +1 -1
- data/app/views/admin/elements/edit.html.erb +2 -2
- data/app/views/admin/elements/index.html.erb +4 -4
- data/app/views/admin/elements/index.json.jbuilder +2 -0
- data/app/views/admin/elements/new.html.erb +1 -1
- data/app/views/admin/elements/show.html.erb +6 -6
- data/app/views/admin/elements/show.json.jbuilder +2 -0
- data/app/views/admin/form_elements/_form.html.erb +1 -1
- data/app/views/admin/form_elements/_form_element.json.jbuilder +2 -0
- data/app/views/admin/form_elements/edit.html.erb +2 -2
- data/app/views/admin/form_elements/index.html.erb +2 -2
- data/app/views/admin/form_elements/index.json.jbuilder +2 -0
- data/app/views/admin/form_elements/new.html.erb +1 -1
- data/app/views/admin/form_elements/show.html.erb +2 -2
- data/app/views/admin/form_elements/show.json.jbuilder +2 -0
- data/app/views/admin/ids/fetch.json.jbuilder +8 -7
- data/app/views/admin/ids/index.json.jbuilder +3 -2
- data/app/views/admin/import_documents/show.html.haml +1 -1
- data/app/views/admin/imports/_import.json.jbuilder +2 -1
- data/app/views/admin/imports/_show_failed_tab.html.erb +2 -2
- data/app/views/admin/imports/_show_success_tab.html.erb +1 -1
- data/app/views/admin/imports/edit.html.erb +3 -3
- data/app/views/admin/imports/index.html.erb +3 -3
- data/app/views/admin/layouts/application.html.erb +4 -4
- data/app/views/admin/mappings/_form.html.erb +1 -1
- data/app/views/admin/mappings/_mapping.json.jbuilder +2 -1
- data/app/views/admin/mappings/edit.html.erb +2 -2
- data/app/views/admin/mappings/new.html.erb +1 -1
- data/app/views/admin/mappings/show.html.erb +2 -2
- data/app/views/admin/notifications/index.html.erb +3 -3
- data/app/views/admin/search/index.html.erb +2 -2
- data/app/views/admin/shared/_navbar.html.erb +11 -6
- data/app/views/admin/shared/_toast.html.erb +1 -1
- data/app/views/admin/users/index.html.erb +1 -1
- data/app/views/catalog/_show_gbl_admin.html.erb +3 -0
- data/config/locales/documents.en.yml +3 -0
- data/config/routes.rb +37 -33
- data/db/migrate/20230316183001_add_geoblacklight_admin_gem.rb +409 -0
- data/db/seeds.rb +7 -6
- data/db/seeds_elements.csv +56 -55
- data/db/seeds_elements.numbers +0 -0
- data/db/seeds_form_elements.csv +65 -64
- data/db/seeds_form_elements.numbers +0 -0
- data/lib/generators/geoblacklight_admin/config_generator.rb +61 -94
- data/lib/generators/geoblacklight_admin/install_generator.rb +3 -12
- data/lib/generators/geoblacklight_admin/jobs_generator.rb +3 -2
- data/lib/generators/geoblacklight_admin/models_generator.rb +0 -1
- data/lib/generators/geoblacklight_admin/templates/_show_sidebar.html.erb +19 -0
- data/lib/generators/geoblacklight_admin/templates/_user_util_links.html.erb +1 -1
- data/lib/generators/geoblacklight_admin/templates/config/database.yml +9 -5
- data/lib/generators/geoblacklight_admin/templates/config/geomg_aardvark_schema.json +12 -6
- data/lib/generators/geoblacklight_admin/templates/config/initializers/devise.rb +315 -0
- data/lib/generators/geoblacklight_admin/templates/config/initializers/geoblacklight_admin.rb +1 -2
- data/lib/generators/geoblacklight_admin/templates/config/initializers/kithe.rb +2 -0
- data/lib/generators/geoblacklight_admin/templates/config/initializers/mime_types.rb +15 -0
- data/lib/generators/geoblacklight_admin/templates/config/initializers/pagy.rb +152 -68
- data/lib/generators/geoblacklight_admin/templates/config/initializers/simple_form.rb +178 -0
- data/lib/generators/geoblacklight_admin/templates/config/initializers/simple_form_bootstrap.rb +365 -0
- data/lib/generators/geoblacklight_admin/templates/config/settings.yml +293 -0
- data/lib/generators/geoblacklight_admin/templates/javascript/controllers/results_controller.js +10 -0
- data/lib/generators/geoblacklight_admin/templates/package.json +3 -0
- data/lib/generators/geoblacklight_admin/templates/solr/conf/schema.xml +3 -3
- data/lib/generators/geoblacklight_admin/views_generator.rb +2 -3
- data/lib/geoblacklight_admin/engine.rb +5 -6
- data/lib/geoblacklight_admin/version.rb +1 -1
- data/lib/geoblacklight_admin.rb +1 -1
- data/lib/tasks/geoblacklight_admin.rake +15 -11
- metadata +101 -63
- data/.editorconfig +0 -18
- data/.gitignore +0 -75
- data/.standard.yml +0 -4
- data/Gemfile +0 -59
- data/LICENSE +0 -21
- data/app/assets/images/.keep +0 -0
- data/app/controllers/admin/concerns/.keep +0 -0
- data/app/models/bookmark.rb +0 -17
- data/app/models/concerns/.keep +0 -0
- data/db/migrate/20230316183001_add_geoblacklight_admin.rb +0 -399
- data/geoblacklight_admin.gemspec +0 -67
- data/lib/generators/geoblacklight_admin/example_docs_generator.rb +0 -18
- data/lib/generators/geoblacklight_admin/templates/.env.development.example +0 -28
- data/lib/generators/geoblacklight_admin/templates/.solr_wrapper.yml +0 -7
- data/lib/generators/geoblacklight_admin/templates/solr/snapshots/.keep +0 -0
- data/lib/tasks/.keep +0 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +0 -35
- data/template.rb +0 -16
- /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/confirmations/new.html.erb +0 -0
- /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/invitations/edit.html.erb +0 -0
- /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/invitations/new.html.erb +0 -0
- /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/mailer/invitation_instructions.html.erb +0 -0
- /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/mailer/invitation_instructions.text.erb +0 -0
- /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/passwords/edit.html.erb +0 -0
- /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/passwords/new.html.erb +0 -0
- /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/registrations/edit.html.erb +0 -0
- /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/registrations/new.html.erb +0 -0
- /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/sessions/new.html.erb +0 -0
- /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/shared/_links.html.erb +0 -0
- /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/unlocks/new.html.erb +0 -0
@@ -26,3 +26,111 @@ label, legend {
|
|
26
26
|
html {
|
27
27
|
scroll-padding-top: 4rem; /* height of your sticky header */
|
28
28
|
}
|
29
|
+
|
30
|
+
// Simple Form / Bootstrap 5 / Select
|
31
|
+
//
|
32
|
+
// GBL is using BS4 now, but SimpleForm is already on BS5
|
33
|
+
// Adding support for BS5's .form-select class until we upgrade to BS5
|
34
|
+
$form-select-padding-y: $input-padding-y;
|
35
|
+
$form-select-padding-x: $input-padding-x;
|
36
|
+
$form-select-font-family: $input-font-family;
|
37
|
+
$form-select-font-size: $input-font-size;
|
38
|
+
$form-select-indicator-padding: $form-select-padding-x * 3; // Extra padding for background-image
|
39
|
+
$form-select-font-weight: $input-font-weight;
|
40
|
+
$form-select-line-height: $input-line-height;
|
41
|
+
$form-select-color: $input-color;
|
42
|
+
$form-select-bg: $input-bg;
|
43
|
+
$form-select-disabled-color: null;
|
44
|
+
$form-select-disabled-bg: $gray-200;
|
45
|
+
$form-select-disabled-border-color: $gray-800;
|
46
|
+
$form-select-bg-position: right $form-select-padding-x center;
|
47
|
+
$form-select-bg-size: 16px 12px; // In pixels because image dimensions
|
48
|
+
$form-select-indicator-color: $gray-800;
|
49
|
+
$form-select-indicator: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='none' stroke='#{$form-select-indicator-color}' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/></svg>");
|
50
|
+
|
51
|
+
$form-select-feedback-icon-padding-end: $form-select-padding-x * 2.5 + $form-select-indicator-padding;
|
52
|
+
$form-select-feedback-icon-position: center right $form-select-indicator-padding;
|
53
|
+
$form-select-feedback-icon-size: $input-height-inner-half $input-height-inner-half;
|
54
|
+
|
55
|
+
$form-select-border-width: $input-border-width;
|
56
|
+
$form-select-border-color: $input-border-color;
|
57
|
+
$form-select-border-radius: $border-radius;
|
58
|
+
|
59
|
+
$form-select-focus-border-color: $input-focus-border-color;
|
60
|
+
$form-select-focus-width: $input-focus-width;
|
61
|
+
$form-select-focus-box-shadow: 0 0 0 $form-select-focus-width $input-btn-focus-color;
|
62
|
+
|
63
|
+
$form-select-padding-y-sm: $input-padding-y-sm;
|
64
|
+
$form-select-padding-x-sm: $input-padding-x-sm;
|
65
|
+
$form-select-font-size-sm: $input-font-size-sm;
|
66
|
+
|
67
|
+
$form-select-padding-y-lg: $input-padding-y-lg;
|
68
|
+
$form-select-padding-x-lg: $input-padding-x-lg;
|
69
|
+
$form-select-font-size-lg: $input-font-size-lg;
|
70
|
+
|
71
|
+
$form-select-transition: $input-transition;
|
72
|
+
|
73
|
+
.form-select {
|
74
|
+
display: block;
|
75
|
+
width: 100%;
|
76
|
+
padding: $form-select-padding-y $form-select-indicator-padding $form-select-padding-y $form-select-padding-x;
|
77
|
+
// stylelint-disable-next-line property-no-vendor-prefix
|
78
|
+
-moz-padding-start: subtract($form-select-padding-x, 3px); // See https://github.com/twbs/bootstrap/issues/32636
|
79
|
+
font-family: $form-select-font-family;
|
80
|
+
@include font-size($form-select-font-size);
|
81
|
+
font-weight: $form-select-font-weight;
|
82
|
+
line-height: $form-select-line-height;
|
83
|
+
color: $form-select-color;
|
84
|
+
background-color: $form-select-bg;
|
85
|
+
background-image: escape-svg($form-select-indicator);
|
86
|
+
background-repeat: no-repeat;
|
87
|
+
background-position: $form-select-bg-position;
|
88
|
+
background-size: $form-select-bg-size;
|
89
|
+
border: $form-select-border-width solid $form-select-border-color;
|
90
|
+
@include border-radius($form-select-border-radius, 0);
|
91
|
+
@include transition($form-select-transition);
|
92
|
+
appearance: none;
|
93
|
+
|
94
|
+
&:focus {
|
95
|
+
border-color: $form-select-focus-border-color;
|
96
|
+
outline: 0;
|
97
|
+
@if $enable-shadows {
|
98
|
+
@include box-shadow($form-select-box-shadow, $form-select-focus-box-shadow);
|
99
|
+
} @else {
|
100
|
+
// Avoid using mixin so we can pass custom focus shadow properly
|
101
|
+
box-shadow: $form-select-focus-box-shadow;
|
102
|
+
}
|
103
|
+
}
|
104
|
+
|
105
|
+
&[multiple],
|
106
|
+
&[size]:not([size="1"]) {
|
107
|
+
padding-right: $form-select-padding-x;
|
108
|
+
background-image: none;
|
109
|
+
}
|
110
|
+
|
111
|
+
&:disabled {
|
112
|
+
color: $form-select-disabled-color;
|
113
|
+
background-color: $form-select-disabled-bg;
|
114
|
+
border-color: $form-select-disabled-border-color;
|
115
|
+
}
|
116
|
+
|
117
|
+
// Remove outline from select box in FF
|
118
|
+
&:-moz-focusring {
|
119
|
+
color: transparent;
|
120
|
+
text-shadow: 0 0 0 $form-select-color;
|
121
|
+
}
|
122
|
+
}
|
123
|
+
|
124
|
+
.form-select-sm {
|
125
|
+
padding-top: $form-select-padding-y-sm;
|
126
|
+
padding-bottom: $form-select-padding-y-sm;
|
127
|
+
padding-left: $form-select-padding-x-sm;
|
128
|
+
@include font-size($form-select-font-size-sm);
|
129
|
+
}
|
130
|
+
|
131
|
+
.form-select-lg {
|
132
|
+
padding-top: $form-select-padding-y-lg;
|
133
|
+
padding-bottom: $form-select-padding-y-lg;
|
134
|
+
padding-left: $form-select-padding-x-lg;
|
135
|
+
@include font-size($form-select-font-size-lg);
|
136
|
+
}
|
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Admin
|
2
4
|
class AdminController < ApplicationController
|
3
5
|
include Devise::Controllers::Helpers
|
4
6
|
include Pagy::Backend
|
5
|
-
layout
|
7
|
+
layout "admin/layouts/application"
|
6
8
|
|
7
9
|
before_action :authenticate_admin!
|
8
10
|
|
@@ -13,4 +15,4 @@ module Admin
|
|
13
15
|
redirect_to :somewhere, status: :forbidden unless current_user.admin?
|
14
16
|
end
|
15
17
|
end
|
16
|
-
end
|
18
|
+
end
|
@@ -1,5 +1,7 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "blacklight/catalog"
|
4
|
+
require "blacklight_range_limit/controller_override"
|
3
5
|
|
4
6
|
module Admin
|
5
7
|
class AdvancedSearchController < Admin::AdminController
|
@@ -7,6 +9,9 @@ module Admin
|
|
7
9
|
include ::BlacklightRangeLimit::ControllerOverride
|
8
10
|
include ::Blacklight::Catalog
|
9
11
|
|
12
|
+
# No need to auth, only queries Solr
|
13
|
+
skip_before_action :authenticate_admin!
|
14
|
+
|
10
15
|
configure_blacklight do |config|
|
11
16
|
# special search builder
|
12
17
|
config.search_builder_class = ApiSearchBuilder
|
@@ -15,42 +20,44 @@ module Admin
|
|
15
20
|
config.advanced_search ||= Blacklight::OpenStructWithHashAccess.new
|
16
21
|
|
17
22
|
# Blacklight update to 7.0.0
|
18
|
-
config.add_results_document_tool(:bookmark, partial:
|
23
|
+
config.add_results_document_tool(:bookmark, partial: "bookmark_control", if: :render_bookmarks_control?)
|
19
24
|
|
20
25
|
config.add_results_collection_tool(:sort_widget)
|
21
26
|
config.add_results_collection_tool(:per_page_widget)
|
22
27
|
config.add_results_collection_tool(:view_type_group)
|
23
28
|
|
24
|
-
config.add_show_tools_partial(:bookmark, partial:
|
29
|
+
config.add_show_tools_partial(:bookmark, partial: "bookmark_control", if: :render_bookmarks_control?)
|
25
30
|
config.add_show_tools_partial(:email, callback: :email_action, validator: :validate_email_params)
|
26
|
-
config.add_show_tools_partial(:sms, if: :render_sms_action?, callback: :sms_action,
|
31
|
+
config.add_show_tools_partial(:sms, if: :render_sms_action?, callback: :sms_action,
|
32
|
+
validator: :validate_sms_params)
|
27
33
|
|
28
|
-
config.add_nav_action(:bookmark, partial:
|
34
|
+
config.add_nav_action(:bookmark, partial: "blacklight/nav/bookmark", if: :render_bookmarks_control?)
|
29
35
|
# Blacklight update to 7.0.0
|
30
36
|
|
31
37
|
# Advanced config values
|
32
38
|
config.advanced_search ||= Blacklight::OpenStructWithHashAccess.new
|
33
|
-
config.advanced_search[:url_key] ||=
|
34
|
-
config.advanced_search[:query_parser] ||=
|
39
|
+
config.advanced_search[:url_key] ||= "advanced"
|
40
|
+
config.advanced_search[:query_parser] ||= "edismax"
|
35
41
|
config.advanced_search[:form_solr_parameters] ||= {}
|
36
|
-
config.advanced_search[:form_solr_parameters][
|
37
|
-
|
38
|
-
config.advanced_search[:form_solr_parameters][
|
39
|
-
config.advanced_search[:form_solr_parameters][
|
42
|
+
config.advanced_search[:form_solr_parameters]["facet.field"] ||= [Settings.FIELDS.PROVIDER,
|
43
|
+
Settings.FIELDS.B1G_CODE, Settings.FIELDS.MEMBER_OF, Settings.FIELDS.IS_PART_OF, Settings.FIELDS.RESOURCE_CLASS, Settings.FIELDS.RESOURCE_TYPE, Settings.FIELDS.SUBJECT, Settings.FIELDS.THEME, Settings.FIELDS.FORMAT, Settings.FIELDS.SUPPRESSED, Settings.FIELDS.B1G_CHILD_RECORD, Settings.FIELDS.GEOREFERENCED]
|
44
|
+
config.advanced_search[:form_solr_parameters]["facet.query"] ||= ""
|
45
|
+
config.advanced_search[:form_solr_parameters]["facet.limit"] ||= -1
|
46
|
+
config.advanced_search[:form_solr_parameters]["facet.sort"] ||= "index"
|
40
47
|
|
41
48
|
# Map views
|
42
49
|
config.view.mapview.partials = [:index]
|
43
|
-
config.view[
|
44
|
-
config.view[
|
50
|
+
config.view["split"].title = "List view"
|
51
|
+
config.view["mapview"].title = "Map view"
|
45
52
|
|
46
53
|
config.raw_endpoint.enabled = true
|
47
54
|
|
48
55
|
## Default parameters to send to solr for all search-like requests. See also SolrHelper#solr_search_params
|
49
56
|
config.default_solr_params = {
|
50
57
|
:start => 0,
|
51
|
-
|
52
|
-
|
53
|
-
|
58
|
+
"q.alt" => "*:*",
|
59
|
+
"bf" => ["if(exists(#{Settings.FIELDS.B1G_CHILD_RECORD}),0,100)^0.5"],
|
60
|
+
"admin.api" => true
|
54
61
|
}
|
55
62
|
|
56
63
|
config.default_per_page = 20 # Works!
|
@@ -59,8 +66,8 @@ module Admin
|
|
59
66
|
## parameters included in the Blacklight-jetty document requestHandler.
|
60
67
|
#
|
61
68
|
config.default_document_solr_params = {
|
62
|
-
|
63
|
-
|
69
|
+
qt: "document",
|
70
|
+
q: "{!raw f=#{Settings.FIELDS.B1G_GEOMG_ID} v=$id}"
|
64
71
|
}
|
65
72
|
|
66
73
|
# config.search_builder_class = Geoblacklight::SearchBuilder
|
@@ -74,7 +81,7 @@ module Admin
|
|
74
81
|
|
75
82
|
# solr field configuration for document/show views
|
76
83
|
|
77
|
-
config.show.display_type_field =
|
84
|
+
config.show.display_type_field = "format"
|
78
85
|
|
79
86
|
# Custom GeoBlacklight fields which currently map to GeoBlacklight-Schema
|
80
87
|
# v0.3.2
|
@@ -112,51 +119,52 @@ module Admin
|
|
112
119
|
## FACETS
|
113
120
|
#
|
114
121
|
# Publication State
|
115
|
-
config.add_facet_field Settings.FIELDS.B1G_PUBLICATION_STATE, :
|
122
|
+
config.add_facet_field Settings.FIELDS.B1G_PUBLICATION_STATE, label: "Publication State", limit: 8,
|
123
|
+
collapse: false
|
116
124
|
|
117
125
|
# Resouce Class
|
118
|
-
config.add_facet_field Settings.FIELDS.RESOURCE_CLASS, label:
|
126
|
+
config.add_facet_field Settings.FIELDS.RESOURCE_CLASS, label: "Resource Class", limit: 8
|
119
127
|
|
120
128
|
# Contributor
|
121
|
-
config.add_facet_field Settings.FIELDS.PROVIDER, label:
|
129
|
+
config.add_facet_field Settings.FIELDS.PROVIDER, label: "Provider", limit: 15
|
122
130
|
|
123
131
|
# Accrual Method
|
124
|
-
config.add_facet_field Settings.FIELDS.B1G_ACCRUAL_METHOD, :
|
132
|
+
config.add_facet_field Settings.FIELDS.B1G_ACCRUAL_METHOD, label: "Accrual Method"
|
125
133
|
|
126
134
|
# Public/Restricted
|
127
|
-
config.add_facet_field Settings.FIELDS.ACCESS_RIGHTS, :
|
135
|
+
config.add_facet_field Settings.FIELDS.ACCESS_RIGHTS, label: "Public/Restricted"
|
128
136
|
|
129
137
|
# ADVANCED SEARCH
|
130
138
|
#
|
131
139
|
# Code
|
132
|
-
config.add_facet_field Settings.FIELDS.B1G_CODE, label:
|
140
|
+
config.add_facet_field Settings.FIELDS.B1G_CODE, label: "Code", limit: 1000
|
133
141
|
|
134
142
|
# Is Part Of
|
135
|
-
config.add_facet_field Settings.FIELDS.IS_PART_OF, label:
|
143
|
+
config.add_facet_field Settings.FIELDS.IS_PART_OF, label: "Is Part Of", limit: 1000
|
136
144
|
|
137
145
|
# Member Of
|
138
|
-
config.add_facet_field Settings.FIELDS.MEMBER_OF, label:
|
146
|
+
config.add_facet_field Settings.FIELDS.MEMBER_OF, label: "Member Of", limit: 1000
|
139
147
|
|
140
148
|
# Resource Type
|
141
|
-
config.add_facet_field Settings.FIELDS.RESOURCE_TYPE, label:
|
149
|
+
config.add_facet_field Settings.FIELDS.RESOURCE_TYPE, label: "Resource Type", limit: 1000
|
142
150
|
|
143
151
|
# Subject
|
144
|
-
config.add_facet_field Settings.FIELDS.SUBJECT, label:
|
152
|
+
config.add_facet_field Settings.FIELDS.SUBJECT, label: "Subject", limit: 1000
|
145
153
|
|
146
154
|
# Theme
|
147
|
-
config.add_facet_field Settings.FIELDS.THEME, label:
|
155
|
+
config.add_facet_field Settings.FIELDS.THEME, label: "Theme", limit: 1000
|
148
156
|
|
149
157
|
# Format
|
150
|
-
config.add_facet_field Settings.FIELDS.FORMAT, label:
|
158
|
+
config.add_facet_field Settings.FIELDS.FORMAT, label: "Format", limit: 1000
|
151
159
|
|
152
160
|
# Suppressed
|
153
|
-
config.add_facet_field Settings.FIELDS.SUPPRESSED, label:
|
161
|
+
config.add_facet_field Settings.FIELDS.SUPPRESSED, label: "Suppressed"
|
154
162
|
|
155
163
|
# Child Record
|
156
|
-
config.add_facet_field Settings.FIELDS.B1G_CHILD_RECORD, label:
|
164
|
+
config.add_facet_field Settings.FIELDS.B1G_CHILD_RECORD, label: "Child Record"
|
157
165
|
|
158
166
|
# Georeferenced
|
159
|
-
config.add_facet_field Settings.FIELDS.GEOREFERENCED, label:
|
167
|
+
config.add_facet_field Settings.FIELDS.GEOREFERENCED, label: "Georeferenced"
|
160
168
|
|
161
169
|
# Have BL send all facet field names to Solr, which has been the default
|
162
170
|
# previously. Simply remove these lines if you'd rather use Solr request
|
@@ -175,17 +183,17 @@ module Admin
|
|
175
183
|
# config.add_index_field 'published_vern_display', :label => 'Published:'
|
176
184
|
# config.add_index_field 'lc_callnum_display', :label => 'Call number:'
|
177
185
|
|
178
|
-
config.add_index_field Settings.FIELDS.TITLE, :
|
179
|
-
config.add_index_field Settings.FIELDS.B1G_GEOMG_ID, :
|
180
|
-
config.add_index_field Settings.FIELDS.PROVIDER, :
|
181
|
-
config.add_index_field Settings.FIELDS.ACCESS_RIGHTS, :
|
182
|
-
config.add_index_field Settings.FIELDS.SUBJECT, :
|
183
|
-
config.add_index_field Settings.FIELDS.CENTROID, :
|
186
|
+
config.add_index_field Settings.FIELDS.TITLE, label: "Title:"
|
187
|
+
config.add_index_field Settings.FIELDS.B1G_GEOMG_ID, label: "Identifier:"
|
188
|
+
config.add_index_field Settings.FIELDS.PROVIDER, label: "Institution:"
|
189
|
+
config.add_index_field Settings.FIELDS.ACCESS_RIGHTS, label: "Access:"
|
190
|
+
config.add_index_field Settings.FIELDS.SUBJECT, label: "Keywords:"
|
191
|
+
config.add_index_field Settings.FIELDS.CENTROID, label: "Centroid:"
|
184
192
|
config.add_index_field Settings.FIELDS.INDEX_YEAR
|
185
193
|
config.add_index_field Settings.FIELDS.CREATOR
|
186
194
|
config.add_index_field Settings.FIELDS.DESCRIPTION, helper_method: :snippit
|
187
195
|
config.add_index_field Settings.FIELDS.PUBLISHER
|
188
|
-
config.add_index_field Settings.FIELDS.SUPPRESSED, :
|
196
|
+
config.add_index_field Settings.FIELDS.SUPPRESSED, label: "Suppressed:"
|
189
197
|
|
190
198
|
# solr fields to be displayed in the show (single result) view
|
191
199
|
# The ordering of the field names is the order of the display
|
@@ -193,16 +201,19 @@ module Admin
|
|
193
201
|
# item_prop: [String] property given to span with Schema.org item property
|
194
202
|
# link_to_facet: [Boolean] that can be passed to link to a facet search
|
195
203
|
# helper_method: [Symbol] method that can be used to render the value
|
196
|
-
config.add_show_field Settings.FIELDS.CREATOR, label:
|
197
|
-
config.add_show_field Settings.FIELDS.DESCRIPTION, label:
|
198
|
-
|
199
|
-
config.add_show_field Settings.FIELDS.
|
200
|
-
config.add_show_field Settings.FIELDS.
|
201
|
-
|
202
|
-
config.add_show_field Settings.FIELDS.
|
203
|
-
config.add_show_field Settings.FIELDS.
|
204
|
-
config.add_show_field Settings.FIELDS.
|
205
|
-
|
204
|
+
config.add_show_field Settings.FIELDS.CREATOR, label: "Creator", itemprop: "creator"
|
205
|
+
config.add_show_field Settings.FIELDS.DESCRIPTION, label: "Description", itemprop: "description",
|
206
|
+
helper_method: :render_value_as_truncate_abstract
|
207
|
+
config.add_show_field Settings.FIELDS.PUBLISHER, label: "Publisher", itemprop: "publisher", link_to_facet: true
|
208
|
+
config.add_show_field Settings.FIELDS.SPATIAL_COVERAGE, label: "Place", itemprop: "spatial", link_to_facet: true,
|
209
|
+
helper_method: :render_placenames_as_truncate_abstract
|
210
|
+
config.add_show_field Settings.FIELDS.SUBJECT, label: "Subject", itemprop: "keywords", link_to_facet: true
|
211
|
+
config.add_show_field Settings.FIELDS.RESOURCE_TYPE, label: "Type", itemprop: "keywords", link_to_facet: true
|
212
|
+
config.add_show_field Settings.FIELDS.DATE_ISSUED, label: "Date Published", itemprop: "keywords",
|
213
|
+
link_to_facet: true
|
214
|
+
config.add_show_field Settings.FIELDS.TEMPORAL_COVERAGE, label: "Temporal Coverage", itemprop: "temporal"
|
215
|
+
config.add_show_field Settings.FIELDS.PROVIDER, label: "Contributed by", link_to_facet: true
|
216
|
+
config.add_show_field Settings.FIELDS.RIGHTS, label: "Access Rights"
|
206
217
|
|
207
218
|
# "fielded" search configuration. Used by pulldown among other places.
|
208
219
|
# For supported keys in hash, see rdoc for Blacklight::SearchFields
|
@@ -222,48 +233,48 @@ module Admin
|
|
222
233
|
# solr request handler? The one set in config[:default_solr_parameters][:qt],
|
223
234
|
# since we aren't specifying it otherwise.
|
224
235
|
|
225
|
-
config.add_search_field(
|
236
|
+
config.add_search_field("all_fields") do |field|
|
226
237
|
field.include_in_advanced_search = false
|
227
|
-
field.label =
|
238
|
+
field.label = "All Fields"
|
228
239
|
end
|
229
240
|
|
230
|
-
config.add_search_field(
|
241
|
+
config.add_search_field("keyword") do |field|
|
231
242
|
field.include_in_simple_select = false
|
232
|
-
field.qt =
|
233
|
-
field.label =
|
243
|
+
field.qt = "search"
|
244
|
+
field.label = "Keyword"
|
234
245
|
field.solr_local_parameters = {
|
235
|
-
qf:
|
236
|
-
pf:
|
246
|
+
qf: "$qf",
|
247
|
+
pf: "$pf"
|
237
248
|
}
|
238
249
|
end
|
239
250
|
|
240
|
-
config.add_search_field(
|
251
|
+
config.add_search_field("title") do |field|
|
241
252
|
field.include_in_simple_select = false
|
242
|
-
field.qt =
|
243
|
-
field.label =
|
253
|
+
field.qt = "search"
|
254
|
+
field.label = "Title"
|
244
255
|
field.solr_local_parameters = {
|
245
|
-
qf:
|
246
|
-
pf:
|
256
|
+
qf: "$title_qf",
|
257
|
+
pf: "$title_pf"
|
247
258
|
}
|
248
259
|
end
|
249
260
|
|
250
|
-
config.add_search_field(
|
261
|
+
config.add_search_field("placename") do |field|
|
251
262
|
field.include_in_simple_select = false
|
252
|
-
field.qt =
|
253
|
-
field.label =
|
263
|
+
field.qt = "search"
|
264
|
+
field.label = "Place"
|
254
265
|
field.solr_local_parameters = {
|
255
|
-
qf:
|
256
|
-
pf:
|
266
|
+
qf: "$placename_qf",
|
267
|
+
pf: "$placename_pf"
|
257
268
|
}
|
258
269
|
end
|
259
270
|
|
260
|
-
config.add_search_field(
|
271
|
+
config.add_search_field("publisher") do |field|
|
261
272
|
field.include_in_simple_select = false
|
262
|
-
field.qt =
|
263
|
-
field.label =
|
273
|
+
field.qt = "search"
|
274
|
+
field.label = "Publisher/Creator"
|
264
275
|
field.solr_local_parameters = {
|
265
|
-
qf:
|
266
|
-
pf:
|
276
|
+
qf: "$publisher_qf",
|
277
|
+
pf: "$publisher_pf"
|
267
278
|
}
|
268
279
|
end
|
269
280
|
|
@@ -271,39 +282,50 @@ module Admin
|
|
271
282
|
# label in pulldown is followed by the name of the SOLR field to sort by and
|
272
283
|
# whether the sort is ascending or descending (it must be asc or desc
|
273
284
|
# except in the relevancy case).
|
274
|
-
config.add_sort_field
|
275
|
-
config.add_sort_field "#{Settings.FIELDS.INDEX_YEAR} desc, dct_title_sort asc", :
|
276
|
-
config.add_sort_field "#{Settings.FIELDS.INDEX_YEAR} asc, dct_title_sort asc", :
|
277
|
-
config.add_sort_field
|
278
|
-
config.add_sort_field
|
285
|
+
config.add_sort_field "score desc, dct_title_sort asc", label: "Relevance"
|
286
|
+
config.add_sort_field "#{Settings.FIELDS.INDEX_YEAR} desc, dct_title_sort asc", label: "Year (Newest first)"
|
287
|
+
config.add_sort_field "#{Settings.FIELDS.INDEX_YEAR} asc, dct_title_sort asc", label: "Year (Oldest first)"
|
288
|
+
config.add_sort_field "dct_title_sort asc", label: "Title (A-Z)"
|
289
|
+
config.add_sort_field "dct_title_sort desc", label: "Title (Z-A)"
|
279
290
|
|
280
291
|
# If there are more than this many search results, no spelling ("did you
|
281
292
|
# mean") suggestion is offered.
|
282
293
|
config.spell_max = 5
|
283
294
|
|
284
295
|
# Custom tools for GeoBlacklight
|
285
|
-
config.add_show_tools_partial :more_details, partial:
|
286
|
-
|
287
|
-
|
288
|
-
config.add_show_tools_partial :
|
289
|
-
|
296
|
+
config.add_show_tools_partial :more_details, partial: "more_details", if: proc { |_context, _config, options|
|
297
|
+
options[:document] && (!options[:document].references.nil? & !options[:document].references.url.nil?)
|
298
|
+
}
|
299
|
+
config.add_show_tools_partial :metadata, if: proc { |_context, _config, options|
|
300
|
+
options[:document] && (Settings.METADATA_SHOWN & options[:document].references.refs.map(&:type).map(&:to_s)).any?
|
301
|
+
}
|
302
|
+
config.add_show_tools_partial :web_services, if: proc { |_context, _config, options|
|
303
|
+
options[:document] && (Settings.WEBSERVICES_SHOWN & options[:document].references.refs.map(&:type).map(&:to_s)).any?
|
304
|
+
}
|
305
|
+
config.add_show_tools_partial :exports, partial: "exports", if: proc { |_context, _config, options|
|
306
|
+
options[:document]
|
307
|
+
}
|
308
|
+
config.add_show_tools_partial :data_dictionary, partial: "data_dictionary", if: proc { |_context, _config, options|
|
309
|
+
options[:document] && options[:document].data_dictionary_download.present?
|
310
|
+
}
|
290
311
|
config.add_show_tools_partial(:citation)
|
291
|
-
config.add_show_tools_partial(:access_links, partial:
|
312
|
+
config.add_show_tools_partial(:access_links, partial: "access_links", if: proc { |_context, _config, options|
|
313
|
+
options[:document] && options[:document].access_links.present?
|
314
|
+
})
|
292
315
|
|
293
316
|
# Remove nav actions
|
294
|
-
config.add_nav_action(:bookmark, partial:
|
317
|
+
config.add_nav_action(:bookmark, partial: "blacklight/nav/bookmark", if: false)
|
295
318
|
|
296
319
|
# Remove show tools
|
297
320
|
config.show.partials.delete(:show_header)
|
298
321
|
config.show.partials.delete(:show)
|
299
322
|
|
300
|
-
config.show.display_type_field =
|
301
|
-
config.show.partials <<
|
302
|
-
config.show.partials <<
|
303
|
-
config.show.partials <<
|
304
|
-
config.show.partials <<
|
305
|
-
config.show.partials <<
|
306
|
-
|
323
|
+
config.show.display_type_field = "format"
|
324
|
+
config.show.partials << "show_header"
|
325
|
+
config.show.partials << "show_default_viewer_container"
|
326
|
+
config.show.partials << "show_default_viewer_information"
|
327
|
+
config.show.partials << "show_default_attribute_table"
|
328
|
+
config.show.partials << "show"
|
307
329
|
|
308
330
|
config.show.document_actions.delete(:email)
|
309
331
|
config.show.document_actions.delete(:bookmark)
|
@@ -315,30 +337,30 @@ module Admin
|
|
315
337
|
# 'mapquest' http://developer.mapquest.com/web/products/open/map
|
316
338
|
# 'positron' http://cartodb.com/basemaps/
|
317
339
|
# 'darkMatter' http://cartodb.com/basemaps/
|
318
|
-
config.basemap_provider =
|
319
|
-
config.max_per_page =
|
340
|
+
config.basemap_provider = "esri"
|
341
|
+
config.max_per_page = 100_000
|
320
342
|
|
321
343
|
# Configuration for autocomplete suggestor
|
322
344
|
config.autocomplete_enabled = true
|
323
|
-
config.autocomplete_path =
|
345
|
+
config.autocomplete_path = "suggest"
|
324
346
|
end
|
325
347
|
|
326
348
|
# Administrative view of document
|
327
349
|
# - Sidecar Image
|
328
350
|
# - URIs
|
329
351
|
def admin
|
330
|
-
|
352
|
+
_, @document = search_service.fetch(params[:id])
|
331
353
|
end
|
332
354
|
|
333
355
|
# Administrative view for array of document ids
|
334
356
|
# - bookmarks
|
335
357
|
def fetch
|
336
|
-
@response,
|
358
|
+
@response, = search_service.fetch(params[:id])
|
337
359
|
|
338
360
|
respond_to do |format|
|
339
361
|
format.json do
|
340
362
|
@presenter = Blacklight::JsonPresenter.new(@response,
|
341
|
-
|
363
|
+
blacklight_config)
|
342
364
|
end
|
343
365
|
end
|
344
366
|
end
|
@@ -348,16 +370,14 @@ module Admin
|
|
348
370
|
# We want to find the facets available for the current search, but:
|
349
371
|
# * IGNORING current query (add in facets_for_advanced_search_form filter)
|
350
372
|
# * IGNORING current advanced search facets (remove add_advanced_search_to_solr filter)
|
351
|
-
@response,
|
373
|
+
@response, = search_service.search_results do |search_builder|
|
352
374
|
search_builder.except(:add_advanced_search_to_solr).append(:facets_for_advanced_search_form)
|
353
375
|
end
|
354
376
|
|
355
|
-
@response
|
356
|
-
|
357
377
|
respond_to do |format|
|
358
378
|
format.json do
|
359
379
|
@presenter = Blacklight::JsonPresenter.new(@response,
|
360
|
-
|
380
|
+
blacklight_config)
|
361
381
|
end
|
362
382
|
end
|
363
383
|
end
|