geoblacklight_admin 0.0.1 → 0.1.0

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 (146) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +27 -3
  3. data/Rakefile +30 -12
  4. data/app/assets/javascripts/geoblacklight_admin.js +1 -0
  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/controllers/admin/admin_controller.rb +4 -2
  8. data/app/controllers/admin/advanced_search_controller.rb +123 -103
  9. data/app/controllers/admin/api_controller.rb +123 -108
  10. data/app/controllers/admin/bookmarks_controller.rb +4 -4
  11. data/app/controllers/admin/bulk_actions_controller.rb +9 -4
  12. data/app/controllers/admin/concerns/upload_util.rb +2 -0
  13. data/app/controllers/admin/document_accesses_controller.rb +10 -4
  14. data/app/controllers/admin/document_assets_controller.rb +14 -11
  15. data/app/controllers/admin/document_downloads_controller.rb +12 -10
  16. data/app/controllers/admin/documents_controller.rb +16 -8
  17. data/app/controllers/admin/elements_controller.rb +6 -5
  18. data/app/controllers/admin/form_elements_controller.rb +4 -4
  19. data/app/controllers/admin/ids_controller.rb +107 -87
  20. data/app/controllers/admin/import_documents_controller.rb +1 -1
  21. data/app/controllers/admin/imports_controller.rb +7 -3
  22. data/app/controllers/admin/mappings_controller.rb +6 -4
  23. data/app/controllers/admin/notifications_controller.rb +1 -1
  24. data/app/controllers/admin/search_controller.rb +1 -1
  25. data/app/controllers/admin/users_controller.rb +1 -1
  26. data/app/helpers/form_input_helper.rb +4 -4
  27. data/app/helpers/geoblacklight_admin_helper.rb +1 -1
  28. data/app/jobs/export_job.rb +2 -1
  29. data/app/models/admin/bookmark.rb +18 -0
  30. data/app/models/api_search_builder.rb +3 -1
  31. data/app/models/document/bbox_validator.rb +9 -5
  32. data/app/models/document/date_range_validator.rb +13 -10
  33. data/app/models/document/geom_validator.rb +4 -2
  34. data/app/models/document.rb +15 -7
  35. data/app/models/element.rb +9 -7
  36. data/app/models/form_control.rb +2 -0
  37. data/app/models/form_element.rb +2 -0
  38. data/app/models/form_feature.rb +2 -0
  39. data/app/models/form_group.rb +2 -0
  40. data/app/models/form_header.rb +2 -0
  41. data/app/models/geoblacklight_admin/schema.rb +5 -2
  42. data/app/models/geoblacklight_admin.rb +2 -0
  43. data/app/models/import/csv_duplicates_validator.rb +2 -1
  44. data/app/models/import/csv_header_validator.rb +2 -1
  45. data/app/models/import.rb +4 -7
  46. data/app/models/user.rb +1 -1
  47. data/app/services/export_csv_service.rb +5 -1
  48. data/app/views/admin/advanced_search/facets.json.jbuilder +9 -8
  49. data/app/views/admin/advanced_search/index.json.jbuilder +8 -7
  50. data/app/views/admin/api/_field.json.jbuilder +1 -1
  51. data/app/views/admin/api/fetch.json.jbuilder +8 -7
  52. data/app/views/admin/api/index.json.jbuilder +8 -7
  53. data/app/views/admin/bookmarks/index.html.erb +2 -2
  54. data/app/views/admin/bulk_actions/index.html.erb +3 -3
  55. data/app/views/admin/bulk_actions/show.html.erb +1 -1
  56. data/app/views/admin/document_accesses/_form.html.erb +1 -1
  57. data/app/views/admin/document_accesses/destroy_all.html.erb +2 -2
  58. data/app/views/admin/document_accesses/edit.html.erb +1 -1
  59. data/app/views/admin/document_accesses/import.html.erb +2 -2
  60. data/app/views/admin/document_accesses/index.html.erb +9 -9
  61. data/app/views/admin/document_accesses/new.html.erb +1 -1
  62. data/app/views/admin/document_downloads/_form.html.erb +1 -1
  63. data/app/views/admin/document_downloads/destroy_all.html.erb +1 -1
  64. data/app/views/admin/document_downloads/edit.html.erb +2 -3
  65. data/app/views/admin/document_downloads/import.html.erb +1 -1
  66. data/app/views/admin/document_downloads/index.html.erb +9 -9
  67. data/app/views/admin/document_downloads/new.html.erb +1 -1
  68. data/app/views/admin/document_downloads/show.html.erb +2 -2
  69. data/app/views/admin/documents/_document_bookmark.html.erb +1 -1
  70. data/app/views/admin/documents/_form_nav.html.erb +1 -1
  71. data/app/views/admin/documents/_json_btaa_aardvark.jbuilder +1 -3
  72. data/app/views/admin/documents/edit.html.erb +1 -1
  73. data/app/views/admin/documents/features/_multiple_download_links.html.erb +2 -2
  74. data/app/views/admin/documents/index.html.erb +2 -4
  75. data/app/views/admin/documents/versions.html.erb +1 -1
  76. data/app/views/admin/elements/_element.json.jbuilder +4 -1
  77. data/app/views/admin/elements/_form.html.erb +1 -1
  78. data/app/views/admin/elements/edit.html.erb +2 -2
  79. data/app/views/admin/elements/index.html.erb +3 -3
  80. data/app/views/admin/elements/index.json.jbuilder +2 -0
  81. data/app/views/admin/elements/new.html.erb +1 -1
  82. data/app/views/admin/elements/show.html.erb +6 -6
  83. data/app/views/admin/elements/show.json.jbuilder +2 -0
  84. data/app/views/admin/form_elements/_form.html.erb +1 -1
  85. data/app/views/admin/form_elements/_form_element.json.jbuilder +2 -0
  86. data/app/views/admin/form_elements/edit.html.erb +2 -2
  87. data/app/views/admin/form_elements/index.html.erb +1 -1
  88. data/app/views/admin/form_elements/index.json.jbuilder +2 -0
  89. data/app/views/admin/form_elements/new.html.erb +1 -1
  90. data/app/views/admin/form_elements/show.html.erb +2 -2
  91. data/app/views/admin/form_elements/show.json.jbuilder +2 -0
  92. data/app/views/admin/ids/fetch.json.jbuilder +8 -7
  93. data/app/views/admin/ids/index.json.jbuilder +3 -2
  94. data/app/views/admin/import_documents/show.html.haml +1 -1
  95. data/app/views/admin/imports/_import.json.jbuilder +2 -1
  96. data/app/views/admin/imports/_show_failed_tab.html.erb +2 -2
  97. data/app/views/admin/imports/_show_success_tab.html.erb +1 -1
  98. data/app/views/admin/imports/edit.html.erb +3 -3
  99. data/app/views/admin/imports/index.html.erb +3 -3
  100. data/app/views/admin/layouts/application.html.erb +4 -4
  101. data/app/views/admin/mappings/_form.html.erb +1 -1
  102. data/app/views/admin/mappings/_mapping.json.jbuilder +2 -1
  103. data/app/views/admin/mappings/edit.html.erb +2 -2
  104. data/app/views/admin/mappings/new.html.erb +1 -1
  105. data/app/views/admin/mappings/show.html.erb +2 -2
  106. data/app/views/admin/notifications/index.html.erb +3 -3
  107. data/app/views/admin/search/index.html.erb +2 -2
  108. data/app/views/admin/shared/_navbar.html.erb +8 -3
  109. data/app/views/catalog/_show_gbl_admin.html.erb +3 -0
  110. data/config/routes.rb +37 -33
  111. data/db/migrate/20230316183001_add_geoblacklight_admin_gem.rb +408 -0
  112. data/db/seeds.rb +7 -5
  113. data/lib/generators/geoblacklight_admin/config_generator.rb +43 -31
  114. data/lib/generators/geoblacklight_admin/install_generator.rb +2 -3
  115. data/lib/generators/geoblacklight_admin/jobs_generator.rb +3 -2
  116. data/lib/generators/geoblacklight_admin/models_generator.rb +0 -1
  117. data/lib/generators/geoblacklight_admin/templates/_show_sidebar.html.erb +19 -0
  118. data/lib/generators/geoblacklight_admin/templates/_user_util_links.html.erb +1 -1
  119. data/lib/generators/geoblacklight_admin/templates/config/database.yml +9 -5
  120. data/lib/generators/geoblacklight_admin/templates/config/initializers/geoblacklight_admin.rb +1 -2
  121. data/lib/generators/geoblacklight_admin/templates/config/initializers/pagy.rb +150 -68
  122. data/lib/generators/geoblacklight_admin/templates/config/settings.yml +241 -0
  123. data/lib/generators/geoblacklight_admin/templates/package.json +1 -0
  124. data/lib/generators/geoblacklight_admin/views_generator.rb +0 -1
  125. data/lib/geoblacklight_admin/engine.rb +5 -6
  126. data/lib/geoblacklight_admin/version.rb +1 -1
  127. data/lib/geoblacklight_admin.rb +1 -1
  128. data/lib/tasks/geoblacklight_admin.rake +10 -6
  129. metadata +79 -48
  130. data/.editorconfig +0 -18
  131. data/.gitignore +0 -75
  132. data/.standard.yml +0 -4
  133. data/Gemfile +0 -59
  134. data/LICENSE +0 -21
  135. data/app/assets/images/.keep +0 -0
  136. data/app/controllers/admin/concerns/.keep +0 -0
  137. data/app/models/bookmark.rb +0 -17
  138. data/app/models/concerns/.keep +0 -0
  139. data/db/migrate/20230316183001_add_geoblacklight_admin.rb +0 -399
  140. data/geoblacklight_admin.gemspec +0 -67
  141. data/lib/generators/geoblacklight_admin/templates/.env.development.example +0 -28
  142. data/lib/generators/geoblacklight_admin/templates/.solr_wrapper.yml +0 -7
  143. data/lib/generators/geoblacklight_admin/templates/solr/snapshots/.keep +0 -0
  144. data/lib/tasks/.keep +0 -0
  145. data/spec/test_app_templates/lib/generators/test_app_generator.rb +0 -35
  146. data/template.rb +0 -16
