geoblacklight_admin 0.5.0 → 0.6.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 (162) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +24 -11
  3. data/Rakefile +83 -47
  4. data/app/assets/javascripts/geoblacklight_admin/chosen.js +1 -0
  5. data/app/assets/stylesheets/geoblacklight_admin/_core.scss +24 -0
  6. data/app/assets/stylesheets/geoblacklight_admin/modules/_nav.scss +0 -5
  7. data/app/assets/stylesheets/geoblacklight_admin/modules/_tables.scss +1 -1
  8. data/app/controllers/admin/admin_controller.rb +16 -0
  9. data/app/controllers/admin/advanced_search_controller.rb +7 -1
  10. data/app/controllers/admin/assets_controller.rb +47 -32
  11. data/app/controllers/admin/bookmarks_controller.rb +17 -5
  12. data/app/controllers/admin/bulk_actions_controller.rb +32 -1
  13. data/app/controllers/admin/document_accesses_controller.rb +38 -0
  14. data/app/controllers/admin/document_assets_controller.rb +47 -89
  15. data/app/controllers/admin/document_distributions_controller.rb +172 -0
  16. data/app/controllers/admin/documents_controller.rb +43 -57
  17. data/app/controllers/admin/elements_controller.rb +24 -0
  18. data/app/controllers/admin/form_elements_controller.rb +33 -0
  19. data/app/controllers/admin/ids_controller.rb +6 -0
  20. data/app/controllers/admin/import_documents_controller.rb +11 -1
  21. data/app/controllers/admin/imports_controller.rb +34 -4
  22. data/app/controllers/admin/mappings_controller.rb +15 -0
  23. data/app/controllers/admin/notifications_controller.rb +27 -0
  24. data/app/controllers/admin/reference_types_controller.rb +106 -0
  25. data/app/controllers/admin/search_controller.rb +7 -0
  26. data/app/controllers/admin/users_controller.rb +10 -0
  27. data/app/helpers/asset_helper.rb +6 -0
  28. data/app/helpers/bulk_actions_helper.rb +10 -1
  29. data/app/helpers/document_helper.rb +36 -0
  30. data/app/helpers/geoblacklight_admin_helper.rb +88 -8
  31. data/app/helpers/mappings_helper.rb +26 -0
  32. data/app/indexers/document_indexer.rb +22 -2
  33. data/app/javascript/channels/consumer.js +6 -0
  34. data/app/javascript/channels/export_channel.js +30 -0
  35. data/app/javascript/channels/index.js +3 -0
  36. data/app/javascript/controllers/results_controller.js +14 -0
  37. data/app/javascript/index.js +8 -2
  38. data/app/jobs/bulk_action_revert_document_job.rb +4 -12
  39. data/app/jobs/bulk_action_run_document_job.rb +2 -10
  40. data/app/jobs/export_job.rb +35 -8
  41. data/app/jobs/geoblacklight_admin/delete_thumbnail_job.rb +19 -0
  42. data/app/jobs/geoblacklight_admin/remove_parent_dct_references_uri_job.rb +16 -0
  43. data/app/jobs/geoblacklight_admin/set_parent_dct_references_uri_job.rb +17 -0
  44. data/app/jobs/geoblacklight_admin/store_image_job.rb +22 -0
  45. data/app/jobs/import_document_job.rb +1 -4
  46. data/app/jobs/import_run_job.rb +1 -1
  47. data/app/models/admin/bookmark.rb +1 -1
  48. data/app/models/asset.rb +20 -0
  49. data/app/models/bulk_action.rb +2 -1
  50. data/app/models/bulk_actions/change_publication_state.rb +0 -25
  51. data/app/models/bulk_actions/delete_thumbnails.rb +6 -0
  52. data/app/models/bulk_actions/draft_document.rb +6 -0
  53. data/app/models/bulk_actions/harvest_thumbnails.rb +6 -0
  54. data/app/models/bulk_actions/publish_document.rb +6 -0
  55. data/app/models/bulk_actions/unpublish_document.rb +6 -0
  56. data/app/models/document/geom_validator.rb +8 -0
  57. data/app/models/document/reference.rb +65 -65
  58. data/app/models/document.rb +129 -72
  59. data/app/models/document_distribution.rb +145 -0
  60. data/app/models/element.rb +2 -0
  61. data/app/models/geoblacklight_admin/schema.rb +10 -2
  62. data/app/models/import/csv_duplicates_validator.rb +2 -0
  63. data/app/models/import/csv_header_validator.rb +3 -1
  64. data/app/models/import_btaa_aardvark.rb +2 -2
  65. data/app/models/import_document_state_machine.rb +1 -0
  66. data/app/models/import_gblv1.rb +2 -2
  67. data/app/models/reference_type.rb +40 -0
  68. data/app/models/user.rb +4 -2
  69. data/app/services/export_csv_document_distributions_service.rb +61 -0
  70. data/app/services/geoblacklight_admin/image_service/iiif_manifest.rb +39 -43
  71. data/app/services/geoblacklight_admin/image_service/tms.rb +0 -8
  72. data/app/services/geoblacklight_admin/image_service.rb +1 -1
  73. data/app/services/geoblacklight_admin/item_viewer.rb +4 -4
  74. data/app/views/admin/bookmarks/index.html.erb +19 -14
  75. data/app/views/admin/bulk_actions/show.html.erb +1 -1
  76. data/app/views/admin/document_accesses/import.html.erb +6 -2
  77. data/app/views/admin/document_assets/_assets_table.html.erb +49 -0
  78. data/app/views/admin/document_assets/_form.html.erb +2 -3
  79. data/app/views/admin/document_assets/index.html.erb +1 -47
  80. data/app/views/admin/document_distributions/_document_distribution.html.erb +39 -0
  81. data/app/views/admin/document_distributions/_document_distribution.json.jbuilder +2 -0
  82. data/app/views/admin/document_distributions/_form.html.erb +34 -0
  83. data/app/views/admin/document_distributions/destroy_all.html.erb +82 -0
  84. data/app/views/admin/document_distributions/edit.html.erb +12 -0
  85. data/app/views/admin/document_distributions/import.html.erb +80 -0
  86. data/app/views/admin/document_distributions/index.html.erb +143 -0
  87. data/app/views/admin/document_distributions/index.json.jbuilder +1 -0
  88. data/app/views/admin/document_distributions/new.html.erb +11 -0
  89. data/app/views/admin/document_distributions/show.html.erb +10 -0
  90. data/app/views/admin/document_distributions/show.json.jbuilder +1 -0
  91. data/app/views/admin/documents/_document.html.erb +1 -3
  92. data/app/views/admin/documents/_form.html.erb +2 -4
  93. data/app/views/admin/documents/_form_control.html.erb +5 -2
  94. data/app/views/admin/documents/_form_nav.html.erb +14 -5
  95. data/app/views/admin/documents/_form_nav_kithe.html.erb +4 -1
  96. data/app/views/admin/documents/_json_aardvark.jbuilder +1 -1
  97. data/app/views/admin/documents/_json_gbl_v1.jbuilder +1 -1
  98. data/app/views/admin/documents/_result_selected_options.html.erb +5 -2
  99. data/app/views/admin/documents/admin.html.erb +5 -5
  100. data/app/views/admin/documents/features/_document_references.html.erb +23 -0
  101. data/app/views/admin/documents/features/_multiple_download_links.html.erb +29 -26
  102. data/app/views/admin/ids/fetch.json.jbuilder +0 -2
  103. data/app/views/admin/ids/index.json.jbuilder +0 -2
  104. data/app/views/admin/imports/_form.html.erb +1 -1
  105. data/app/views/admin/imports/show.html.erb +1 -1
  106. data/app/views/admin/layouts/application.html.erb +4 -2
  107. data/app/views/admin/mappings/index.html.erb +1 -1
  108. data/app/views/admin/notifications/_notification.html.haml +29 -28
  109. data/app/views/admin/reference_types/_form.html.erb +25 -0
  110. data/app/views/admin/reference_types/_reference_type.html.erb +52 -0
  111. data/app/views/admin/reference_types/_reference_type.json.jbuilder +2 -0
  112. data/app/views/admin/reference_types/edit.html.erb +12 -0
  113. data/app/views/admin/reference_types/index.html.erb +52 -0
  114. data/app/views/admin/reference_types/index.json.jbuilder +1 -0
  115. data/app/views/admin/reference_types/new.html.erb +11 -0
  116. data/app/views/admin/reference_types/show.html.erb +3 -0
  117. data/app/views/admin/reference_types/show.json.jbuilder +1 -0
  118. data/app/views/admin/shared/_footer.html.erb +5 -2
  119. data/app/views/admin/shared/_js_behaviors.html.erb +2 -3
  120. data/app/views/admin/shared/_navbar.html.erb +9 -2
  121. data/app/views/admin/users/index.html.erb +0 -1
  122. data/app/views/catalog/_show_gbl_admin.html.erb +1 -1
  123. data/config/initializers/defaults.yml +310 -0
  124. data/config/initializers/rails_config.rb +8 -0
  125. data/config/locales/documents.en.yml +14 -0
  126. data/config/routes.rb +30 -5
  127. data/db/import_references_schema_support.numbers +0 -0
  128. data/db/migrate/20230316183001_add_geoblacklight_admin_gem.rb +0 -12
  129. data/db/migrate/20241009200524_create_admin_reference_types.rb +13 -0
  130. data/db/migrate/20241010161420_create_document_references.rb +14 -0
  131. data/db/migrate/20241120238823_rename_references_to_distributions.rb +5 -0
  132. data/db/seeds.rb +5 -0
  133. data/db/seeds_elements.csv +1 -1
  134. data/db/seeds_elements.numbers +0 -0
  135. data/db/seeds_reference_types.csv +29 -0
  136. data/db/seeds_reference_types.numbers +0 -0
  137. data/db/structure.sql +1 -38
  138. data/lib/compose.yml +31 -0
  139. data/lib/generators/geoblacklight_admin/config_generator.rb +53 -12
  140. data/lib/generators/geoblacklight_admin/install_generator.rb +8 -0
  141. data/lib/generators/geoblacklight_admin/templates/btaa_sample_records.csv +5 -0
  142. data/lib/generators/geoblacklight_admin/templates/config/database.yml +1 -1
  143. data/lib/generators/geoblacklight_admin/templates/config/initializers/devise.rb +0 -2
  144. data/lib/generators/geoblacklight_admin/templates/config/initializers/mime_types.rb +1 -0
  145. data/lib/generators/geoblacklight_admin/templates/demo-app/Dockerfile +31 -0
  146. data/lib/generators/geoblacklight_admin/templates/demo-app/compose.yml +42 -0
  147. data/lib/generators/geoblacklight_admin/templates/demo-app/start-server.sh +21 -0
  148. data/lib/geoblacklight_admin/engine.rb +4 -0
  149. data/lib/geoblacklight_admin/rake_task.rb +2 -0
  150. data/lib/geoblacklight_admin/tasks/distributions.rake +69 -0
  151. data/lib/geoblacklight_admin/tasks/images.rake +1 -0
  152. data/lib/geoblacklight_admin/tasks/solr.rake +31 -0
  153. data/lib/geoblacklight_admin/version.rb +1 -1
  154. data/lib/geoblacklight_admin.rb +4 -0
  155. metadata +137 -53
  156. data/app/helpers/import_documents_helper.rb +0 -5
  157. data/app/javascript/entrypoints/engine.js +0 -8
  158. data/config/locales/devise_invitable.en.yml +0 -31
  159. data/lib/generators/geoblacklight_admin/templates/devise/invitations/edit.html.erb +0 -15
  160. data/lib/generators/geoblacklight_admin/templates/devise/invitations/new.html.erb +0 -15
  161. data/lib/generators/geoblacklight_admin/templates/devise/mailer/invitation_instructions.html.erb +0 -11
  162. data/lib/generators/geoblacklight_admin/templates/devise/mailer/invitation_instructions.text.erb +0 -11
