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.
Files changed (186) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +59 -36
  3. data/Rakefile +47 -14
  4. data/app/assets/javascripts/geoblacklight_admin.js +2 -1
  5. data/app/assets/stylesheets/geoblacklight_admin/_core.scss +5 -0
  6. data/app/assets/stylesheets/geoblacklight_admin/modules/_chosen.scss +425 -0
  7. data/app/assets/stylesheets/geoblacklight_admin/modules/_forms.scss +108 -0
  8. data/app/controllers/admin/admin_controller.rb +4 -2
  9. data/app/controllers/admin/advanced_search_controller.rb +123 -103
  10. data/app/controllers/admin/api_controller.rb +123 -108
  11. data/app/controllers/admin/bookmarks_controller.rb +4 -4
  12. data/app/controllers/admin/bulk_actions_controller.rb +9 -4
  13. data/app/controllers/admin/concerns/upload_util.rb +2 -0
  14. data/app/controllers/admin/document_accesses_controller.rb +10 -4
  15. data/app/controllers/admin/document_assets_controller.rb +14 -11
  16. data/app/controllers/admin/document_downloads_controller.rb +12 -10
  17. data/app/controllers/admin/documents_controller.rb +32 -15
  18. data/app/controllers/admin/elements_controller.rb +6 -5
  19. data/app/controllers/admin/form_elements_controller.rb +4 -4
  20. data/app/controllers/admin/ids_controller.rb +107 -87
  21. data/app/controllers/admin/import_documents_controller.rb +1 -1
  22. data/app/controllers/admin/imports_controller.rb +7 -3
  23. data/app/controllers/admin/mappings_controller.rb +6 -4
  24. data/app/controllers/admin/notifications_controller.rb +1 -1
  25. data/app/controllers/admin/search_controller.rb +3 -2
  26. data/app/controllers/admin/users_controller.rb +2 -2
  27. data/app/helpers/form_input_helper.rb +4 -4
  28. data/app/helpers/geoblacklight_admin_helper.rb +1 -1
  29. data/app/indexers/document_indexer.rb +1 -1
  30. data/app/jobs/export_job.rb +9 -6
  31. data/app/jobs/export_json_bulk_job.rb +95 -0
  32. data/app/jobs/export_json_job.rb +14 -12
  33. data/app/models/admin/bookmark.rb +18 -0
  34. data/app/models/api_search_builder.rb +3 -1
  35. data/app/models/blacklight_api.rb +6 -6
  36. data/app/models/blacklight_api_facets.rb +7 -2
  37. data/app/models/blacklight_api_ids.rb +3 -4
  38. data/app/models/bulk_action.rb +1 -1
  39. data/app/models/document/bbox_validator.rb +9 -5
  40. data/app/models/document/date_range_validator.rb +13 -10
  41. data/app/models/document/geom_validator.rb +4 -2
  42. data/app/models/document.rb +15 -7
  43. data/app/models/element.rb +9 -7
  44. data/app/models/form_control.rb +2 -0
  45. data/app/models/form_element.rb +2 -0
  46. data/app/models/form_feature.rb +2 -0
  47. data/app/models/form_group.rb +2 -0
  48. data/app/models/form_header.rb +2 -0
  49. data/app/models/geoblacklight_admin/schema.rb +5 -2
  50. data/app/models/geoblacklight_admin.rb +2 -0
  51. data/app/models/import/csv_duplicates_validator.rb +2 -1
  52. data/app/models/import/csv_header_validator.rb +2 -1
  53. data/app/models/import.rb +4 -7
  54. data/app/models/user.rb +1 -1
  55. data/app/services/export_csv_service.rb +5 -1
  56. data/app/views/admin/advanced_search/facets.json.jbuilder +9 -8
  57. data/app/views/admin/advanced_search/index.json.jbuilder +8 -7
  58. data/app/views/admin/api/_field.json.jbuilder +1 -1
  59. data/app/views/admin/api/fetch.json.jbuilder +8 -7
  60. data/app/views/admin/api/index.json.jbuilder +8 -7
  61. data/app/views/admin/bookmarks/index.html.erb +2 -2
  62. data/app/views/admin/bulk_actions/index.html.erb +3 -3
  63. data/app/views/admin/bulk_actions/show.html.erb +1 -1
  64. data/app/views/admin/document_accesses/_form.html.erb +1 -1
  65. data/app/views/admin/document_accesses/destroy_all.html.erb +3 -3
  66. data/app/views/admin/document_accesses/edit.html.erb +1 -1
  67. data/app/views/admin/document_accesses/import.html.erb +2 -2
  68. data/app/views/admin/document_accesses/index.html.erb +9 -9
  69. data/app/views/admin/document_accesses/new.html.erb +1 -1
  70. data/app/views/admin/document_downloads/_form.html.erb +1 -1
  71. data/app/views/admin/document_downloads/destroy_all.html.erb +2 -2
  72. data/app/views/admin/document_downloads/edit.html.erb +2 -3
  73. data/app/views/admin/document_downloads/import.html.erb +1 -1
  74. data/app/views/admin/document_downloads/index.html.erb +9 -9
  75. data/app/views/admin/document_downloads/new.html.erb +1 -1
  76. data/app/views/admin/document_downloads/show.html.erb +2 -2
  77. data/app/views/admin/documents/_document_bookmark.html.erb +1 -1
  78. data/app/views/admin/documents/_form_nav.html.erb +3 -1
  79. data/app/views/admin/documents/_json_btaa_aardvark.jbuilder +1 -3
  80. data/app/views/admin/documents/_json_file.jbuilder +14 -0
  81. data/app/views/admin/documents/_result_selected_options.html.erb +3 -1
  82. data/app/views/admin/documents/edit.html.erb +1 -1
  83. data/app/views/admin/documents/features/_multiple_download_links.html.erb +2 -2
  84. data/app/views/admin/documents/fetch.json_file.jbuilder +9 -0
  85. data/app/views/admin/documents/index.html.erb +2 -4
  86. data/app/views/admin/documents/index.json_file.jbuilder +9 -0
  87. data/app/views/admin/documents/versions.html.erb +1 -1
  88. data/app/views/admin/elements/_element.json.jbuilder +4 -1
  89. data/app/views/admin/elements/_form.html.erb +1 -1
  90. data/app/views/admin/elements/edit.html.erb +2 -2
  91. data/app/views/admin/elements/index.html.erb +4 -4
  92. data/app/views/admin/elements/index.json.jbuilder +2 -0
  93. data/app/views/admin/elements/new.html.erb +1 -1
  94. data/app/views/admin/elements/show.html.erb +6 -6
  95. data/app/views/admin/elements/show.json.jbuilder +2 -0
  96. data/app/views/admin/form_elements/_form.html.erb +1 -1
  97. data/app/views/admin/form_elements/_form_element.json.jbuilder +2 -0
  98. data/app/views/admin/form_elements/edit.html.erb +2 -2
  99. data/app/views/admin/form_elements/index.html.erb +2 -2
  100. data/app/views/admin/form_elements/index.json.jbuilder +2 -0
  101. data/app/views/admin/form_elements/new.html.erb +1 -1
  102. data/app/views/admin/form_elements/show.html.erb +2 -2
  103. data/app/views/admin/form_elements/show.json.jbuilder +2 -0
  104. data/app/views/admin/ids/fetch.json.jbuilder +8 -7
  105. data/app/views/admin/ids/index.json.jbuilder +3 -2
  106. data/app/views/admin/import_documents/show.html.haml +1 -1
  107. data/app/views/admin/imports/_import.json.jbuilder +2 -1
  108. data/app/views/admin/imports/_show_failed_tab.html.erb +2 -2
  109. data/app/views/admin/imports/_show_success_tab.html.erb +1 -1
  110. data/app/views/admin/imports/edit.html.erb +3 -3
  111. data/app/views/admin/imports/index.html.erb +3 -3
  112. data/app/views/admin/layouts/application.html.erb +4 -4
  113. data/app/views/admin/mappings/_form.html.erb +1 -1
  114. data/app/views/admin/mappings/_mapping.json.jbuilder +2 -1
  115. data/app/views/admin/mappings/edit.html.erb +2 -2
  116. data/app/views/admin/mappings/new.html.erb +1 -1
  117. data/app/views/admin/mappings/show.html.erb +2 -2
  118. data/app/views/admin/notifications/index.html.erb +3 -3
  119. data/app/views/admin/search/index.html.erb +2 -2
  120. data/app/views/admin/shared/_navbar.html.erb +11 -6
  121. data/app/views/admin/shared/_toast.html.erb +1 -1
  122. data/app/views/admin/users/index.html.erb +1 -1
  123. data/app/views/catalog/_show_gbl_admin.html.erb +3 -0
  124. data/config/locales/documents.en.yml +3 -0
  125. data/config/routes.rb +37 -33
  126. data/db/migrate/20230316183001_add_geoblacklight_admin_gem.rb +409 -0
  127. data/db/seeds.rb +7 -6
  128. data/db/seeds_elements.csv +56 -55
  129. data/db/seeds_elements.numbers +0 -0
  130. data/db/seeds_form_elements.csv +65 -64
  131. data/db/seeds_form_elements.numbers +0 -0
  132. data/lib/generators/geoblacklight_admin/config_generator.rb +61 -94
  133. data/lib/generators/geoblacklight_admin/install_generator.rb +3 -12
  134. data/lib/generators/geoblacklight_admin/jobs_generator.rb +3 -2
  135. data/lib/generators/geoblacklight_admin/models_generator.rb +0 -1
  136. data/lib/generators/geoblacklight_admin/templates/_show_sidebar.html.erb +19 -0
  137. data/lib/generators/geoblacklight_admin/templates/_user_util_links.html.erb +1 -1
  138. data/lib/generators/geoblacklight_admin/templates/config/database.yml +9 -5
  139. data/lib/generators/geoblacklight_admin/templates/config/geomg_aardvark_schema.json +12 -6
  140. data/lib/generators/geoblacklight_admin/templates/config/initializers/devise.rb +315 -0
  141. data/lib/generators/geoblacklight_admin/templates/config/initializers/geoblacklight_admin.rb +1 -2
  142. data/lib/generators/geoblacklight_admin/templates/config/initializers/kithe.rb +2 -0
  143. data/lib/generators/geoblacklight_admin/templates/config/initializers/mime_types.rb +15 -0
  144. data/lib/generators/geoblacklight_admin/templates/config/initializers/pagy.rb +152 -68
  145. data/lib/generators/geoblacklight_admin/templates/config/initializers/simple_form.rb +178 -0
  146. data/lib/generators/geoblacklight_admin/templates/config/initializers/simple_form_bootstrap.rb +365 -0
  147. data/lib/generators/geoblacklight_admin/templates/config/settings.yml +293 -0
  148. data/lib/generators/geoblacklight_admin/templates/javascript/controllers/results_controller.js +10 -0
  149. data/lib/generators/geoblacklight_admin/templates/package.json +3 -0
  150. data/lib/generators/geoblacklight_admin/templates/solr/conf/schema.xml +3 -3
  151. data/lib/generators/geoblacklight_admin/views_generator.rb +2 -3
  152. data/lib/geoblacklight_admin/engine.rb +5 -6
  153. data/lib/geoblacklight_admin/version.rb +1 -1
  154. data/lib/geoblacklight_admin.rb +1 -1
  155. data/lib/tasks/geoblacklight_admin.rake +15 -11
  156. metadata +101 -63
  157. data/.editorconfig +0 -18
  158. data/.gitignore +0 -75
  159. data/.standard.yml +0 -4
  160. data/Gemfile +0 -59
  161. data/LICENSE +0 -21
  162. data/app/assets/images/.keep +0 -0
  163. data/app/controllers/admin/concerns/.keep +0 -0
  164. data/app/models/bookmark.rb +0 -17
  165. data/app/models/concerns/.keep +0 -0
  166. data/db/migrate/20230316183001_add_geoblacklight_admin.rb +0 -399
  167. data/geoblacklight_admin.gemspec +0 -67
  168. data/lib/generators/geoblacklight_admin/example_docs_generator.rb +0 -18
  169. data/lib/generators/geoblacklight_admin/templates/.env.development.example +0 -28
  170. data/lib/generators/geoblacklight_admin/templates/.solr_wrapper.yml +0 -7
  171. data/lib/generators/geoblacklight_admin/templates/solr/snapshots/.keep +0 -0
  172. data/lib/tasks/.keep +0 -0
  173. data/spec/test_app_templates/lib/generators/test_app_generator.rb +0 -35
  174. data/template.rb +0 -16
  175. /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/confirmations/new.html.erb +0 -0
  176. /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/invitations/edit.html.erb +0 -0
  177. /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/invitations/new.html.erb +0 -0
  178. /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/mailer/invitation_instructions.html.erb +0 -0
  179. /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/mailer/invitation_instructions.text.erb +0 -0
  180. /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/passwords/edit.html.erb +0 -0
  181. /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/passwords/new.html.erb +0 -0
  182. /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/registrations/edit.html.erb +0 -0
  183. /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/registrations/new.html.erb +0 -0
  184. /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/sessions/new.html.erb +0 -0
  185. /data/{app/views/admin → lib/generators/geoblacklight_admin/templates}/devise/shared/_links.html.erb +0 -0
  186. /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 'admin/layouts/application'
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
- # -*- encoding : utf-8 -*-
2
- require 'blacklight/catalog'
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: 'bookmark_control', if: :render_bookmarks_control?)
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: 'bookmark_control', if: :render_bookmarks_control?)
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, validator: :validate_sms_params)
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: 'blacklight/nav/bookmark', if: :render_bookmarks_control?)
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] ||= 'advanced'
34
- config.advanced_search[:query_parser] ||= 'edismax'
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]['facet.field'] ||= [Settings.FIELDS.PROVIDER, 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]
37
- config.advanced_search[:form_solr_parameters]['facet.query'] ||= ''
38
- config.advanced_search[:form_solr_parameters]['facet.limit'] ||= -1
39
- config.advanced_search[:form_solr_parameters]['facet.sort'] ||= 'index'
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['split'].title = "List view"
44
- config.view['mapview'].title = "Map 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
- 'q.alt' => '*:*',
52
- 'bf' => ["if(exists(#{Settings.FIELDS.B1G_CHILD_RECORD}),0,100)^0.5"],
53
- 'admin.api' => true
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
- :qt => 'document',
63
- :q => "{!raw f=#{Settings.FIELDS.B1G_GEOMG_ID} v=$id}"
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 = 'format'
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, :label => 'Publication State', :limit => 8, collapse: false
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: 'Resource Class', limit: 8
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: 'Provider', limit: 15
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, :label => '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, :label => 'Public/Restricted'
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: 'Code', limit: 1000
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: 'Is Part Of', limit: 1000
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: 'Member Of', limit: 1000
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: 'Resource Type', limit: 1000
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: 'Subject', limit: 1000
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: 'Theme', limit: 1000
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: 'Format', limit: 1000
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: 'Suppressed'
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: 'Child Record'
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: 'Georeferenced'
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, :label => 'Title:'
179
- config.add_index_field Settings.FIELDS.B1G_GEOMG_ID, :label => 'Identifier:'
180
- config.add_index_field Settings.FIELDS.PROVIDER, :label => 'Institution:'
181
- config.add_index_field Settings.FIELDS.ACCESS_RIGHTS, :label => 'Access:'
182
- config.add_index_field Settings.FIELDS.SUBJECT, :label => 'Keywords:'
183
- config.add_index_field Settings.FIELDS.CENTROID, :label => '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, :label => '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: 'Creator', itemprop: 'creator'
197
- config.add_show_field Settings.FIELDS.DESCRIPTION, label: 'Description', itemprop: 'description', helper_method: :render_value_as_truncate_abstract
198
- config.add_show_field Settings.FIELDS.PUBLISHER, label: 'Publisher', itemprop: 'publisher', link_to_facet: true
199
- config.add_show_field Settings.FIELDS.SPATIAL_COVERAGE, label: 'Place', itemprop: 'spatial', link_to_facet: true, helper_method: :render_placenames_as_truncate_abstract
200
- config.add_show_field Settings.FIELDS.SUBJECT, label: 'Subject', itemprop: 'keywords', link_to_facet: true
201
- config.add_show_field Settings.FIELDS.RESOURCE_TYPE, label: 'Type', itemprop: 'keywords', link_to_facet: true
202
- config.add_show_field Settings.FIELDS.DATE_ISSUED, label: 'Date Published', itemprop: 'keywords', link_to_facet: true
203
- config.add_show_field Settings.FIELDS.TEMPORAL_COVERAGE, label: 'Temporal Coverage', itemprop: 'temporal'
204
- config.add_show_field Settings.FIELDS.PROVIDER, label: 'Contributed by', link_to_facet: true
205
- config.add_show_field Settings.FIELDS.RIGHTS, label: 'Access Rights'
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('all_fields') do |field|
236
+ config.add_search_field("all_fields") do |field|
226
237
  field.include_in_advanced_search = false