@@ -39,7 +39,8 @@ module Admin
39
39
  respond_to do |format|
40
40
  if @document_download.save
41
41
  format.html do
42
- redirect_to document_document_downloads_path(@document_download.document), notice: "Document download was successfully created."
42
+ redirect_to admin_document_document_downloads_path(@document_download.document),
43
+ notice: "Document download was successfully created."
43
44
  end
44
45
  format.json { render :show, status: :created, location: @document_download }
45
46
  else
@@ -54,7 +55,8 @@ module Admin
54
55
  respond_to do |format|
55
56
  if @document_download.update(document_download_params)
56
57
  format.html do
57
- redirect_to document_document_downloads_path(@document_download.document), notice: "Document download was successfully updated."
58
+ redirect_to admin_document_document_downloads_path(@document_download.document),
59
+ notice: "Document download was successfully updated."
58
60
  end
59
61
  format.json { render :show, status: :ok, location: @document_download }
60
62
  else
@@ -69,7 +71,7 @@ module Admin
69
71
  @document_download.destroy
70
72
 
71
73
  respond_to do |format|
72
- format.html { redirect_to document_downloads_url, notice: "Document download was successfully destroyed." }
74
+ format.html { redirect_to admin_document_downloads_url, notice: "Document download was successfully destroyed." }
73
75
  format.json { head :no_content }
