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
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class FormControl < FormElement
2
4
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class FormElement < ApplicationRecord
2
4
  belongs_to :element, optional: true
3
5
 
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class FormFeature < FormElement
2
4
  end
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class FormGroup < FormElement
2
4
  end
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class FormHeader < FormElement
2
4
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "singleton"
2
4
 
3
5
  module GeoblacklightAdmin
@@ -11,12 +13,12 @@ module GeoblacklightAdmin
11
13
  end
12
14
 
13
15
  def solr_fields
14
- elements.map { |elm|
16
+ elements.map do |elm|
15
17
  [
16
18
  elm.label.parameterize(separator: "_").to_sym,
17
19
  elm.solr_field
18
20
  ]
19
- }.to_h
21
+ end.to_h
20
22
  end
21
23
 
22
24
  def importable_fields
@@ -40,6 +42,7 @@ module GeoblacklightAdmin
40
42
  Element.exportable.order(:position).each do |elm|
41
43
  # Skip References
42
44
  next if elm.solr_field == "dct_references_s"
45
+
43
46
  @fields[elm.label.to_sym] = {
44
47
  destination: elm.solr_field,
45
48
  delimited: elm.repeatable,
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module GeoblacklightAdmin
2
4
  include GeoblacklightAdmin::IsoLanguageCodes
3
5
  end
@@ -15,7 +15,8 @@ class Import
15
15
  duplicate_id = validate_csv_file(record.csv_file)
16
16
  unless duplicate_id.nil?
17
17
  valid_csv_file = false
18
- record.errors.add(:csv_file, "Duplicate ID value found: #{duplicate_id}. Please clean up the CSV file and reimport.")
18
+ record.errors.add(:csv_file,
19
+ "Duplicate ID value found: #{duplicate_id}. Please clean up the CSV file and reimport.")
19
20
  end
20
21
 
21
22
  valid_csv_file
@@ -10,7 +10,8 @@ class Import
10
10
  valid_csv_header = true
11
11
  unless valid_csv_headers?(record.csv_file)
12
12
  valid_csv_header = false
13
- record.errors.add(:csv_file, "Missing a required CSV header. Title, Resource Class, Access Rights, and ID are required.")
13
+ record.errors.add(:csv_file,
14
+ "Missing a required CSV header. Title, Resource Class, Access Rights, and ID are required.")
14
15
  end
15
16
 
16
17
  valid_csv_header
data/app/models/import.rb CHANGED
@@ -94,9 +94,7 @@ class Import < ApplicationRecord
94
94
  # logger.debug("Mapping: #{mapping.source_header} to #{mapping.destination_field}")
95
95
 
96
96
  # Handle discards
97
- if mapping.destination_field == "Discard"
98
- next
99
- end
97
+ next if mapping.destination_field == "Discard"
100
98
 
101
99
  # Handle repeatable dct_references_s entries
102
100
  if mapping.destination_field == "dct_references_s"
@@ -118,7 +116,8 @@ class Import < ApplicationRecord
118
116
 
119
117
  # Split delimited field values, if field has a value present
120
118
  if mapping.delimited?
121
- transformed_data[mapping.destination_field] = transformed_data[mapping.destination_field].present? ? transformed_data[mapping.destination_field].split(klass_delimiter) : ""
119
+ transformed_data[mapping.destination_field] =
120
+ transformed_data[mapping.destination_field].present? ? transformed_data[mapping.destination_field].split(klass_delimiter) : ""
122
121
  end
123
122
  end
124
123
 
@@ -175,9 +174,7 @@ class Import < ApplicationRecord
175
174
  required_mapping = {}
176
175
  required_mapping[key] = value
177
176
 
178
- unless data_hash.has_key?(key)
179
- data_hash.merge!(required_mapping.stringify_keys)
180
- end
177
+ data_hash.merge!(required_mapping.stringify_keys) unless data_hash.key?(key)
181
178
  end
182
179
  end
183
180
 
data/app/models/user.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  # User
4
4
  class User < ApplicationRecord
5
5
  include Blacklight::User
6
-
6
+
7
7
  # Include default devise modules. Others available are:
8
8
  # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
9
9
  devise :invitable, :database_authenticatable,
@@ -20,7 +20,11 @@ class ExportCsvService
20
20
  Rails.logger.debug { "\n\nExportCsvService: #{document_ids.inspect}\n\n" }
21
21
 
22
22
  CSV.generate(headers: true) do |_csv|
23
- Rails.logger.debug { "\n\n CSV Fields: #{GeoblacklightAdmin::Schema.instance.exportable_fields.map { |k, _v| k.to_s }} \n\n" }
23
+ Rails.logger.debug do
24
+ "\n\n CSV Fields: #{GeoblacklightAdmin::Schema.instance.exportable_fields.map do |k, _v|
25
+ k.to_s
26
+ end} \n\n"
27
+ end
24
28
 
