geoblacklight_admin 0.5.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +18 -9
  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 +1 -1
  10. data/app/controllers/admin/assets_controller.rb +41 -5
  11. data/app/controllers/admin/bookmarks_controller.rb +14 -2
  12. data/app/controllers/admin/bulk_actions_controller.rb +31 -0
  13. data/app/controllers/admin/document_accesses_controller.rb +38 -0
  14. data/app/controllers/admin/document_assets_controller.rb +46 -9
  15. data/app/controllers/admin/document_distributions_controller.rb +172 -0
  16. data/app/controllers/admin/documents_controller.rb +41 -55
  17. data/app/controllers/admin/elements_controller.rb +22 -0
  18. data/app/controllers/admin/form_elements_controller.rb +31 -0
  19. data/app/controllers/admin/import_documents_controller.rb +11 -1
  20. data/app/controllers/admin/imports_controller.rb +32 -2
  21. data/app/controllers/admin/mappings_controller.rb +15 -0
  22. data/app/controllers/admin/notifications_controller.rb +27 -0
  23. data/app/controllers/admin/reference_types_controller.rb +106 -0
  24. data/app/controllers/admin/search_controller.rb +7 -0
  25. data/app/controllers/admin/users_controller.rb +10 -0
  26. data/app/helpers/asset_helper.rb +6 -0
  27. data/app/helpers/bulk_actions_helper.rb +9 -0
  28. data/app/helpers/document_helper.rb +36 -0
  29. data/app/helpers/geoblacklight_admin_helper.rb +88 -8
  30. data/app/helpers/mappings_helper.rb +26 -0
  31. data/app/indexers/document_indexer.rb +22 -2
  32. data/app/javascript/channels/consumer.js +6 -0
  33. data/app/javascript/channels/export_channel.js +30 -0
  34. data/app/javascript/channels/index.js +3 -0
  35. data/app/javascript/controllers/results_controller.js +14 -0
  36. data/app/javascript/index.js +8 -2
  37. data/app/jobs/export_job.rb +35 -8
  38. data/app/jobs/geoblacklight_admin/delete_thumbnail_job.rb +19 -0
  39. data/app/jobs/geoblacklight_admin/remove_parent_dct_references_uri_job.rb +16 -0
  40. data/app/jobs/geoblacklight_admin/set_parent_dct_references_uri_job.rb +17 -0
  41. data/app/jobs/geoblacklight_admin/store_image_job.rb +22 -0
  42. data/app/models/asset.rb +20 -0
  43. data/app/models/bulk_action.rb +2 -1
  44. data/app/models/document/geom_validator.rb +8 -0
  45. data/app/models/document/reference.rb +65 -65
  46. data/app/models/document.rb +128 -71
  47. data/app/models/document_distribution.rb +145 -0
  48. data/app/models/element.rb +2 -0
  49. data/app/models/geoblacklight_admin/schema.rb +10 -2
  50. data/app/models/import_document_state_machine.rb +1 -0
  51. data/app/models/reference_type.rb +40 -0
  52. data/app/models/user.rb +4 -2
  53. data/app/services/export_csv_document_distributions_service.rb +61 -0
  54. data/app/services/geoblacklight_admin/image_service/tms.rb +0 -4
  55. data/app/services/geoblacklight_admin/image_service.rb +1 -1
  56. data/app/services/geoblacklight_admin/item_viewer.rb +4 -4
  57. data/app/views/admin/bulk_actions/show.html.erb +1 -1
  58. data/app/views/admin/document_accesses/import.html.erb +6 -2
  59. data/app/views/admin/document_assets/_assets_table.html.erb +49 -0
  60. data/app/views/admin/document_assets/_form.html.erb +2 -3
  61. data/app/views/admin/document_assets/index.html.erb +1 -47
  62. data/app/views/admin/document_distributions/_document_distribution.html.erb +39 -0
  63. data/app/views/admin/document_distributions/_document_distribution.json.jbuilder +2 -0
  64. data/app/views/admin/document_distributions/_form.html.erb +34 -0
  65. data/app/views/admin/document_distributions/destroy_all.html.erb +82 -0
  66. data/app/views/admin/document_distributions/edit.html.erb +12 -0
  67. data/app/views/admin/document_distributions/import.html.erb +80 -0
  68. data/app/views/admin/document_distributions/index.html.erb +143 -0
  69. data/app/views/admin/document_distributions/index.json.jbuilder +1 -0
  70. data/app/views/admin/document_distributions/new.html.erb +11 -0
  71. data/app/views/admin/document_distributions/show.html.erb +10 -0
  72. data/app/views/admin/document_distributions/show.json.jbuilder +1 -0
  73. data/app/views/admin/documents/_document.html.erb +1 -3
  74. data/app/views/admin/documents/_form.html.erb +2 -4
  75. data/app/views/admin/documents/_form_control.html.erb +5 -2
  76. data/app/views/admin/documents/_form_nav.html.erb +14 -5
  77. data/app/views/admin/documents/_form_nav_kithe.html.erb +4 -1
  78. data/app/views/admin/documents/_json_aardvark.jbuilder +1 -1
  79. data/app/views/admin/documents/_json_gbl_v1.jbuilder +1 -1
  80. data/app/views/admin/documents/_result_selected_options.html.erb +5 -2
  81. data/app/views/admin/documents/admin.html.erb +5 -5
  82. data/app/views/admin/documents/features/_document_references.html.erb +23 -0
  83. data/app/views/admin/documents/features/_multiple_download_links.html.erb +29 -26
  84. data/app/views/admin/ids/fetch.json.jbuilder +0 -2
  85. data/app/views/admin/ids/index.json.jbuilder +0 -2
  86. data/app/views/admin/imports/_form.html.erb +1 -1
  87. data/app/views/admin/imports/show.html.erb +1 -1
  88. data/app/views/admin/layouts/application.html.erb +4 -2
  89. data/app/views/admin/reference_types/_form.html.erb +25 -0
  90. data/app/views/admin/reference_types/_reference_type.html.erb +52 -0
  91. data/app/views/admin/reference_types/_reference_type.json.jbuilder +2 -0
  92. data/app/views/admin/reference_types/edit.html.erb +12 -0
  93. data/app/views/admin/reference_types/index.html.erb +52 -0
  94. data/app/views/admin/reference_types/index.json.jbuilder +1 -0
  95. data/app/views/admin/reference_types/new.html.erb +11 -0
  96. data/app/views/admin/reference_types/show.html.erb +3 -0
  97. data/app/views/admin/reference_types/show.json.jbuilder +1 -0
  98. data/app/views/admin/shared/_footer.html.erb +5 -2
  99. data/app/views/admin/shared/_js_behaviors.html.erb +2 -3
  100. data/app/views/admin/shared/_navbar.html.erb +9 -2
  101. data/app/views/admin/users/index.html.erb +0 -1
  102. data/app/views/catalog/_show_gbl_admin.html.erb +1 -1
  103. data/config/initializers/defaults.yml +310 -0
  104. data/config/initializers/rails_config.rb +8 -0
  105. data/config/locales/documents.en.yml +14 -0
  106. data/config/routes.rb +30 -5
  107. data/db/import_references_schema_support.numbers +0 -0
  108. data/db/migrate/20230316183001_add_geoblacklight_admin_gem.rb +0 -12
  109. data/db/migrate/20241009200524_create_admin_reference_types.rb +13 -0
  110. data/db/migrate/20241010161420_create_document_references.rb +14 -0
  111. data/db/migrate/20241120238823_rename_references_to_distributions.rb +5 -0
  112. data/db/seeds.rb +5 -0
  113. data/db/seeds_elements.csv +1 -1
  114. data/db/seeds_elements.numbers +0 -0
  115. data/db/seeds_reference_types.csv +29 -0
  116. data/db/seeds_reference_types.numbers +0 -0
  117. data/db/structure.sql +1 -38
  118. data/lib/compose.yml +31 -0
  119. data/lib/generators/geoblacklight_admin/config_generator.rb +48 -12
  120. data/lib/generators/geoblacklight_admin/install_generator.rb +8 -0
  121. data/lib/generators/geoblacklight_admin/templates/config/database.yml +1 -1
  122. data/lib/generators/geoblacklight_admin/templates/config/initializers/devise.rb +0 -2
  123. data/lib/generators/geoblacklight_admin/templates/config/initializers/mime_types.rb +1 -0
  124. data/lib/generators/geoblacklight_admin/templates/demo-app/Dockerfile +31 -0
  125. data/lib/generators/geoblacklight_admin/templates/demo-app/compose.yml +42 -0
  126. data/lib/generators/geoblacklight_admin/templates/demo-app/start-server.sh +21 -0
  127. data/lib/geoblacklight_admin/engine.rb +4 -0
  128. data/lib/geoblacklight_admin/tasks/distributions.rake +69 -0
  129. data/lib/geoblacklight_admin/tasks/images.rake +1 -0
  130. data/lib/geoblacklight_admin/tasks/solr.rake +31 -0
  131. data/lib/geoblacklight_admin/version.rb +1 -1
  132. data/lib/geoblacklight_admin.rb +4 -0
  133. metadata +78 -41
  134. data/app/javascript/entrypoints/engine.js +0 -8
  135. data/config/locales/devise_invitable.en.yml +0 -31
  136. data/lib/generators/geoblacklight_admin/templates/devise/invitations/edit.html.erb +0 -15
  137. data/lib/generators/geoblacklight_admin/templates/devise/invitations/new.html.erb +0 -15
  138. data/lib/generators/geoblacklight_admin/templates/devise/mailer/invitation_instructions.html.erb +0 -11
  139. data/lib/generators/geoblacklight_admin/templates/devise/mailer/invitation_instructions.text.erb +0 -11