74
76
  end
75
77
  end
@@ -80,12 +82,12 @@ module Admin
80
82
 
81
83
  respond_to do |format|
82
84
  if DocumentDownload.destroy_all(params.dig(:document_download, :downloads, :file))
83
- format.html { redirect_to document_downloads_path, notice: "Download Links were created destroyed." }
85
+ format.html { redirect_to admin_document_downloads_path, notice: "Download Links were created destroyed." }
84
86
  else
85
- format.html { redirect_to document_downloads_path, notice: "Download Links could not be destroyed." }
87
+ format.html { redirect_to admin_document_downloads_path, notice: "Download Links could not be destroyed." }
86
88
  end
87
89
  rescue => e
88
- format.html { redirect_to document_downloads_path, notice: "Download Links could not be destroyed. #{e}" }
90
+ format.html { redirect_to admin_document_downloads_path, notice: "Download Links could not be destroyed. #{e}" }
89
91
  end
90
92
  end
91
93
 
@@ -97,12 +99,12 @@ module Admin
97
99
 
98
100
  respond_to do |format|
99
101
  if DocumentDownload.import(params.dig(:document_download, :downloads, :file))
100
- format.html { redirect_to document_downloads_path, notice: "Download Links were created successfully." }
102
+ format.html { redirect_to admin_document_downloads_path, notice: "Download Links were created successfully." }
101
103
  else
102
- format.html { redirect_to document_downloads_path, notice: "Download Links could not be created." }
104
+ format.html { redirect_to admin_document_downloads_path, notice: "Download Links could not be created." }
103
105
  end
104
106
  rescue => e
105
- format.html { redirect_to document_downloads_path, notice: "Download Links could not be created. #{e}" }
107
+ format.html { redirect_to admin_document_downloads_path, notice: "Download Links could not be created. #{e}" }
106
108
  end
107
109
  end
108
110
 
@@ -124,4 +126,4 @@ module Admin
124
126
  params.require(:document_download).permit(:friendlier_id, :label, :value, :position)
125
127
  end
126
128
  end
127
- end
129
+ end
@@ -26,7 +26,8 @@ module Admin
26
26
 
27
27
  # JSON - BTAA Aardvark
28
28
  format.json_btaa_aardvark do
29
- ExportJsonJob.perform_later(current_user, query_params.merge!({format: "json_btaa_aardvark"}), ExportJsonService)
29
+ ExportJsonJob.perform_later(current_user, query_params.merge!({format: "json_btaa_aardvark"}),
30
+ ExportJsonService)
30
31
  head :no_content
31
32
  end
32
33
 
@@ -79,31 +80,36 @@ module Admin
79
80
 
80
81
  # JSON - GBL Aardvark
81
82
  format.json_aardvark do
82
- ExportJsonJob.perform_later(current_user, {ids: @documents.pluck(:friendlier_id), format: "json_aardvark"}, ExportJsonService)
83
+ ExportJsonJob.perform_later(current_user, {ids: @documents.pluck(:friendlier_id), format: "json_aardvark"},
84
+ ExportJsonService)
83
85
  head :no_content
84
86
  end
85
87
 
86
88
  # JSON - GBL v1
87
89
  format.json_gbl_v1 do
88
- ExportJsonJob.perform_later(current_user, {ids: @documents.pluck(:friendlier_id), format: "json_gbl_v1"}, ExportJsonService)
90
+ ExportJsonJob.perform_later(current_user, {ids: @documents.pluck(:friendlier_id), format: "json_gbl_v1"},
91
+ ExportJsonService)
89
92
  head :no_content
90
93
  end
91
94
 
92
95
  # CSV - B1G
93
96
  format.csv do
94
- ExportJob.perform_later(current_user, {ids: @documents.pluck(:friendlier_id), format: "csv"}, ExportCsvService)
97
+ ExportJob.perform_later(current_user, {ids: @documents.pluck(:friendlier_id), format: "csv"},
98
+ ExportCsvService)
95
99
  head :no_content
96
100
  end
97
101
 
98
102
  # CSV Document Downloads - B1G
99
103
  format.csv_document_downloads do
100
- ExportJob.perform_later(current_user, {ids: @documents.pluck(:friendlier_id), format: "csv_document_downloads"}, ExportCsvDocumentDownloadsService)
104
+ ExportJob.perform_later(current_user,
105
+ {ids: @documents.pluck(:friendlier_id), format: "csv_document_downloads"}, ExportCsvDocumentDownloadsService)
101
106
  head :no_content
102
107
  end
103
108
 
104
109
  # CSV Document Downloads - B1G
105
110
  format.csv_document_access_links do
106
- ExportJob.perform_later(current_user, {ids: @documents.pluck(:friendlier_id), format: "csv_document_access_links"}, ExportCsvDocumentAccessLinksService)
111
+ ExportJob.perform_later(current_user,
112
+ {ids: @documents.pluck(:friendlier_id), format: "csv_document_access_links"}, ExportCsvDocumentAccessLinksService)
107
113
  head :no_content
108
114
  end
109
115
  end
@@ -158,7 +164,9 @@ module Admin
158
164
  def destroy
159
165
  @document.destroy
160
166
  respond_to do |format|
161
- format.html { redirect_to admin_documents_url, notice: "Document '#{@document.title}' was successfully destroyed." }
167
+ format.html do
168
+ redirect_to admin_documents_url, notice: "Document '#{@document.title}' was successfully destroyed."
169
+ end
162
170
  format.json { head :no_content }
163
171
  end
164
172
  end