25
29
  csv_file << GeoblacklightAdmin::Schema.instance.exportable_fields.map { |k, _v| k.to_s }
26
30
  document_ids.each_slice(slice_count) do |slice|
@@ -9,10 +9,10 @@ json.data do
9
9
  doc_presenter = index_presenter(document)
10
10
 
11
11
  doc_presenter.fields_to_render.each do |field_name, field|
12
- json.partial! 'field', field: field,
13
- field_name: field_name,
14
- document_url: document_url,
15
- doc_presenter: doc_presenter
12
+ json.partial! "field", field: field,
13
+ field_name: field_name,
14
+ document_url: document_url,
15
+ doc_presenter: doc_presenter
16
16
  end
17
17
  end
18
18
 
@@ -24,7 +24,7 @@ end
24
24
 
25
25
  json.included do
26
26
  json.array! @presenter.search_facets do |facet|
27
- json.type 'facet'
27
+ json.type "facet"
28
28
  json.id facet.name
29
29
  json.attributes do
30
30
  facet_config = facet_configuration_for_field(facet.name)
@@ -41,7 +41,8 @@ json.included do
41
41
  Deprecation.silence(Blacklight::FacetsHelperBehavior) do
42
42
  if facet_in_params?(facet.name, item.value)
43
43
  Deprecation.silence(Blacklight::SearchState) do
44
- json.remove admin_advanced_search_action_path(search_state.remove_facet_params(facet.name, item.value))
44
+ json.remove admin_advanced_search_action_path(search_state.remove_facet_params(facet.name,
45
+ item.value))
45
46
  end
46
47
  else
47
48
  json.self path_for_facet(facet.name, item.value, only_path: false)
@@ -57,7 +58,7 @@ json.included do
57
58
  end
58
59
 
59
60
  json.array! search_fields do |(label, key)|
60
- json.type 'search_field'
61
+ json.type "search_field"
61
62
  json.id key
62
63
  json.attributes do
63
64
  json.label label
@@ -68,7 +69,7 @@ json.included do
68
69
  end
69
70
 
70
71
  json.array! active_sort_fields do |key, field|
71
- json.type 'sort'
72
+ json.type "sort"
72
73
  json.id key
73
74
  json.attributes do
74
75
  json.label field.label
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  json.links do
3
4
  json.self url_for(search_state.to_h.merge(only_path: false))
4
5
  json.prev url_for(search_state.to_h.merge(only_path: false, page: @response.prev_page.to_s)) if @response.prev_page
@@ -19,10 +20,10 @@ json.data do
19
20
  doc_presenter = document_presenter(document)
20
21
 
21
22
  doc_presenter.fields_to_render.each do |field_name, field|
22
- json.partial! 'field', field: field,
23
- field_name: field_name,
24
- document_url: document_url,
25
- doc_presenter: doc_presenter
23
+ json.partial! "field", field: field,
24
+ field_name: field_name,
25
+ document_url: document_url,
26
+ doc_presenter: doc_presenter
26
27
  end
27
28
  end
28
29
 
@@ -34,7 +35,7 @@ end
34
35
 
35
36
  json.included do
36
37
  json.array! @presenter.search_facets do |facet|
37
- json.type 'facet'
38
+ json.type "facet"
38
39
  json.id facet.name
39
40
  json.attributes do
40
41
  facet_config = facet_configuration_for_field(facet.name)