227
- field.label = 'All Fields'
238
+ field.label = "All Fields"
228
239
  end
229
240
 
230
- config.add_search_field('keyword') do |field|
241
+ config.add_search_field("keyword") do |field|
231
242
  field.include_in_simple_select = false
232
- field.qt = 'search'
233
- field.label = 'Keyword'
243
+ field.qt = "search"
244
+ field.label = "Keyword"
234
245
  field.solr_local_parameters = {
235
- qf: '$qf',
236
- pf: '$pf'
246
+ qf: "$qf",
247
+ pf: "$pf"
237
248
  }
238
249
  end
239
250
 
240
- config.add_search_field('title') do |field|
251
+ config.add_search_field("title") do |field|
241
252
  field.include_in_simple_select = false
242
- field.qt = 'search'
243
- field.label = 'Title'
253
+ field.qt = "search"
254
+ field.label = "Title"
244
255
  field.solr_local_parameters = {
245
- qf: '$title_qf',
246
- pf: '$title_pf'
256
+ qf: "$title_qf",
257
+ pf: "$title_pf"
247
258
  }
248
259
  end
249
260
 
250
- config.add_search_field('placename') do |field|
261
+ config.add_search_field("placename") do |field|
251
262
  field.include_in_simple_select = false
252
- field.qt = 'search'
253
- field.label = 'Place'
263
+ field.qt = "search"
264
+ field.label = "Place"
254
265
  field.solr_local_parameters = {
255
- qf: '$placename_qf',
256
- pf: '$placename_pf'
266
+ qf: "$placename_qf",
267
+ pf: "$placename_pf"
257
268
  }