@@ -216,4 +224,4 @@ module Admin
216
224
  end
217
225
  end
218
226
  end
219
- end
227
+ end
@@ -29,7 +29,7 @@ module Admin
29
29
 
30
30
  respond_to do |format|
31
31
  if @element.save
32
- format.html { redirect_to element_url(@element), notice: "Element was successfully created." }
32
+ format.html { redirect_to admin_element_url(@element), notice: "Element was successfully created." }
33
33
  format.json { render :show, status: :created, location: @element }
34
34
  else
35
35
  format.html { render :new, status: :unprocessable_entity }
@@ -42,7 +42,7 @@ module Admin
42
42
  def update
43
43
  respond_to do |format|
44
44
  if @element.update(element_params)
45
- format.html { redirect_to element_url(@element), notice: "Element was successfully updated." }
45
+ format.html { redirect_to admin_element_url(@element), notice: "Element was successfully updated." }
46
46
  format.json { render :show, status: :ok, location: @element }
47
47
  else
48
48
  format.html { render :edit, status: :unprocessable_entity }
@@ -56,7 +56,7 @@ module Admin
56
56
  @element.destroy
57
57
 
58
58
  respond_to do |format|
59
- format.html { redirect_to elements_url, notice: "Element was successfully destroyed." }
59
+ format.html { redirect_to admin_elements_url, notice: "Element was successfully destroyed." }
60
60
  format.json { head :no_content }
61
61
  end
62
62
  end
@@ -75,7 +75,8 @@ module Admin
75
75
 
76
76
  # Only allow a list of trusted parameters through.
77
77
  def element_params
78
- params.require(:element).permit(:label, :solr_field, :field_definition, :field_type, :required, :repeatable, :formable, :placeholder_text, :data_entry_hint, :test_fixture_example, :controlled_vocabulary, :js_behaviors, :html_attributes, :display_only_on_persisted, :importable, :import_deliminated, :import_transformation_method, :exportable, :export_transformation_method, :indexable, :index_transformation_method, :validation_method, :position)
78
+ params.require(:element).permit(:label, :solr_field, :field_definition, :field_type, :required, :repeatable,
79
+ :formable, :placeholder_text, :data_entry_hint, :test_fixture_example, :controlled_vocabulary, :js_behaviors, :html_attributes, :display_only_on_persisted, :importable, :import_deliminated, :import_transformation_method, :exportable, :export_transformation_method, :indexable, :index_transformation_method, :validation_method, :position)
79
80
  end
80
81
  end
81
- end
82
+ end
@@ -29,7 +29,7 @@ module Admin
29
29
 
30
30
  respond_to do |format|
31
31
  if @form_element.save
32
- format.html { redirect_to form_elements_path, notice: "Form element was successfully created." }
32
+ format.html { redirect_to admin_form_elements_path, notice: "Form element was successfully created." }
33
33
  format.json { render :show, status: :created, location: @form_element }
34
34
  else
35
35
  format.html { render :new, status: :unprocessable_entity }
@@ -42,7 +42,7 @@ module Admin
42
42
  def update
43
43
  respond_to do |format|
44
44
  if @form_element.update(form_element_params)
45
- format.html { redirect_to form_element_url(@form_element), notice: "Form element was successfully updated." }
45
+ format.html { redirect_to admin_form_element_url(@form_element), notice: "Form element was successfully updated." }
46
46
  format.json { render :show, status: :ok, location: @form_element }
47
47
  else
48
48
  format.html { render :edit, status: :unprocessable_entity }
@@ -56,7 +56,7 @@ module Admin
56
56
  @form_element.destroy
57
57
 
58
58
  respond_to do |format|
59
- format.html { redirect_to form_elements_url, notice: "Form element was successfully destroyed." }
59
+ format.html { redirect_to admin_form_elements_url, notice: "Form element was successfully destroyed." }
60
60
  format.json { head :no_content }
61
61
  end
62
62
  end
@@ -78,4 +78,4 @@ module Admin
78
78
  params.require(:form_element).permit(:type, :label, :element_solr_field)
79
79
  end
80
80
  end
81
- end
81
+ end
@@ -1,7 +1,7 @@
1
- # -*- encoding : utf-8 -*-
2
1
  # frozen_string_literal: true
3
2
 
4
- require 'blacklight/catalog'
3
+ require "blacklight/catalog"
4
+ require "blacklight_range_limit/controller_override"
5
5
 
6
6
  # Admin::IdsController
7
7
  module Admin
@@ -10,6 +10,9 @@ module Admin
10
10
  include BlacklightRangeLimit::ControllerOverride
11
11
  include Blacklight::Catalog
12
12
 
13
+ # No need to auth, only queries Solr
14
+ skip_before_action :authenticate_admin!
15
+
13
16
  configure_blacklight do |config|
14
17
  # special search builder / fails
15
18
  config.search_builder_class = ApiSearchBuilder
@@ -18,42 +21,44 @@ module Admin
18
21
  config.advanced_search ||= Blacklight::OpenStructWithHashAccess.new
19
22
 
20
23
  # Blacklight update to 7.0.0
21
- config.add_results_document_tool(:bookmark, partial: 'bookmark_control', if: :render_bookmarks_control?)
24
+ config.add_results_document_tool(:bookmark, partial: "bookmark_control", if: :render_bookmarks_control?)
22
25
 
23
26
  config.add_results_collection_tool(:sort_widget)
24
27
  config.add_results_collection_tool(:per_page_widget)
25
28
  config.add_results_collection_tool(:view_type_group)
26
29
 
27
- config.add_show_tools_partial(:bookmark, partial: 'bookmark_control', if: :render_bookmarks_control?)
30
+ config.add_show_tools_partial(:bookmark, partial: "bookmark_control", if: :render_bookmarks_control?)
28
31
  config.add_show_tools_partial(:email, callback: :email_action, validator: :validate_email_params)