@@ -67,7 +68,7 @@ json.included do
67
68
  end
68
69
 
69
70
  json.array! search_fields do |(label, key)|
70
- json.type 'search_field'
71
+ json.type "search_field"
71
72
  json.id key
72
73
  json.attributes do
73
74
  json.label label
@@ -78,7 +79,7 @@ json.included do
78
79
  end
79
80
 
80
81
  json.array! active_sort_fields do |key, field|
81
- json.type 'sort'
82
+ json.type "sort"
82
83
  json.id key
83
84
  json.attributes do
84
85
  json.label field.label
@@ -2,7 +2,7 @@
2
2
 
3
3
  json.set!(field_name) do
4
4
  json.id "#{document_url}##{field_name}"
5
- json.type 'document_value'
5
+ json.type "document_value"
6
6
  json.attributes do
7
7
  json.value doc_presenter.field_value(field)
8
8
  json.label field.label
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  json.links do
3
4
  json.self url_for(search_state.to_h.merge(only_path: false))
4
5
  json.prev url_for(search_state.to_h.merge(only_path: false, page: @response.prev_page.to_s)) if @response.prev_page
@@ -19,10 +20,10 @@ json.data do
19
20
  doc_presenter = index_presenter(document)
20
21
 
21
22
  doc_presenter.fields_to_render.each do |field_name, field|
22
- json.partial! 'field', field: field,
23
- field_name: field_name,
24
- document_url: document_url,
25
- doc_presenter: doc_presenter
23
+ json.partial! "field", field: field,
24
+ field_name: field_name,
25
+ document_url: document_url,
26
+ doc_presenter: doc_presenter
26
27
  end
27
28
  end
28
29
 
@@ -34,7 +35,7 @@ end
34
35
 
35
36
  json.included do
36
37
  json.array! @presenter.search_facets do |facet|
37
- json.type 'facet'
38
+ json.type "facet"
38
39
  json.id facet.name
39
40
  json.attributes do
40
41
  facet_config = facet_configuration_for_field(facet.name)
@@ -63,7 +64,7 @@ json.included do
63
64
  end
64
65
 
65
66
  json.array! search_fields do |(label, key)|
66
- json.type 'search_field'
67
+ json.type "search_field"
67
68
  json.id key
68
69
  json.attributes do
69
70
  json.label label
@@ -74,7 +75,7 @@ json.included do
74
75
  end
75
76
 
76
77
  json.array! active_sort_fields do |key, field|
77
- json.type 'sort'
78
+ json.type "sort"
78
79
  json.id key
79
80
  json.attributes do
80
81
  json.label field.label
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  json.links do
3
4
  json.self url_for(search_state.to_h.merge(only_path: false))
4
5
  json.prev url_for(search_state.to_h.merge(only_path: false, page: @response.prev_page.to_s)) if @response.prev_page
@@ -19,10 +20,10 @@ json.data do
19
20
  doc_presenter = document_presenter(document)
20
21
 
21
22
  doc_presenter.fields_to_render.each do |field_name, field|
22
- json.partial! 'field', field: field,
23
- field_name: field_name,
24
- document_url: document_url,
25
- doc_presenter: doc_presenter
23
+ json.partial! "field", field: field,
24
+ field_name: field_name,
25
+ document_url: document_url,
26
+ doc_presenter: doc_presenter
26
27
  end
27
28
  end
28
29
 
@@ -34,7 +35,7 @@ end
34
35
 
35
36
  json.included do
36
37
  json.array! @presenter.search_facets do |facet|
37
- json.type 'facet'
38
+ json.type "facet"
38
39
  json.id facet.name
39
40
  json.attributes do
40
41
  facet_config = facet_configuration_for_field(facet.name)
@@ -67,7 +68,7 @@ json.included do
67
68
  end
68
69
 
69
70
  json.array! search_fields do |(label, key)|
70
- json.type 'search_field'
71
+ json.type "search_field"
71
72
  json.id key
72
73
  json.attributes do
73
74
  json.label label
@@ -78,7 +79,7 @@ json.included do
78
79
  end
79
80
 