@@ -0,0 +1,80 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <h1 style="width:100%; border-bottom:dotted;" class="mb-4">
4
+ Document &middot; Distributions
5
+ <% if params[:document_id] %>
6
+ <%= link_to '+ New Distribution', new_admin_document_document_distribution_path(@document), { class: 'btn btn-primary float-right' } %>
7
+ <% end %>
8
+ </h1>
9
+
10
+ <div class="row">
11
+ <div class="col-4">
12
+ <% if params[:document_id] %>
13
+ <h2 class='h3'><%= @document.title %></h2>
14
+ <% else %>
15
+ <h2 class='h3'>Import for Multiple Documents</h2>
16
+ <% end %>
17
+
18
+ <p class="alert alert-info" role="alert">
19
+ <strong>Note:</strong> New Distributions will be created. Existing Distributions will be updated per the CSV file.
20
+ </p>
21
+
22
+ <h3 class="h4">Upload a CSV File</h3>
23
+ <%= simple_form_for DocumentDistribution.new, url: import_admin_document_distributions_path, method: :post, multipart: true do |f| %>
24
+ <div class="form-inputs">
25
+ <%= f.simple_fields_for :distributions do |distribution_fields| %>
26
+ <%= distribution_fields.input :file, as: :file, input_html: {} %>
27
+ <%- end %>
28
+ </div>
29
+
30
+ <div class="form-actions">
31
+ <%= submit_tag "+ Import CSV", {class: 'btn btn-primary'} %>
32
+ </div>
33
+ <% end %>
34
+ </div>
35
+ <div class="col-8">
36
+ <h4>Example CSV File</h4>
37
+ <table class="table table-bordered">
38
+ <thead>
39
+ <tr>
40
+ <th>friendlier_id</th>
41
+ <th>reference_type</th>
42
+ <th>distribution_url</th>
43
+ <th>label</th>
44
+ </tr>
45
+ </thead>
46
+ <tbody>
47
+ <tr>
48
+ <td>00add5b8-a7b1-42d4-b4de-ca99716a5096</td>
49
+ <td>download</td>
50
+ <td>https://s3.amazonaws.com/holc/tiles/WI/Madison/1937/rectified.zip</td>
51
+ <td>GeoTIFF</td>
52
+ </tr>
53
+ <tr>
54
+ <td>00add5b8-a7b1-42d4-b4de-ca99716a5096</td>
55
+ <td>download</td>
56
+ <td>https://s3.amazonaws.com/holc/tiles/WI/Madison/1937/holc-scan.jpg</td>
57
+ <td>JPEG</td>
58
+ </tr>
59
+ <tr>
60
+ <td>...</td>
61
+ <td>...</td>
62
+ <td>...</td>
63
+ <td>...</td>
64
+ </tr>
65
+ </tbody>
66
+ </table>
67
+
68
+ <h5>CSV File Column Definitions</h5>
69
+ <dl>
70
+ <dt>friendlier_id</dt>
71
+ <dd>The associated document's friendlier id</dd>
72
+ <dt>reference_type</dt>
73
+ <dd>The name of the reference type</dd>
74
+ <dt>distribution_url</dt>
75
+ <dd>The URL for the distribution</dd>
76
+ <dt>label</dt>
77
+ <dd>The label for the distribution, if the reference type is labeled</dd>
78
+ </dl>
79
+ </div>
80
+ </div>
@@ -0,0 +1,143 @@
1
+ <%- @page_title = "GBL♦Admin - Document - Distributions" %>
2
+
3
+ <div class="row mb-2">
4
+ <div class="col">
5
+ <h1 style="width:100%;">
6
+ Document &middot; Distributions
7
+
8
+ <% if params[:document_id] %>
9
+ <%= link_to '+ Import CSV', import_admin_document_document_distributions_path(@document), { class: 'btn btn-primary float-right' } %>
10
+
11
+ <%= link_to '+ New Distribution', new_admin_document_document_distribution_path(@document), { class: 'btn btn-primary float-right mr-2' } %>
12
+ <% else %>
13
+ <%= link_to '- Delete CSV', destroy_all_admin_document_distributions_path, { class: 'btn btn-danger float-right' } %>
14
+ <%= link_to '+ Import CSV', import_admin_document_distributions_path, { class: 'btn btn-primary float-right mr-4' } %>
15
+ <% end %>
16
+ </h1>
17
+
18
+ <% if params[:document_id] %>
19
+ <h2 class='h3'>
20
+ <%= link_to(@document.title, admin_document_path(@document)) %>
21
+ &middot;
22
+ <%= @document_distributions.count %> distributions
23
+ </h2>
24
+ <% else %>
25
+ <h2 class='h3'>Distributions</h2>
26
+ <% end %>
27
+
28
+ <!-- Tab navigation -->
29
+ <ul class="nav nav-tabs" id="documentTab" role="tablist">
30
+ <li class="nav-item">
31
+ <a class="nav-link active" id="html-tab" data-toggle="tab" href="#html" role="tab" aria-controls="html" aria-selected="true">HTML</a>
32
+ </li>
33
+ <% if params[:document_id] %>
34
+ <li class="nav-item">
35
+ <a class="nav-link" id="json-tab" data-toggle="tab" href="#json" role="tab" aria-controls="json" aria-selected="false">JSON</a>
36
+ </li>
37
+ <li class="nav-item">
38
+ <a class="nav-link" id="csv-tab" data-toggle="tab" href="#csv" role="tab" aria-controls="csv" aria-selected="false">CSV</a>
39
+ </li>
40
+ <% end %>
41
+ </ul>
42
+
43
+ <!-- Tab content -->
44
+ <div class="tab-content" id="documentTabContent">
45
+ <div class="tab-pane fade show active" id="html" role="tabpanel" aria-labelledby="html-tab">
46
+ <br />
47
+ <!-- HTML content -->
48
+
49
+ <% if @pagy %>
50
+ <h6>
51
+ <span class='float-left mt-3'>
52
+ <%== pagy_info(@pagy) %>
53
+ </span>
54
+ <span class='float-right'>
55
+ <%== pagy_bootstrap_nav(@pagy) %>
56
+ </span>
57
+ </h6>
58
+ <% end %>
59
+
60
+ <% if @document %>
61
+ <h3>External – Document Distributions</h3>
62
+ <% end %>
63
+
64
+ <table class="table table-striped table-bordered sortable">
65
+ <thead class="thead-dark">
66
+ <tr>
67
+ <th class="header">Layer Slug</th>
68
+ <th class="header">Type</th>
69
+ <th class="header">URI</th>
70
+ <th class="header">Value</th>
71
+ <th class="header">Label</th>
72
+ <th class="header" colspan="2">Actions</th>
73
+ </tr>
74
+ </thead>
75
+
76
+ <tbody>
77
+ <% @document_distributions.each do |document_distribution| %>
78
+ <tr>
79
+ <td><%= link_to document_distribution.friendlier_id, admin_document_path(document_distribution.document) %></td>
80
+ <td><%= document_distribution.reference_type.reference_type %></td>
81
+ <td><%= document_distribution.reference_type.reference_uri %></td>
82
+ <td><%= link_to document_distribution.url, document_distribution.url, target: '_blank' %></td>
83
+ <td><%= document_distribution.label %></td>
84
+ <td><%= link_to 'Edit', edit_admin_document_document_distribution_path(document_distribution.document, document_distribution) %></td>
85
+ <td><%= link_to 'Destroy', admin_document_document_distribution_path(document_distribution.document, document_distribution), method: :delete, data: { confirm: 'Are you sure?' } %></td>
86
+ </tr>
87
+ <% end %>
88
+ </tbody>
89
+ </table>
90
+
91
+ <% if @pagy %>
92
+ <h6>
93
+ <span class='float-left mt-3'>
94
+ <%== pagy_info(@pagy) %>
95
+ </span>
96
+ <span class='float-right'>
97
+ <%== pagy_bootstrap_nav(@pagy) %>
98
+ </span>
99
+ </h6>
100
+ <% end %>
101
+
102
+ <% if @document && @document.distributable_assets.any? %>
103
+ <h3>Internal – Distributable Assets</h3>
104
+ <%= render partial: 'admin/document_assets/assets_table', locals: { document_assets: @document.document_assets } %>
105
+ <% end %>
106
+ </div>
107
+
108
+ <% if params[:document_id] %>
109
+ <div class="tab-pane fade" id="json" role="tabpanel" aria-labelledby="json-tab">
110
+ <h3 class="mt-4">Ruby Hash</h3>
111
+ <%= ap(@document.distributions).html_safe %>
112
+ <h3 class="mt-4">JSON</h3>
113
+ <%= ap(@document.distributions.to_json).html_safe %>
114
+ </div>
115
+
116
+ <div class="tab-pane fade" id="csv" role="tabpanel" aria-labelledby="csv-tab">
117
+ <br />
118
+
119
+ <!-- CSV content -->
120
+ <table class="table table-striped table-bordered sortable">
121
+ <thead class="thead-dark">
122
+ <tr>
123
+ <th class="header">Layer Slug</th>
124
+ <th class="header">Type</th>
125
+ <th class="header">Value</th>
126
+ <th class="header">Label</th>
127
+ </tr>
128
+ </thead>
129
+ <tbody>
130
+ <% @document.distributions_csv.each do |row| %>
131
+ <tr>
132
+ <% row.each do |value| %>
133
+ <td><%= value %></td>
134
+ <% end %>
135
+ </tr>
136
+ <% end %>
137
+ </tbody>
138
+ </table>
139
+ </div>
140
+ <% end %>
141
+ </div>
142
+ </div>
143
+ </div>
@@ -0,0 +1 @@
1
+ json.array! @document_distributions, partial: "document_distributions/document_distribution", as: :document_distribution
@@ -0,0 +1,11 @@
1
+ <% content_for :title, "New document distribution" %>
2
+
3
+ <h1>New document distribution</h1>
4
+
5
+ <%= render "form", document_distribution: @document_distribution %>
6
+
7
+ <br>
8
+
9
+ <div>
10
+ <%= link_to "Back to document distributions", admin_document_document_distributions_path(@document) %>
11
+ </div>
@@ -0,0 +1,10 @@
1
+ <p style="color: green"><%= notice %></p>
2
+
3
+ <%= render @document_distribution %>
4
+
5
+ <div>
6
+ <%= link_to "Edit this document distribution", edit_admin_document_document_distribution_path(@document, @document_distribution) %> |
7
+ <%= link_to "Back to document distributions", admin_document_document_distributions_path(@document) %>
8
+
9
+ <%= button_to "Destroy this document distribution", admin_document_document_distribution_path(@document, @document_distribution), method: :delete %>
10
+ </div>
@@ -0,0 +1 @@
1
+ json.partial! "document_distributions/document_distribution", document_distribution: @document_distribution
@@ -8,9 +8,7 @@
8
8
  <% @document = Document.find_by(friendlier_id: document.friendlier_id) %>