29
- config.add_show_tools_partial(:sms, if: :render_sms_action?, callback: :sms_action, validator: :validate_sms_params)
32
+ config.add_show_tools_partial(:sms, if: :render_sms_action?, callback: :sms_action,
33
+ validator: :validate_sms_params)
30
34
 
31
- config.add_nav_action(:bookmark, partial: 'blacklight/nav/bookmark', if: :render_bookmarks_control?)
35
+ config.add_nav_action(:bookmark, partial: "blacklight/nav/bookmark", if: :render_bookmarks_control?)
32
36
  # Blacklight update to 7.0.0
33
37
 
34
38
  # Advanced config values
35
39
  config.advanced_search ||= Blacklight::OpenStructWithHashAccess.new
36
- config.advanced_search[:url_key] ||= 'advanced'
37
- config.advanced_search[:query_parser] ||= 'edismax'
40
+ config.advanced_search[:url_key] ||= "advanced"
41
+ config.advanced_search[:query_parser] ||= "edismax"
38
42
  config.advanced_search[:form_solr_parameters] ||= {}
39
- 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]
40
- config.advanced_search[:form_solr_parameters]['facet.query'] ||= ''
41
- config.advanced_search[:form_solr_parameters]['facet.limit'] ||= -1
42
- config.advanced_search[:form_solr_parameters]['facet.sort'] ||= 'index'
43
+ config.advanced_search[:form_solr_parameters]["facet.field"] ||= [Settings.FIELDS.PROVIDER,
44
+ 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]
45
+ config.advanced_search[:form_solr_parameters]["facet.query"] ||= ""
46
+ config.advanced_search[:form_solr_parameters]["facet.limit"] ||= -1
47
+ config.advanced_search[:form_solr_parameters]["facet.sort"] ||= "index"
43
48
 
44
49
  # Map views
45
50
  config.view.mapview.partials = [:index]
46
- config.view['split'].title = "List view"
47
- config.view['mapview'].title = "Map view"
51
+ config.view["split"].title = "List view"
52
+ config.view["mapview"].title = "Map view"
48
53
 
49
54
  config.raw_endpoint.enabled = true
50
55
 
51
56
  ## Default parameters to send to solr for all search-like requests. See also SolrHelper#solr_search_params
52
57
  config.default_solr_params = {
53
58
  :start => 0,
54
- 'q.alt' => '*:*',
55
- 'bf' => ["if(exists(#{Settings.FIELDS.B1G_CHILD_RECORD}),0,100)^0.5"],
56
- 'admin.api' => true
59
+ "q.alt" => "*:*",
60
+ "bf" => ["if(exists(#{Settings.FIELDS.B1G_CHILD_RECORD}),0,100)^0.5"],
61
+ "admin.api" => true
57
62
  }
58
63
 
59
64
  config.default_per_page = 1000 # Works!
@@ -62,8 +67,8 @@ module Admin
62
67
  ## parameters included in the Blacklight-jetty document requestHandler.
63
68
  #
64
69
  config.default_document_solr_params = {
65
- :qt => 'document',
66
- :q => "{!raw f=#{Settings.FIELDS.B1G_GEOMG_ID} v=$id}"
70
+ qt: "document",
71
+ q: "{!raw f=#{Settings.FIELDS.B1G_GEOMG_ID} v=$id}"
67
72
  }
68
73
 
69
74
  # config.search_builder_class = Geoblacklight::SearchBuilder
@@ -77,7 +82,7 @@ module Admin
77
82
 
78
83
  # solr field configuration for document/show views
79
84
 
80
- config.show.display_type_field = 'format'
85
+ config.show.display_type_field = "format"
81
86
 
82
87
  # Custom GeoBlacklight fields which currently map to GeoBlacklight-Schema
83
88
  # v0.3.2
@@ -115,16 +120,22 @@ module Admin
115
120
  ## FACETS
116
121
  #
117
122
  # Date Range Filter
118
- config.add_facet_field 'date_created_drsim', :label => 'Date Created', :show => false
123
+ # config.add_facet_field "date_created_drsim", label: "Date Created", show: false
119
124
 
120
125
  # Date Created