80
81
  json.array! active_sort_fields do |key, field|
81
- json.type 'sort'
82
+ json.type "sort"
82
83
  json.id key
83
84
  json.attributes do
84
85
  json.label field.label
@@ -1,6 +1,6 @@
1
1
  <p id="notice"><%= notice %></p>
2
2
 
3
- <h1>Bookmarks (<%= current_user.bookmarks.size %>)</h1>
3
+ <h1>Bookmarks (<%= current_user.bookmarks.where(document_type: 'Kithe::Model').size %>)</h1>
4
4
 
5
5
  <p>
6
6
  <%= render "admin/documents/result_toggle" %>
@@ -16,6 +16,6 @@
16
16
 
17
17
  <ol id='results' class='list-unstyled' data-controller='results'>
18
18
  <% @bookmarks.each_with_index do |bookmark, index| %>
19
- <%= render 'admin/documents/document', document: bookmark.document, index: index %>
19
+ <%= render 'admin/documents/document', document: Kithe::Model.find(bookmark.document_id), index: index %>
20
20
  <% end %>
21
21
  </ol>
@@ -1,4 +1,4 @@
1
- <%- @page_title = "GEOMG - Bulk Actions" %>
1
+ <%- @page_title = "GBL♦Admin - Bulk Actions" %>
2
2
 
3
3
  <h1 style="width:100%;">
4
4
  Bulk Actions
@@ -7,7 +7,7 @@
7
7
 
8
8
  <h6>
9
9
  <span class='float-left mt-3'>
10
- <%== pagy_info(@pagy, 'bulk actions'.pluralize(@pagy.count)) %>
10
+ <%== pagy_info(@pagy) %>
11
11
  </span>
12
12
  <span class='float-right'>
13
13
  <%== pagy_bootstrap_nav(@pagy) %>
@@ -44,7 +44,7 @@
44
44
 
45
45
  <h6>
46
46
  <span class='float-left mt-3'>
47
- <%== pagy_info(@pagy, 'imports'.pluralize(@pagy.count)) %>
47
+ <%== pagy_info(@pagy) %>
48
48
  </span>
49
49
  <span class='float-right'>
50
50
  <%== pagy_bootstrap_nav(@pagy) %>
@@ -63,7 +63,7 @@
63
63
  <h3 class="sr-only">Documents</h3>
64
64
  <h6>
65
65
  <span class='float-left mt-3'>
66
- <%== pagy_info(@pagy, 'documents'.pluralize(@pagy.count)) %>
66
+ <%== pagy_info(@pagy) %>
67
67
  </span>
68
68
  <span class='float-right'>
69
69
  <%== pagy_bootstrap_nav(@pagy) %>
@@ -1,5 +1,5 @@
1
1
 
2
- <%= simple_form_for [@document, @document_access] do |f| %>
2
+ <%= simple_form_for [:admin, @document, @document_access] do |f| %>
3
3
  <%= f.error_notification %>
4
4
  <%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %>
5
5
 
@@ -3,7 +3,7 @@
3
3
  <h1 style="width:100%; border-bottom:dotted;" class="mb-4">
4
4
  Document &middot; Destroy Document Access Links
5
5
  <% if params[:document_id] %>
6
- <%= link_to '+ New Access URL', new_document_document_access_path(@document), { class: 'btn btn-primary float-right' } %>
6
+ <%= link_to '+ New Access URL', new_admin_document_document_access_path(@document), { class: 'btn btn-primary float-right' } %>
7
7
  <% end %>
8
8
  </h1>
9
9
 
@@ -20,7 +20,7 @@
20
20
  </p>
21
21
  <h3 class='h4'>Upload a CSV File</h3>
22
22
 
23
- <%= simple_form_for DocumentAccess.new, url: destroy_all_document_accesses_path, method: :post, multipart: true do |f| %>
23
+ <%= simple_form_for DocumentAccess.new, url: destroy_all_admin_document_accesses_path, method: :post, multipart: true do |f| %>
24
24
  <div class="form-group">
25
25
  <div class="form-inputs">
26
26
  <%= f.simple_fields_for :assets do |asset_fields| %>