9
9
  <% if thumb_to_render?(@document) %>
10
10
  <%= link_to edit_admin_document_path(document.friendlier_id) do %>
11
- <% if @document.thumbnail.file_derivatives[:thumb_standard_2X].exists? %>
12
- <%= image_tag(@document.thumbnail.file_url(:thumb_standard_2X), class: "thumbnail") %>
13
- <% end %>
11
+ <%= image_tag(thumbnail_to_render(@document), class: "thumbnail") %>
14
12
  <% end %>
15
13
  <% end %>
16
14
  </div>
@@ -8,11 +8,9 @@
8
8
  <h1 class="h5">
9
9
  <% if @document.persisted? %>
10
10
  <div class="row">
11
- <% if @document.thumbnail.present? %>
11
+ <% if thumb_to_render?(@document) %>
12
12
  <div class="thumbnail col-2">
13
- <% unless @document&.thumbnail&.file_url(:thumb_mini).nil? %>
14
- <%= image_tag @document&.thumbnail&.file_url(:thumb_mini) %>
15
- <% end %>
13
+ <%= image_tag thumbnail_to_render(@document), class: "thumbnail" %>
16
14
  </div>
17
15
  <% end %>
18
16
  <div class="col">
@@ -37,8 +37,11 @@
37
37
 