121
- config.add_facet_field 'time_period', label: 'Date Created', query: {
122
- 'today' => { label: 'Today', fq: "date_created_drsim:[#{Date.today.beginning_of_day.to_time.strftime('%Y-%m-%dT%H:%M:%S')} TO #{Date.today.end_of_day.to_time.strftime('%Y-%m-%dT%H:%M:%S')}]"},
123
- 'this_week' => { label: 'This week', fq: "date_created_drsim:[#{(Date.today.end_of_day - 1.week).to_time.strftime('%Y-%m-%dT%H:%M:%S')} TO #{Date.today.end_of_day.to_time.strftime('%Y-%m-%dT%H:%M:%S')}]"},
124
- 'this_month' => { label: 'This month', fq: "date_created_drsim:[#{(Date.today.end_of_day - 1.month).to_time.strftime('%Y-%m-%dT%H:%M:%S')} TO #{Date.today.end_of_day.to_time.strftime('%Y-%m-%dT%H:%M:%S')}]"},
125
- 'last_month' => { label: 'Last month', fq: "date_created_drsim:[#{(Date.today.end_of_day - 2.months).to_time.strftime('%Y-%m-%dT%H:%M:%S')} TO #{(Date.today.end_of_day - 1.month).to_time.strftime('%Y-%m-%dT%H:%M:%S')}]"},
126
- 'this_quarter' => { label: 'This quarter', fq: "date_created_drsim:[#{(Date.today.end_of_day - 3.months).to_time.strftime('%Y-%m-%dT%H:%M:%S')} TO #{(Date.today.end_of_day).to_time.strftime('%Y-%m-%dT%H:%M:%S')}]"},
127
- 'this_year' => { label: 'This year', fq: "date_created_drsim:[#{(Date.today.end_of_day - 1.year).to_time.strftime('%Y-%m-%dT%H:%M:%S')} TO #{(Date.today.end_of_day).to_time.strftime('%Y-%m-%dT%H:%M:%S')}]"}
126
+ config.add_facet_field "time_period", label: "Date Created", query: {
127
+ "today" => {label: "Today",
128
+ fq: "date_created_drsim:[#{Date.today.beginning_of_day.to_time.strftime("%Y-%m-%dT%H:%M:%S")} TO #{Date.today.end_of_day.to_time.strftime("%Y-%m-%dT%H:%M:%S")}]"},
129
+ "this_week" => {label: "This week",
130
+ fq: "date_created_drsim:[#{(Date.today.end_of_day - 1.week).to_time.strftime("%Y-%m-%dT%H:%M:%S")} TO #{Date.today.end_of_day.to_time.strftime("%Y-%m-%dT%H:%M:%S")}]"},
131
+ "this_month" => {label: "This month",
132
+ fq: "date_created_drsim:[#{(Date.today.end_of_day - 1.month).to_time.strftime("%Y-%m-%dT%H:%M:%S")} TO #{Date.today.end_of_day.to_time.strftime("%Y-%m-%dT%H:%M:%S")}]"},
133
+ "last_month" => {label: "Last month",
134
+ fq: "date_created_drsim:[#{(Date.today.end_of_day - 2.months).to_time.strftime("%Y-%m-%dT%H:%M:%S")} TO #{(Date.today.end_of_day - 1.month).to_time.strftime("%Y-%m-%dT%H:%M:%S")}]"},
135
+ "this_quarter" => {label: "This quarter",
136
+ fq: "date_created_drsim:[#{(Date.today.end_of_day - 3.months).to_time.strftime("%Y-%m-%dT%H:%M:%S")} TO #{Date.today.end_of_day.to_time.strftime("%Y-%m-%dT%H:%M:%S")}]"},
137
+ "this_year" => {label: "This year",
138
+ fq: "date_created_drsim:[#{(Date.today.end_of_day - 1.year).to_time.strftime("%Y-%m-%dT%H:%M:%S")} TO #{Date.today.end_of_day.to_time.strftime("%Y-%m-%dT%H:%M:%S")}]"}
128
139
  }
129
140
 
130
141
  # Publication State
@@ -145,34 +156,34 @@ module Admin
145
156
  # ADVANCED SEARCH
146
157
  #
147
158
  # Code
148
- config.add_facet_field Settings.FIELDS.B1G_CODE, label: 'Code', limit: 1000
159
+ config.add_facet_field Settings.FIELDS.B1G_CODE, label: "Code", limit: 1000
149
160
 
150
161
  # Is Part Of
151
- config.add_facet_field Settings.FIELDS.IS_PART_OF, label: 'Is Part Of', limit: 1000
162
+ config.add_facet_field Settings.FIELDS.IS_PART_OF, label: "Is Part Of", limit: 1000
152
163
 
153
164
  # Member Of
154
- config.add_facet_field Settings.FIELDS.MEMBER_OF, label: 'Member Of', limit: 1000
165
+ config.add_facet_field Settings.FIELDS.MEMBER_OF, label: "Member Of", limit: 1000
155
166
 
156
167
  # Resource Type
157
- config.add_facet_field Settings.FIELDS.RESOURCE_TYPE, label: 'Resource Type', limit: 1000
168
+ config.add_facet_field Settings.FIELDS.RESOURCE_TYPE, label: "Resource Type", limit: 1000
158
169
 
159
170
  # Subject
160
- config.add_facet_field Settings.FIELDS.SUBJECT, label: 'Subject', limit: 1000
171
+ config.add_facet_field Settings.FIELDS.SUBJECT, label: "Subject", limit: 1000
161
172
 
162
173
  # Theme
163
- config.add_facet_field Settings.FIELDS.THEME, label: 'Theme', limit: 1000
174
+ config.add_facet_field Settings.FIELDS.THEME, label: "Theme", limit: 1000
164
175
 
165
176
  # Format
166
- config.add_facet_field Settings.FIELDS.FORMAT, label: 'Format', limit: 1000
177
+ config.add_facet_field Settings.FIELDS.FORMAT, label: "Format", limit: 1000
167
178
 
168
179
  # Suppressed
169
- config.add_facet_field Settings.FIELDS.SUPPRESSED, label: 'Suppressed'
180
+ config.add_facet_field Settings.FIELDS.SUPPRESSED, label: "Suppressed"
170
181
 
171
182
  # Child Record
172
- config.add_facet_field Settings.FIELDS.B1G_CHILD_RECORD, label: 'Child Record'
183
+ config.add_facet_field Settings.FIELDS.B1G_CHILD_RECORD, label: "Child Record"
173
184
 
174
185
  # Georeferenced
175
- config.add_facet_field Settings.FIELDS.GEOREFERENCED, label: 'Georeferenced'
186
+ config.add_facet_field Settings.FIELDS.GEOREFERENCED, label: "Georeferenced"
176
187
 
177
188
  # Have BL send all facet field names to Solr, which has been the default
178
189
  # previously. Simply remove these lines if you'd rather use Solr request
@@ -238,48 +249,48 @@ module Admin
238
249
  # solr request handler? The one set in config[:default_solr_parameters][:qt],
239
250
  # since we aren't specifying it otherwise.
240
251
 
241
- config.add_search_field('all_fields') do |field|
252
+ config.add_search_field("all_fields") do |field|
242
253
  field.include_in_advanced_search = false
243
- field.label = 'All Fields'
254
+ field.label = "All Fields"
244
255
  end
245
256
 
246
- config.add_search_field('keyword') do |field|
257
+ config.add_search_field("keyword") do |field|
247
258
  field.include_in_simple_select = false
248
- field.qt = 'search'
249
- field.label = 'Keyword'
259
+ field.qt = "search"
260
+ field.label = "Keyword"
250
261
  field.solr_local_parameters = {
251
- qf: '$qf',
252
- pf: '$pf'
262
+ qf: "$qf",
263
+ pf: "$pf"
253
264
  }
254
265
  end
255
266
 
256
- config.add_search_field('title') do |field|
267
+ config.add_search_field("title") do |field|
257
268
  field.include_in_simple_select = false
258
- field.qt = 'search'
259
- field.label = 'Title'
269
+ field.qt = "search"
270
+ field.label = "Title"
260
271
  field.solr_local_parameters = {
261
- qf: '$title_qf',
262
- pf: '$title_pf'
272
+ qf: "$title_qf",
273
+ pf: "$title_pf"
263
274
  }
264
275
  end
265
276
 
266
- config.add_search_field('placename') do |field|
277
+ config.add_search_field("placename") do |field|
267
278
  field.include_in_simple_select = false
268
- field.qt = 'search'
269
- field.label = 'Place'
279
+ field.qt = "search"
280
+ field.label = "Place"
270
281
  field.solr_local_parameters = {
271
- qf: '$placename_qf',
272
- pf: '$placename_pf'
282
+ qf: "$placename_qf",
283
+ pf: "$placename_pf"
273
284
  }
274
285
  end
275
286
 
276
- config.add_search_field('publisher') do |field|
287
+ config.add_search_field("publisher") do |field|
277
288
  field.include_in_simple_select = false
278
- field.qt = 'search'
279
- field.label = 'Publisher/Creator'
289
+ field.qt = "search"
290
+ field.label = "Publisher/Creator"
280
291
  field.solr_local_parameters = {
281
- qf: '$publisher_qf',
282
- pf: '$publisher_pf'
292
+ qf: "$publisher_qf",
293
+ pf: "$publisher_pf"
283
294
  }
284
295
  end
285
296
 
@@ -287,37 +298,48 @@ module Admin
287
298
  # label in pulldown is followed by the name of the SOLR field to sort by and
288
299
  # whether the sort is ascending or descending (it must be asc or desc
289
300
  # except in the relevancy case).
290
- config.add_sort_field 'score desc, dct_title_sort asc', :label => 'relevance'
291
- config.add_sort_field "#{Settings.FIELDS.INDEX_YEAR} desc, dct_title_sort asc", :label => 'year'
292
- config.add_sort_field 'dct_title_sort asc', :label => 'title'
301
+ config.add_sort_field "score desc, dct_title_sort asc", label: "relevance"
302
+ config.add_sort_field "#{Settings.FIELDS.INDEX_YEAR} desc, dct_title_sort asc", label: "year"
303
+ config.add_sort_field "dct_title_sort asc", label: "title"
293
304
 
294
305
  # If there are more than this many search results, no spelling ("did you
295
306
  # mean") suggestion is offered.
296
307
  config.spell_max = 5
297
308
 
298
309
  # Custom tools for GeoBlacklight
299
- 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?)}
300
- 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? }
301
- 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? }
302
- config.add_show_tools_partial :exports, partial: 'exports', if: proc { |_context, _config, options| options[:document] }
303
- config.add_show_tools_partial :data_dictionary, partial: 'data_dictionary', if: proc { |_context, _config, options| options[:document] && options[:document].data_dictionary_download.present?}
310
+ config.add_show_tools_partial :more_details, partial: "more_details", if: proc { |_context, _config, options|
311
+ options[:document] && (!options[:document].references.nil? & !options[:document].references.url.nil?)
312
+ }
313
+ config.add_show_tools_partial :metadata, if: proc { |_context, _config, options|
314
+ options[:document] && (Settings.METADATA_SHOWN & options[:document].references.refs.map(&:type).map(&:to_s)).any?
315
+ }
316
+ config.add_show_tools_partial :web_services, if: proc { |_context, _config, options|
317
+ options[:document] && (Settings.WEBSERVICES_SHOWN & options[:document].references.refs.map(&:type).map(&:to_s)).any?
318
+ }
319
+ config.add_show_tools_partial :exports, partial: "exports", if: proc { |_context, _config, options|
320
+ options[:document]
321
+ }
322
+ config.add_show_tools_partial :data_dictionary, partial: "data_dictionary", if: proc { |_context, _config, options|
323
+ options[:document] && options[:document].data_dictionary_download.present?
324
+ }
304
325
  config.add_show_tools_partial(:citation)