@@ -64,7 +64,7 @@
64
64
  <dt>id</dt>
65
65
  <dd>The database table row identifier</dd>
66
66
  <dt>friendlier_id</dt>
67
- <dd>The associated GEOMG document's friendlier id</dd>
67
+ <dd>The associated GBLADMIN document's friendlier id</dd>
68
68
  </dl>
69
69
  </div>
70
70
  </div>
@@ -2,4 +2,4 @@
2
2
 
3
3
  <%= render 'form', document_access: @document_access %>
4
4
 
5
- <%= link_to 'Back', document_document_accesses_path(@document) %>
5
+ <%= link_to 'Back', admin_document_document_accesses_path(@document) %>
@@ -3,7 +3,7 @@
3
3
  <h1 style="width:100%; border-bottom:dotted;" class="mb-4">
4
4
  Document &middot; Institutional Access
5
5
  <% if params[:document_id] %>
6
- <%= link_to '+ New Access URL', new_document_document_access_path(@document), { class: 'btn btn-primary float-right' } %>
6
+ <%= link_to '+ New Access URL', new_admin_document_document_access_path(@document), { class: 'btn btn-primary float-right' } %>
7
7
  <% end %>
8
8
  </h1>
9
9
 
@@ -16,7 +16,7 @@
16
16
  <% end %>
17
17
 
18
18
  <h3 class='h4'>Import a CSV File</h3>
19
- <%= simple_form_for DocumentAccess.new, url: import_document_accesses_path, method: :post, multipart: true do |f| %>
19
+ <%= simple_form_for DocumentAccess.new, url: import_admin_document_accesses_path, method: :post, multipart: true do |f| %>
20
20
  <div class="form-inputs">
21
21
  <%= f.simple_fields_for :assets do |asset_fields| %>
22
22
  <%= asset_fields.input :file, as: :file, input_html: {} %>
@@ -1,12 +1,12 @@
1
- <%- @page_title = "GEOMG - Document - Access Links" %>
1
+ <%- @page_title = "GBL♦Admin - Document - Access Links" %>
2
2
 
3
3
  <h1 style="width:100%;">
4
4
  Document &middot; Access Links
5
5
 
6
6
  <% if params[:document_id] %>
7
- <%= link_to '+ Import CSV', import_document_document_accesses_path(@document), { class: 'btn btn-primary float-right' } %>
7
+ <%= link_to '+ Import CSV', import_admin_document_document_accesses_path(@document), { class: 'btn btn-primary float-right' } %>
8
8
 
9
- <%= link_to '+ New Access URL', new_document_document_access_path(@document), { class: 'btn btn-primary float-right mr-2' } %>
9
+ <%= link_to '+ New Access URL', new_admin_document_document_access_path(@document), { class: 'btn btn-primary float-right mr-2' } %>
10
10
  <% else %>
11
11
  <%= link_to '- Delete CSV', destroy_all_admin_document_accesses_path, { class: 'btn btn-danger float-right' } %>
12
12
  <%= link_to '+ Import CSV', import_admin_document_accesses_path, { class: 'btn btn-primary float-right mr-4' } %>
@@ -14,7 +14,7 @@
14
14
  </h1>
15
15
  <% if params[:document_id] %>
16
16
  <h2 class='h3'>
17
- <%= link_to(@document.title, document_path(@document)) %>
17
+ <%= link_to(@document.title, admin_document_path(@document)) %>
18
18
  &middot;
19
19
  <%= @document_accesses.count %> urls
20
20
  </h2>
@@ -25,7 +25,7 @@
25
25
  <% if @pagy %>
26
26
  <h6>
27
27
  <span class='float-left mt-3'>
28
- <%== pagy_info(@pagy, 'imports'.pluralize(@pagy.count)) %>
28
+ <%== pagy_info(@pagy) %>
29
29
  </span>
30
30
  <span class='float-right'>
31
31
  <%== pagy_bootstrap_nav(@pagy) %>
@@ -48,9 +48,9 @@
48
48
  <tbody>
49
49
  <% @document_accesses.each do |document_access| %>
50
50
  <tr>