38
38
  <% # References are a special, special case %>
39
39
  <% elsif element.solr_field == 'dct_references_s' %>
40
- <%= f.repeatable_attr_input(element.solr_field.to_sym, build: :at_least_one, html_attributes: options[:html_attributes], simple_form_input_args: { label: element.label }) do |sub_form| %>
41
- <%= category_and_value(sub_form, category_list: Document::Reference::REFERENCE_VALUES.keys) %>
40
+ <% unless ENV["GBL_ADMIN_REFERENCES_MIGRATED"] == "true" %>
41
+ <%- Rails.logger.warn("Deprecation warning: AttrJSON-based dct_references_s will not be supported soon.") %>
42
+ <%= f.repeatable_attr_input(element.solr_field.to_sym, build: :at_least_one, html_attributes: options[:html_attributes], simple_form_input_args: { label: element.label }) do |sub_form| %>
43
+ <%= category_and_value(sub_form, category_list: Document::Reference::REFERENCE_VALUES.keys) %>
44
+ <% end %>
42
45
  <% end %>
43
46
 
44
47
  <% elsif element.repeatable? %>
@@ -1,7 +1,7 @@
1
1
  <div class="make-me-sticky mt-4 ml-4">
2
2
  <nav class="nav flex-column ml-4 mt-6">