305
- config.add_show_tools_partial(:access_links, partial: 'access_links', if: proc { |_context, _config, options| options[:document] && options[:document].access_links.present?})
326
+ config.add_show_tools_partial(:access_links, partial: "access_links", if: proc { |_context, _config, options|
327
+ options[:document] && options[:document].access_links.present?
328
+ })
306
329
 
307
330
  # Remove nav actions
308
- config.add_nav_action(:bookmark, partial: 'blacklight/nav/bookmark', if: false)
331
+ config.add_nav_action(:bookmark, partial: "blacklight/nav/bookmark", if: false)
309
332
 
310
333
  # Remove show tools
311
334
  config.show.partials.delete(:show_header)
312
335
  config.show.partials.delete(:show)
313
336
 
314
- config.show.display_type_field = 'format'
315
- config.show.partials << 'show_header'
316
- config.show.partials << 'show_default_viewer_container'
317
- config.show.partials << 'show_default_viewer_information'
318
- config.show.partials << 'show_default_attribute_table'
319
- config.show.partials << 'show'
320
-
337
+ config.show.display_type_field = "format"
338
+ config.show.partials << "show_header"
339
+ config.show.partials << "show_default_viewer_container"
340
+ config.show.partials << "show_default_viewer_information"
341
+ config.show.partials << "show_default_attribute_table"
342
+ config.show.partials << "show"
321
343
 