51
- <td><%= link_to 'Edit', edit_document_document_access_path(document_access.document, document_access) %></td>
52
- <td><%= link_to 'Destroy', document_document_access_path(document_access.document, document_access), method: :delete, data: { confirm: 'Are you sure?' } %></td>
53
- <td><%= link_to document_access.friendlier_id, document_path(document_access.document) %></td>
51
+ <td><%= link_to 'Edit', edit_admin_document_document_access_path(document_access.document, document_access) %></td>
52
+ <td><%= link_to 'Destroy', admin_document_document_access_path(document_access.document, document_access), method: :delete, data: { confirm: 'Are you sure?' } %></td>
53
+ <td><%= link_to document_access.friendlier_id, admin_document_path(document_access.document) %></td>
54
54
  <td><%= document_access.institution_code %></td>
55
55
  <td><%= b1g_institution_codes[document_access.institution_code] %></td>
56
56
  <td><%= link_to(document_access.access_url, document_access.access_url) %></td>
@@ -62,7 +62,7 @@
62
62
  <% if @pagy %>
63
63
  <h6>
64
64
  <span class='float-left mt-3'>
65
- <%== pagy_info(@pagy, 'imports'.pluralize(@pagy.count)) %>
65
+ <%== pagy_info(@pagy) %>
66
66
  </span>
67
67
  <span class='float-right'>
68
68
  <%== pagy_bootstrap_nav(@pagy) %>
@@ -3,4 +3,4 @@
3
3
 
4
4
  <%= render 'form', document_access: @document_access %>
5
5
 
6
- <%= link_to 'Back', document_document_accesses_path(@document) %>
6
+ <%= link_to 'Back', admin_document_document_accesses_path(@document) %>
@@ -1,5 +1,5 @@
1
1
 
2
- <%= simple_form_for(@document_download) do |f| %>
2
+ <%= simple_form_for([:admin, @document, @document_download]) do |f| %>
3
3
  <%= f.error_notification %>
4
4
  <%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %>
5
5
 
@@ -20,7 +20,7 @@
20
20
  </p>
21
21
  <h3 class='h4'>Upload a CSV File</h3>
22
22
 
23
- <%= simple_form_for DocumentDownload.new, url: destroy_all_document_downloads_path, method: :post, multipart: true do |f| %>
23
+ <%= simple_form_for DocumentDownload.new, url: destroy_all_admin_document_downloads_path, method: :post, multipart: true do |f| %>
24
24
  <div class="form-group">
25
25
  <div class="form-inputs">
26
26
  <%= f.simple_fields_for :downloads do |download_fields| %>
@@ -64,7 +64,7 @@
64
64
  <dt>id</dt>
65
65
  <dd>The database table row identifier</dd>
66
66
  <dt>friendlier_id</dt>
67
- <dd>The associated GEOMG document's friendlier id</dd>
67
+ <dd>The associated GBLADMIN document's friendlier id</dd>
68
68
  </dl>
69
69
  </div>
70
70
  </div>
@@ -1,6 +1,5 @@
1
1
  <h1>Editing Document Download</h1>
2
2
 
3
3
  <%= render 'form', document_download: @document_download %>
4
-
5
- <%= link_to 'Show', @document_download %> |
6
- <%= link_to 'Back', document_downloads_path %>
4
+ |
5
+ <%= link_to 'Back', admin_document_downloads_path(@document) %>
@@ -20,7 +20,7 @@
20
20
  </p>
21
21
 
22
22
  <h3 class="h4">Upload a CSV File</h3>
23
- <%= simple_form_for DocumentDownload.new, url: import_document_downloads_path, method: :post, multipart: true do |f| %>
23
+ <%= simple_form_for DocumentDownload.new, url: import_admin_document_downloads_path, method: :post, multipart: true do |f| %>
24
24
  <div class="form-inputs">
25
25
  <%= f.simple_fields_for :downloads do |download_fields| %>
26
26
  <%= download_fields.input :file, as: :file, input_html: {} %>
@@ -1,12 +1,12 @@
1
- <%- @page_title = "GEOMG - Document - Download Links" %>
1
+ <%- @page_title = "GBL♦Admin - Document - Download Links" %>
2
2
 