3
3
  <% if @document.persisted? %>
4
- <strong class="mb-4"><%= link_to "GBL♦Admin | View in GeoBlacklight", solr_document_url(@document), { class: 'btn btn-warning' } %></strong>
4
+ <strong class="mb-4"><%= link_to "GBL♦Admin | View in GeoBlacklight", solr_document_url(@document), { class: 'btn btn-gbl-admin btn-warning' } %></strong>
5
5
  <% end %>
6
6
 
7
7
  <%- form_elements = FormElement.all.order(position: :asc) %>
@@ -14,19 +14,28 @@
14
14
  <% end %>
15
15
  <% end %>
16
16
 
17
- <% if @document.persisted? %>
17
+ <%- if @document.persisted? %>
18
18
  <%= link_to admin_document_document_accesses_url(@document), class: "ml-2" do %>
19
19
  Institutional Access Links
20
20
  <span class="badge badge-light"><%= @document.document_accesses.count %></span>
21
21
  <% end %>
22
- <%= link_to admin_document_document_downloads_url(@document), class: "ml-2" do %>
23
- Multiple Download Links
24
- <span class="badge badge-light"><%= @document.document_downloads.count %></span>
22
+
23
+ <%- if ENV["GBL_ADMIN_REFERENCES_MIGRATED"] == "false" %>
24
+ <%- Rails.logger.warn("Deprecation warning: Multiple Download Links will not be supported soon.") %>
25
+ <%= link_to admin_document_document_downloads_url(@document), class: "ml-2" do %>
26
+ Multiple Download Links
27
+ <span class="badge badge-light"><%= @document.document_downloads.count %></span>
28
+ <% end %>
25
29
  <% end %>
30
+
26
31
  <%= link_to admin_document_document_assets_url(@document), class: "ml-2" do %>
27
32
  Additional Assets
28
33
  <span class="badge badge-light"><%= @document.document_assets.count %></span>
29
34
  <% end %>