322
344
  config.show.document_actions.delete(:email)
323
345
  config.show.document_actions.delete(:bookmark)
@@ -329,30 +351,30 @@ module Admin
329
351
  # 'mapquest' http://developer.mapquest.com/web/products/open/map
330
352
  # 'positron' http://cartodb.com/basemaps/
331
353
  # 'darkMatter' http://cartodb.com/basemaps/
332
- config.basemap_provider = 'esri'
333
- config.max_per_page = 100000
354
+ config.basemap_provider = "esri"
355
+ config.max_per_page = 100_000
334
356
 
335
357
  # Configuration for autocomplete suggestor
336
358
  config.autocomplete_enabled = true
337
- config.autocomplete_path = 'suggest'
359
+ config.autocomplete_path = "suggest"
338
360
  end
339
361
 
340
362
  # Administrative view of document
341
363
  # - Sidecar Image
342
364
  # - URIs
343
365
  def admin
344
- deprecated_response, @document = search_service.fetch(params[:id])
366
+ _, @document = search_service.fetch(params[:id])
345
367
  end
346
368
 
347
369
  # Administrative view for array of document ids
348
370
  # - bookmarks
349
371
  def fetch
350
- @response, deprecated_document_list = search_service.fetch(params[:id])
372
+ @response, = search_service.fetch(params[:id])
351
373
 
352
374
  respond_to do |format|
353
375
  format.json do
354
376
  @presenter = Blacklight::JsonPresenter.new(@response,
355
- blacklight_config)
377
+ blacklight_config)
356
378
  end
357
379
  end
358
380
  end
@@ -362,16 +384,14 @@ module Admin
362
384
  # We want to find the facets available for the current search, but:
363
385
  # * IGNORING current query (add in facets_for_advanced_search_form filter)
364
386
  # * IGNORING current advanced search facets (remove add_advanced_search_to_solr filter)
365
- @response, _ = search_service.search_results do |search_builder|
387
+ @response, = search_service.search_results do |search_builder|
366
388
  search_builder.except(:add_advanced_search_to_solr).append(:facets_for_advanced_search_form)
367
389
  end
368
390
 
369
- @response
370
-
371
391
  respond_to do |format|
372
392
  format.json do
373
393
  @presenter = Blacklight::JsonPresenter.new(@response,
374
- blacklight_config)
394
+ blacklight_config)
375
395
  end
376
396
  end
377
397
  end
@@ -15,4 +15,4 @@ module Admin
15
15
  @import_document = ImportDocument.find(params[:id])
16
16
  end
17
17
  end
18
- end
18
+ end
@@ -34,7 +34,10 @@ module Admin
34
34
 
35
35
  respond_to do |format|
36
36
  if @import.save
37
- format.html { redirect_to admin_import_mappings_path(@import), notice: "Import was successful. Please set your import mapping rules." }
37
+ format.html do
38
+ redirect_to admin_import_mappings_path(@import),
39
+ notice: "Import was successful. Please set your import mapping rules."
40
+ end
38
41
  format.json { render :show, status: :created, location: @import }
39
42
  else
40
43
  format.html { render :new }
@@ -82,7 +85,8 @@ module Admin
82
85
  # Never trust parameters from the scary internet, only allow the white list through.
83
86
 
84
87
  def permittable_params
85
- %i[type name filename source description row_count encoding content_type extension validity validation_result csv_file run]
88
+ %i[type name filename source description row_count encoding content_type extension validity validation_result
89
+ csv_file run]
86
90
  end
87
91
 
88
92
  def import_params
@@ -102,4 +106,4 @@ module Admin
102
106
  )
103
107
  end
104
108
  end
105
- end
109
+ end
@@ -37,7 +37,9 @@ module Admin
37
37
 
38
38
  respond_to do |format|
39
39
  if @mapping.save
40
- format.html { redirect_to import_mapping_path(@import, @mapping), notice: "Mapping was successfully created." }
40
+ format.html do
41
+ redirect_to admin_import_mapping_path(@import, @mapping), notice: "Mapping was successfully created."
42
+ end
41
43
  format.json { render :show, status: :created, location: @mapping }
42
44
  else
43
45
  format.html { render :new }
@@ -51,7 +53,7 @@ module Admin
51
53
  def update
52
54
  respond_to do |format|
53
55
  if @mapping.update(mapping_params)
54
- format.html { redirect_to import_mappings_path(@mapping.import), notice: "Mapping was successfully updated." }
56
+ format.html { redirect_to admin_import_mappings_path(@mapping.import), notice: "Mapping was successfully updated." }
55
57
  format.json { render :show, status: :ok, location: @mapping }
56
58
  else
57
59
  format.html { render :edit }
@@ -65,7 +67,7 @@ module Admin
65
67
  def destroy
66
68
  @mapping.destroy
67
69
  respond_to do |format|
68
- format.html { redirect_to import_mappings_url(@import), notice: "Mapping was successfully destroyed." }
70
+ format.html { redirect_to admin_import_mappings_url(@import), notice: "Mapping was successfully destroyed." }
69
71
  format.json { head :no_content }
70
72
  end
71
73
  end
@@ -92,4 +94,4 @@ module Admin
92
94
  )
93
95
  end
94
96
  end
95
- end
97
+ end