@@ -0,0 +1,82 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <h1 style="width:100%; border-bottom:dotted;" class="mb-4">
4
+ Document &middot; Destroy Distributions
5
+ <% if params[:document_id] %>
6
+ <%= link_to '+ New Distribution', new_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'>Destroy Multiple Distributions</h2>
16
+ <% end %>
17
+
18
+ <p class="alert alert-danger" role="alert">
19
+ <strong>Warning:</strong> All matching Distributions will be destroyed. There is <strong>NO UNDO</strong> here.
20
+ </p>
21
+ <h3 class='h4'>Upload a CSV File</h3>
22
+
23
+ <%= simple_form_for DocumentDistribution.new, url: destroy_all_admin_document_distributions_path, method: :post, multipart: true do |f| %>
24
+ <div class="form-group">
25
+ <div class="form-inputs">
26
+ <%= f.simple_fields_for :distributions do |distribution_fields| %>
27
+ <%= reference_fields.input :file, as: :file, input_html: {} %>
28
+ <%- end %>
29
+ </div>
30
+
31
+ <div class="form-actions">
32
+ <%= submit_tag "- Destroy All", {class: 'btn btn-danger'} %>
33
+ </div>
34
+ </div>
35
+ <% end %>
36
+ </div>
37
+ <div class="col-8">
38
+ <h4>Example CSV File</h4>
39
+ <table class="table table-bordered">
40
+ <thead>
41
+ <tr>
42
+ <th>friendlier_id</th>
43
+ <th>reference_type</th>
44
+ <th>distribution_url</th>
45
+ <th>label</th>
46
+ </tr>
47
+ </thead>
48
+ <tbody>
49
+ <tr>
50
+ <td>00add5b8-a7b1-42d4-b4de-ca99716a5096</td>
51
+ <td>download</td>
52
+ <td>https://s3.amazonaws.com/holc/tiles/WI/Madison/1937/rectified.zip</td>
53
+ <td>GeoTIFF</td>
54
+ </tr>
55
+ <tr>
56
+ <td>00add5b8-a7b1-42d4-b4de-ca99716a5096</td>
57
+ <td>download</td>
58
+ <td>https://s3.amazonaws.com/holc/tiles/WI/Madison/1937/holc-scan.jpg</td>
59
+ <td>JPEG</td>
60
+ </tr>
61
+ <tr>
62
+ <td>...</td>
63
+ <td>...</td>
64
+ <td>...</td>
65
+ <td>...</td>
66
+ </tr>
67
+ </tbody>
68
+ </table>
69
+
70
+ <h5>CSV File Column Definitions</h5>
71
+ <dl>
72
+ <dt>friendlier_id</dt>
73
+ <dd>The associated document's friendlier id</dd>
74
+ <dt>reference_type</dt>
75
+ <dd>The name of the reference type</dd>
76
+ <dt>distribution_url</dt>
77
+ <dd>The URL for the distribution</dd>
78
+ <dt>label</dt>
79
+ <dd>The label for the distribution, if the reference type is labeled</dd>
80
+ </dl>
81
+ </div>
82
+ </div>
@@ -0,0 +1,12 @@
1
+ <% content_for :title, "Editing document distribution" %>
2
+
3
+ <h1>Editing document distribution</h1>
4
+
5
+ <%= render "form", document_distribution: @document_distribution %>
6
+
7
+ <br>
8
+
9
+ <div>
10
+ <%= link_to "Show this document distribution", admin_document_document_distribution_path(@document, @document_distribution) %> |
11
+ <%= link_to "Back to document distributions", admin_document_document_distributions_path(@document) %>
12
+ </div>
@@ -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' %>