35
+ <%= link_to admin_document_document_distributions_url(@document), class: "ml-2" do %>
36
+ Distributions
37
+ <span class="badge badge-light"><%= @document.distributions.size %></span>
38
+ <% end %>
30
39
  <% end %>
31
40
  </nav>
32
41
  </div>
@@ -23,7 +23,10 @@
23
23
 
24
24
  <% if @document.persisted? %>
25
25
  <%= link_to "Institutional Access Links", admin_document_document_accesses_url(@document), class: "ml-2" %>
26
- <%= link_to "Multiple Download Links", admin_document_document_downloads_url(@document), class: "ml-2" %>
26
+ <% if ENV["GBL_ADMIN_REFERENCES_MIGRATED"] == "false" %>
27
+ <%= Rails.logger.warn("Deprecation warning: Multiple Download Links will not be supported soon.") %>
28
+ <%= link_to "Multiple Download Links", admin_document_document_downloads_url(@document), class: "ml-2" %>
29
+ <% end %>
27
30
  <%= link_to "Additional Assets", admin_document_document_assets_url(@document), class: "ml-2" %>
28
31
  <% end %>
29
32
  </nav>
@@ -38,7 +38,7 @@ json.dct_accessRights_s no_json_blanks document.send(GeoblacklightAdmin::Schema.
38
38
  json.dct_format_s no_json_blanks document.send(GeoblacklightAdmin::Schema.instance.solr_fields[:format])
39
39
  json.gbl_fileSize_s no_json_blanks document.send(GeoblacklightAdmin::Schema.instance.solr_fields[:file_size])
40
40
  json.gbl_wxsIdentifier_s no_json_blanks document.send(GeoblacklightAdmin::Schema.instance.solr_fields[:wxs_identifier])
41
- json.dct_references_s no_json_blanks document.references_json
41
+ json.dct_references_s no_json_blanks document.distributions_json
42
42
  json.id no_json_blanks document.send(GeoblacklightAdmin::Schema.instance.solr_fields[:id])
43
43
  json.dct_identifier_sm no_json_blanks document.send(GeoblacklightAdmin::Schema.instance.solr_fields[:identifier])
44
44
  json.gbl_mdModified_dt no_json_blanks document.send(GeoblacklightAdmin::Schema.instance.solr_fields[:updated_at])
@@ -18,7 +18,7 @@ json.dc_creator_sm no_json_blanks document.send(GeoblacklightAdmin::Schema.insta
18
18
  json.dc_description_s no_json_blanks document.send(GeoblacklightAdmin::Schema.instance.solr_fields[:description]).join("|")
19
19
  json.dc_format_s no_json_blanks document.send(GeoblacklightAdmin::Schema.instance.solr_fields[:format])
20
20
  json.dc_subject_sm no_json_blanks document.send(GeoblacklightAdmin::Schema.instance.solr_fields[:subject])
21
- json.dct_references_s no_json_blanks document.references_json
21
+ json.dct_references_s no_json_blanks document.distributions_json
22
22
  json.dct_spatial_sm no_json_blanks document.send(GeoblacklightAdmin::Schema.instance.solr_fields[:spatial_coverage])
23
23
  json.layer_modified_dt no_json_blanks document.send(GeoblacklightAdmin::Schema.instance.solr_fields[:updated_at])
24
24
 
@@ -22,11 +22,14 @@
22
22
  <a class="dropdown-item" data-action="click->results#exportJsonBtaaAardvark" href="javascript:void(0);">JSON (BTAA Aardvark)</a>
23
23
  <a class="dropdown-item" data-action="click->results#exportJsonGBLv1" href="javascript:void(0);">JSON (GBL v1.0)</a>
24
24
  <div class="dropdown-divider"></div>
25
+ <a class="dropdown-item" data-action="click->results#exportCsvDocumentAccessLinks" href="javascript:void(0);">
26
+ CSV - Document Access Links
27
+ </a>
25
28
  <a class="dropdown-item" data-action="click->results#exportCsvDocumentDownloads" href="javascript:void(0);">
26
29
  CSV - Document Downloads
27
30
  </a>
28
- <a class="dropdown-item" data-action="click->results#exportCsvDocumentAccessLinks" href="javascript:void(0);">
29
- CSV - Document Access Links
31
+ <a class="dropdown-item" data-action="click->results#exportCsvDocumentReferences" href="javascript:void(0);">
32
+ CSV - Document References
30
33
  </a>
31
34
  </div>
32
35
  </span>
@@ -132,12 +132,12 @@
132
132
  </div>
133
133
 
134
134
  <div class="card">
135
- <div class="card-header" id="references">
136
- <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#references-content" aria-controls="references-content">
137
- <h3 class="mb-0">References</h3>
135
+ <div class="card-header" id="distributions">
136
+ <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#distributions-content" aria-controls="distributions-content">
137
+ <h3 class="mb-0">Distributions</h3>
138
138
  </button>
139
139
  </div>
140
- <div id="references-content" class="collapse" aria-labelledby="references-content" data-parent="#references">
140
+ <div id="distributions-content" class="collapse" aria-labelledby="distributions-content" data-parent="#distributions">
141
141
  <div class="card-body">
142
142
  <table class="table responsive">
143
143
  <thead>
@@ -147,7 +147,7 @@
147
147
  </tr>
148
148
  </thead>
149
149
  <tbody>
150
- <% @document.references.each do |entry| %>
150
+ <% @document.distributions.each do |entry| %>
151
151
  <tr>
152
152
  <td><%= entry[0] %></td>
153
153
  <td>
@@ -0,0 +1,23 @@
1
+ <% if ENV["GBL_ADMIN_REFERENCES_MIGRATED"] == "true" %>
2
+ <%- if @document.persisted? %>
3
+ <h3 id="document-distributions"><%= link_to "Distributions", admin_document_document_distributions_url(@document) %></h3>
4
+ <table class="table table-striped table-bordered sortable">
5
+ <thead class="thead-dark">
6
+ <tr>
7
+ <th class="header">Type</th>
8
+ <th class="header">Value</th>
9
+ <th class="header">Label</th>
10
+ </tr>
11
+ </thead>
12
+ <tbody>
13
+ <% @document.document_distributions.each do |document_distribution| %>
14
+ <tr>
15
+ <td><%= document_distribution.reference_type.name %></td>
16
+ <td><%= document_distribution.url %></td>
17
+ <td><%= document_distribution.label %></td>
18
+ </tr>
19
+ <% end %>
20
+ </tbody>
21
+ </table>
22
+ <% end %>
23
+ <% end %>
@@ -1,27 +1,30 @@
1
- <%- if @document.persisted? %>
2
- <h3 id="multiple-download-links"><%= link_to "Multiple Download Links", admin_document_document_downloads_url(@document) %></h3>
3
- <div class="table-responsive">
4
- <table class="table table-striped table-bordered">
5
- <thead>
6
- <tr>
7
- <th colspan="2">Actions</th>
8
- <th>Layer Slug</th>
9
- <th>Download Label</th>
10
- <th>Download URL</th>
11
- </tr>
12
- </thead>
1
+ <% unless ENV["GBL_ADMIN_REFERENCES_MIGRATED"] == "true" %>
2
+ <%= Rails.logger.warn("Deprecation warning: Multiple Download Links will not be supported soon. Use DocumentReferences instead.") %>
3
+ <%- if @document.persisted? %>
4
+ <h3 id="multiple-download-links"><%= link_to "Multiple Download Links", admin_document_document_downloads_url(@document) %></h3>
5
+ <div class="table-responsive">
6
+ <table class="table table-striped table-bordered">
7
+ <thead>
8
+ <tr>
9
+ <th colspan="2">Actions</th>
10
+ <th>Layer Slug</th>
11
+ <th>Download Label</th>
12
+ <th>Download URL</th>
13
+ </tr>
14
+ </thead>
13
15
 
14
- <tbody>
15
- <% @document.document_downloads.each do |document_download| %>
16
- <tr>
17
- <td><%= link_to 'Edit', edit_admin_document_document_download_path(document_download.document, document_download) %></td>
18
- <td><%= link_to 'Destroy', admin_document_document_download_path(document_download.document, document_download), method: :delete, data: { confirm: 'Are you sure?' } %></td>
19
- <td><%= link_to document_download.friendlier_id, admin_document_path(document_download.document) %></td>
20
- <td><%= document_download.label %></td>
21
- <td><%= link_to document_download.value %></td>
22
- </tr>
23
- <% end %>
24
- </tbody>
25
- </table>
26
- </div>
27
- <% end %>
16
+ <tbody>
17
+ <% @document.document_downloads.each do |document_download| %>
18
+ <tr>
19
+ <td><%= link_to 'Edit', edit_admin_document_document_download_path(document_download.document, document_download) %></td>
20
+ <td><%= link_to 'Destroy', admin_document_document_download_path(document_download.document, document_download), method: :delete, data: { confirm: 'Are you sure?' } %></td>
21
+ <td><%= link_to document_download.friendlier_id, admin_document_path(document_download.document) %></td>
22
+ <td><%= document_download.label %></td>
23
+ <td><%= link_to document_download.value %></td>
24
+ </tr>
25
+ <% end %>
26
+ </tbody>
27
+ </table>
28
+ </div>
29
+ <% end %>
30
+ <% end %>
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  json.links do
4
2
  json.self url_for(search_state.to_h.merge(only_path: false))
5
3
  json.prev url_for(search_state.to_h.merge(only_path: false, page: @response.prev_page.to_s)) if @response.prev_page
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  json.links do
4
2
  json.self url_for(search_state.to_h.merge(only_path: false))
5
3
  json.prev url_for(search_state.to_h.merge(only_path: false, page: @response.prev_page.to_s)) if @response.prev_page
@@ -23,5 +23,5 @@
23
23
  </div>
24
24
 
25
25
  <div class="form-actions">
26
- <%= f.button :submit, {class: 'btn btn-primary'} %>
26
+ <%= f.button :submit, "+ Create Import", {class: 'btn btn-primary'} %>
27
27
  </div>
@@ -54,7 +54,7 @@
54
54
  <% if @import.state_machine.current_state == 'mapped' %>
55
55
  <%= form_tag run_admin_import_path(@import), method: :patch do -%>
56
56
  <%= hidden_field_tag :run, true -%>
57
- <%= submit_tag 'Run Import' -%>
57
+ <%= submit_tag '+ Run Import', class: 'btn btn-primary btn-block' -%>
58
58
  <%- end -%>
59
59
  <% end %>
60
60
  <% if @import.state_machine.current_state == 'imported' %>
@@ -20,8 +20,10 @@
20
20
  </head>
21
21
 
22
22
  <body data-locale="en">
23
- <%= render "admin/shared/navbar" %>
24
- <main class="container-fluid">
23
+ <header>
24
+ <%= render "admin/shared/navbar" %>
25
+ </header>
26
+ <main id="gbl-admin" class="container-fluid">
25
27
  <%= render "admin/shared/schema_timestamp" %>
26
28
  <%= render "admin/shared/flash_messages" %>
27
29
  <div id="toast-wrapper" aria-live="polite" aria-atomic="true"></div>
@@ -4,7 +4,7 @@
4
4
  <tbody>
5
5
  <%- if @import.mappings.size > 1 %>
6
6
  <%- @import.mappings.each do |mapping| %>
7
- <%= simple_form_for [@import, mapping], :url => import_mapping_path(@import, mapping) do |f| %>
7
+ <%= simple_form_for [@import, mapping], :url => admin_import_mapping_path(@import, mapping) do |f| %>
8
8
  <tr>
9
9
  <td><%= f.input :source_header, :input_html => {:readonly => true} %></td>
10
10
  <td><%= f.input :destination_field, collection: attribute_collection %></td>
@@ -1,31 +1,32 @@
1
1
  - # Split message "Download Type|Row Count|Button Label"
2
- - message = notification.to_notification.params[:message].split("|")
2
+ - message = notification&.to_notification&.params[:message]&.split("|")
3
3
 
4
- %tr
5
- %td
6
- = check_box_tag 'read', notification.read?, notification.read?,
7
- onchange: "this.setAttribute('data-params', this.name + '=' + this.checked*this.checked)",
8
- data: { remote: true, url: admin_notification_path(notification), method: :patch }
9
- %td
10
- %strong
11
- = message.length > 1 ? message[0] : "CSV"
12
- = t('dictionary.download')
13
- %td
14
- = message.length > 1 ? message[1] : message[0]
15
- %td
16
- - if notification.file.attached?
17
- = link_to rails_blob_path(notification.file.blob, disposition: "attachment"), { class: 'btn btn-primary btn-block' } do
18
- :plain
19
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-cloud-download" viewBox="0 0 16 16">
20
- <path d="M4.406 1.342A5.53 5.53 0 0 1 8 0c2.69 0 4.923 2 5.166 4.579C14.758 4.804 16 6.137 16 7.773 16 9.569 14.502 11 12.687 11H10a.5.5 0 0 1 0-1h2.688C13.979 10 15 8.988 15 7.773c0-1.216-1.02-2.228-2.313-2.228h-.5v-.5C12.188 2.825 10.328 1 8 1a4.53 4.53 0 0 0-2.941 1.1c-.757.652-1.153 1.438-1.153 2.055v.448l-.445.049C2.064 4.805 1 5.952 1 7.318 1 8.785 2.23 10 3.781 10H6a.5.5 0 0 1 0 1H3.781C1.708 11 0 9.366 0 7.318c0-1.763 1.266-3.223 2.942-3.593.143-.863.698-1.723 1.464-2.383z"/>
21
- <path d="M7.646 15.854a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 14.293V5.5a.5.5 0 0 0-1 0v8.793l-2.146-2.147a.5.5 0 0 0-.708.708l3 3z"/>
22
- </svg>
23
- = message.length > 1 ? message[2] : "CSV"
24
- = "(#{number_to_human_size(notification.file.blob.byte_size)})"
25
- - else
26
- = 'N/A'
27
- %td
28
- %span.reldate{:data => {:asked_at => notification.created_at.to_json.gsub('"', '')}}
29
- = notification.created_at
4
+ - if message
5
+ %tr
6
+ %td
7
+ = check_box_tag 'read', notification.read?, notification.read?,
8
+ onchange: "this.setAttribute('data-params', this.name + '=' + this.checked*this.checked)",
9
+ data: { remote: true, url: admin_notification_path(notification), method: :patch }
10
+ %td
11
+ %strong
12
+ = message.length > 1 ? message[0] : "CSV"
13
+ = t('dictionary.download')
14
+ %td
15
+ = message.length > 1 ? message[1] : message[0]
16
+ %td
17
+ - if notification.file.attached?
18
+ = link_to rails_blob_path(notification.file.blob, disposition: "attachment"), { class: 'btn btn-primary btn-block' } do
19
+ :plain
20
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-cloud-download" viewBox="0 0 16 16">
21
+ <path d="M4.406 1.342A5.53 5.53 0 0 1 8 0c2.69 0 4.923 2 5.166 4.579C14.758 4.804 16 6.137 16 7.773 16 9.569 14.502 11 12.687 11H10a.5.5 0 0 1 0-1h2.688C13.979 10 15 8.988 15 7.773c0-1.216-1.02-2.228-2.313-2.228h-.5v-.5C12.188 2.825 10.328 1 8 1a4.53 4.53 0 0 0-2.941 1.1c-.757.652-1.153 1.438-1.153 2.055v.448l-.445.049C2.064 4.805 1 5.952 1 7.318 1 8.785 2.23 10 3.781 10H6a.5.5 0 0 1 0 1H3.781C1.708 11 0 9.366 0 7.318c0-1.763 1.266-3.223 2.942-3.593.143-.863.698-1.723 1.464-2.383z"/>
22
+ <path d="M7.646 15.854a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 14.293V5.5a.5.5 0 0 0-1 0v8.793l-2.146-2.147a.5.5 0 0 0-.708.708l3 3z"/>
23
+ </svg>
24
+ = message.length > 1 ? message[2] : "CSV"
25
+ = "(#{number_to_human_size(notification.file.blob.byte_size)})"
26
+ - else
27
+ = 'N/A'
28
+ %td
29
+ %span.reldate{:data => {:asked_at => notification.created_at.to_json.gsub('"', '')}}
30
+ = notification.created_at
30
31
 
31
- %td= link_to 'Destroy', admin_notification_path(notification), method: :delete
32
+ %td= link_to 'Destroy', admin_notification_path(notification), method: :delete