258
269
  end
259
270
 
260
- config.add_search_field('publisher') do |field|
271
+ config.add_search_field("publisher") do |field|
261
272
  field.include_in_simple_select = false
262
- field.qt = 'search'
263
- field.label = 'Publisher/Creator'
273
+ field.qt = "search"
274
+ field.label = "Publisher/Creator"
264
275
  field.solr_local_parameters = {
265
- qf: '$publisher_qf',
266
- pf: '$publisher_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 'score desc, dct_title_sort asc', :label => 'Relevance'
275
- config.add_sort_field "#{Settings.FIELDS.INDEX_YEAR} desc, dct_title_sort asc", :label => 'Year (Newest first)'
276
- config.add_sort_field "#{Settings.FIELDS.INDEX_YEAR} asc, dct_title_sort asc", :label => 'Year (Oldest first)'
277
- config.add_sort_field 'dct_title_sort asc', :label => 'Title (A-Z)'
278
- config.add_sort_field 'dct_title_sort desc', :label => 'Title (Z-A)'
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: 'more_details', if: proc { |_context, _config, options| options[:document] && (!options[:document].references.nil? & !options[:document].references.url.nil?)}
286
- 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? }
287
- 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? }
288
- config.add_show_tools_partial :exports, partial: 'exports', if: proc { |_context, _config, options| options[:document] }
289
- config.add_show_tools_partial :data_dictionary, partial: 'data_dictionary', if: proc { |_context, _config, options| options[:document] && options[:document].data_dictionary_download.present?}
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: 'access_links', if: proc { |_context, _config, options| options[:document] && options[:document].access_links.present?})
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: 'blacklight/nav/bookmark', if: false)
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 = 'format'
301
- config.show.partials << 'show_header'
302
- config.show.partials << 'show_default_viewer_container'
303
- config.show.partials << 'show_default_viewer_information'
304
- config.show.partials << 'show_default_attribute_table'
305
- config.show.partials << 'show'
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 = 'esri'
319
- config.max_per_page = 100000
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 = 'suggest'
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
- deprecated_response, @document = search_service.fetch(params[:id])
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, deprecated_document_list = search_service.fetch(params[:id])
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
- blacklight_config)
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, _ = search_service.search_results do |search_builder|
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
- blacklight_config)
380
+ blacklight_config)
361
381
  end
362
382
  end
363
383
  end