3
3
  <h1 style="width:100%;">
4
4
  Document &middot; Download Links
5
5
 
6
6
  <% if params[:document_id] %>
7
- <%= link_to '+ Import CSV', import_document_document_downloads_path(@document), { class: 'btn btn-primary float-right' } %>
7
+ <%= link_to '+ Import CSV', import_admin_document_document_downloads_path(@document), { class: 'btn btn-primary float-right' } %>
8
8
 
9
- <%= link_to '+ New Download URL', new_document_document_download_path(@document), { class: 'btn btn-primary float-right mr-2' } %>
9
+ <%= link_to '+ New Download URL', new_admin_document_document_download_path(@document), { class: 'btn btn-primary float-right mr-2' } %>
10
10
  <% else %>
11
11
  <%= link_to '- Delete CSV', destroy_all_admin_document_downloads_path, { class: 'btn btn-danger float-right' } %>
12
12
  <%= link_to '+ Import CSV', import_admin_document_downloads_path, { class: 'btn btn-primary float-right mr-4' } %>
@@ -14,7 +14,7 @@
14
14
  </h1>
15
15
  <% if params[:document_id] %>
16
16
  <h2 class='h3'>
17
- <%= link_to(@document.title, document_path(@document)) %>
17
+ <%= link_to(@document.title, admin_document_path(@document)) %>
18
18
  &middot;
19
19
  <%= @document_downloads.count %> downloads
20
20
  </h2>
@@ -25,7 +25,7 @@
25
25
  <% if @pagy %>
26
26
  <h6>
27
27
  <span class='float-left mt-3'>
28
- <%== pagy_info(@pagy, 'downloads'.pluralize(@pagy.count)) %>
28
+ <%== pagy_info(@pagy) %>
29
29
  </span>
30
30
  <span class='float-right'>
31
31
  <%== pagy_bootstrap_nav(@pagy) %>
@@ -46,9 +46,9 @@
46
46
  <tbody>
47
47
  <% @document_downloads.each do |document_download| %>
48
48
  <tr>
49
- <td><%= link_to 'Edit', edit_document_document_download_path(document_download.document, document_download) %></td>
50
- <td><%= link_to 'Destroy', document_document_download_path(document_download.document, document_download), method: :delete, data: { confirm: 'Are you sure?' } %></td>
51
- <td><%= link_to document_download.friendlier_id, document_path(document_download.document) %></td>
49
+ <td><%= link_to 'Edit', edit_admin_document_document_download_path(document_download.document, document_download) %></td>
50
+ <td><%= link_to 'Destroy', admin_document_document_download_path(document_download.document, document_download), method: :delete, data: { confirm: 'Are you sure?' } %></td>
51
+ <td><%= link_to document_download.friendlier_id, admin_document_path(document_download.document) %></td>
52
52
  <td><%= document_download.label %></td>
53
53
  <td><%= link_to document_download.value %></td>
54
54
  </tr>
@@ -59,7 +59,7 @@
59
59
  <% if @pagy %>
60
60
  <h6>
61
61
  <span class='float-left mt-3'>
62
- <%== pagy_info(@pagy, 'downloads'.pluralize(@pagy.count)) %>
62
+ <%== pagy_info(@pagy) %>
63
63
  </span>
64
64
  <span class='float-right'>
65
65
  <%== pagy_bootstrap_nav(@pagy) %>
@@ -2,4 +2,4 @@
2
2
 
3
3
  <%= render 'form', document_download: @document_download %>
4
4
 
5
- <%= link_to 'Back', document_downloads_path %>
5
+ <%= link_to 'Back', admin_document_downloads_path %>
@@ -20,5 +20,5 @@
20
20
  <%= @document_download.position %>
21
21
  </p>
22
22
 
23
- <%= link_to 'Edit', edit_document_download_path(@document_download) %> |
24
- <%= link_to 'Back', document_downloads_path %>
23
+ <%= link_to 'Edit', edit_admin_document_download_path(@document_download) %> |
24
+ <%= link_to 'Back', admin_document_downloads_path %>