blacklight-spotlight 2.6.1.1 → 2.9.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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/spotlight/admin/add_another.js +22 -0
- data/app/assets/javascripts/spotlight/{add_new_page_button.js → admin/add_new_page_button.js} +0 -0
- data/app/assets/javascripts/spotlight/{appearance.js → admin/appearance.js} +0 -0
- data/app/assets/javascripts/spotlight/{attachments.js → admin/attachments.js} +0 -0
- data/app/assets/javascripts/spotlight/{blacklight_configuration.js → admin/blacklight_configuration.js} +0 -0
- data/app/assets/javascripts/spotlight/{block_mixins → admin/block_mixins}/autocompleteable.js +0 -0
- data/app/assets/javascripts/spotlight/{block_mixins → admin/block_mixins}/formable.js +0 -0
- data/app/assets/javascripts/spotlight/{block_mixins → admin/block_mixins}/plustextable.js +0 -0
- data/app/assets/javascripts/spotlight/{blocks → admin/blocks}/block.js +0 -0
- data/app/assets/javascripts/spotlight/{blocks → admin/blocks}/browse_block.js +1 -1
- data/app/assets/javascripts/spotlight/{blocks → admin/blocks}/iframe_block.js +0 -0
- data/app/assets/javascripts/spotlight/{blocks → admin/blocks}/link_to_search_block.js +1 -1
- data/app/assets/javascripts/spotlight/{blocks → admin/blocks}/oembed_block.js +0 -0
- data/app/assets/javascripts/spotlight/{blocks → admin/blocks}/pages_block.js +1 -1
- data/app/assets/javascripts/spotlight/{blocks → admin/blocks}/resources_block.js +0 -0
- data/app/assets/javascripts/spotlight/{blocks → admin/blocks}/rule_block.js +0 -0
- data/app/assets/javascripts/spotlight/{blocks → admin/blocks}/search_result_block.js +3 -3
- data/app/assets/javascripts/spotlight/{blocks → admin/blocks}/solr_documents_base_block.js +3 -3
- data/app/assets/javascripts/spotlight/{blocks → admin/blocks}/solr_documents_block.js +1 -1
- data/app/assets/javascripts/spotlight/{blocks → admin/blocks}/solr_documents_carousel_block.js +1 -1
- data/app/assets/javascripts/spotlight/{blocks → admin/blocks}/solr_documents_embed_block.js +1 -1
- data/app/assets/javascripts/spotlight/{blocks → admin/blocks}/solr_documents_features_block.js +2 -2
- data/app/assets/javascripts/spotlight/{blocks → admin/blocks}/solr_documents_grid_block.js +1 -1
- data/app/assets/javascripts/spotlight/{blocks → admin/blocks}/uploaded_items_block.js +0 -0
- data/app/assets/javascripts/spotlight/{catalog_edit.js → admin/catalog_edit.js} +0 -0
- data/app/assets/javascripts/spotlight/{copy_email_addresses.js → admin/copy_email_addresses.js} +0 -0
- data/app/assets/javascripts/spotlight/{crop.es6 → admin/crop.es6} +5 -0
- data/app/assets/javascripts/spotlight/{croppable.js → admin/croppable.js} +1 -1
- data/app/assets/javascripts/spotlight/{edit_in_place.js → admin/edit_in_place.js} +0 -0
- data/app/assets/javascripts/spotlight/{exhibits.js → admin/exhibits.js} +0 -0
- data/app/assets/javascripts/spotlight/{form_observer.js → admin/form_observer.js} +0 -0
- data/app/assets/javascripts/spotlight/{iiif.es6 → admin/iiif.es6} +0 -0
- data/app/assets/javascripts/spotlight/admin/index.js +18 -0
- data/app/assets/javascripts/spotlight/{locks.js → admin/locks.js} +0 -0
- data/app/assets/javascripts/spotlight/{multi_image_selector.js → admin/multi_image_selector.js} +0 -0
- data/app/assets/javascripts/spotlight/{pages.js.erb → admin/pages.js.erb} +0 -2
- data/app/assets/javascripts/spotlight/{readonly_checkbox.js → admin/readonly_checkbox.js} +0 -0
- data/app/assets/javascripts/spotlight/{reindex_monitor.js → admin/reindex_monitor.js} +0 -0
- data/app/assets/javascripts/spotlight/{search_typeahead.js → admin/search_typeahead.js} +1 -1
- data/app/assets/javascripts/spotlight/{select_related_input.js → admin/select_related_input.js} +0 -0
- data/app/assets/javascripts/spotlight/{sir-trevor → admin/sir-trevor}/block_controls.js +0 -0
- data/app/assets/javascripts/spotlight/{sir-trevor → admin/sir-trevor}/block_limits.js +0 -0
- data/app/assets/javascripts/spotlight/{sir-trevor → admin/sir-trevor}/locales.js +0 -0
- data/app/assets/javascripts/spotlight/{spotlight_nestable.js → admin/spotlight_nestable.js} +0 -0
- data/app/assets/javascripts/spotlight/{tabs.js → admin/tabs.js} +0 -0
- data/app/assets/javascripts/spotlight/{translation_progress.js → admin/translation_progress.js} +0 -0
- data/app/assets/javascripts/spotlight/{users.js → admin/users.js} +0 -0
- data/app/assets/javascripts/spotlight/application.js +2 -22
- data/app/assets/javascripts/spotlight/{analytics.js → user/analytics.js} +0 -0
- data/app/assets/javascripts/spotlight/user/carousel.js +3 -0
- data/app/assets/javascripts/spotlight/{clear_form_button.js → user/clear_form_button.js} +0 -0
- data/app/assets/javascripts/spotlight/user/index.js +6 -0
- data/app/assets/javascripts/spotlight/{report_a_problem.js → user/report_a_problem.js} +0 -0
- data/app/assets/javascripts/spotlight/{zpr_links.js.erb → user/zpr_links.js.erb} +0 -0
- data/app/controllers/spotlight/catalog_controller.rb +1 -1
- data/app/controllers/spotlight/custom_fields_controller.rb +1 -1
- data/app/controllers/spotlight/pages_controller.rb +1 -1
- data/app/controllers/spotlight/resources/csv_upload_controller.rb +1 -1
- data/app/controllers/spotlight/resources/upload_controller.rb +17 -13
- data/app/controllers/spotlight/resources_controller.rb +5 -0
- data/app/controllers/spotlight/searches_controller.rb +0 -2
- data/app/controllers/spotlight/solr_controller.rb +18 -1
- data/app/helpers/spotlight/application_helper.rb +4 -1
- data/app/helpers/spotlight/pages_helper.rb +10 -0
- data/app/jobs/spotlight/add_uploads_from_csv.rb +1 -1
- data/app/jobs/spotlight/rename_sidecar_field_job.rb +21 -7
- data/app/models/concerns/spotlight/custom_translation_extension.rb +2 -0
- data/app/models/sir_trevor_rails/blocks/featured_pages_block.rb +10 -3
- data/app/models/spotlight/blacklight_configuration.rb +5 -3
- data/app/models/spotlight/custom_field.rb +20 -20
- data/app/models/spotlight/exhibit.rb +11 -1
- data/app/models/spotlight/page.rb +11 -4
- data/app/models/spotlight/page_content.rb +18 -0
- data/app/models/spotlight/page_content/sir_trevor.rb +17 -0
- data/app/models/spotlight/solr_document_sidecar.rb +3 -0
- data/app/presenters/spotlight/iiif_manifest_presenter.rb +2 -2
- data/app/serializers/spotlight/exhibit_export_serializer.rb +5 -1
- data/app/services/spotlight/solr_document_builder.rb +1 -1
- data/app/services/spotlight/upload_solr_document_builder.rb +10 -3
- data/app/values/custom_field_name.rb +6 -6
- data/app/views/spotlight/catalog/_edit_sidecar.html.erb +9 -14
- data/app/views/spotlight/custom_fields/_form.html.erb +7 -2
- data/app/views/spotlight/custom_fields/form_group/_text.html.erb +14 -0
- data/app/views/spotlight/custom_fields/form_group/_vocab.html.erb +14 -0
- data/app/views/spotlight/pages/_form.html.erb +1 -1
- data/app/views/spotlight/resources/new.html.erb +9 -3
- data/app/views/spotlight/resources/upload/_form.html.erb +3 -1
- data/config/i18n-tasks.yml +1 -0
- data/config/locales/spotlight.ar.yml +40 -0
- data/config/locales/spotlight.en.yml +5 -0
- data/config/locales/spotlight.fr.yml +40 -0
- data/db/migrate/20190807085432_add_content_type_to_pages.rb +5 -0
- data/db/migrate/20190813085432_add_is_multiple_to_custom_fields.rb +7 -0
- data/lib/spotlight/engine.rb +8 -1
- data/lib/spotlight/version.rb +1 -1
- data/spec/controllers/spotlight/catalog_controller_spec.rb +6 -0
- data/spec/controllers/spotlight/resources/csv_upload_controller_spec.rb +1 -1
- data/spec/controllers/spotlight/resources/upload_controller_spec.rb +9 -1
- data/spec/controllers/spotlight/solr_controller_spec.rb +16 -0
- data/spec/examples.txt +1335 -1319
- data/spec/factories/pages.rb +6 -0
- data/spec/features/add_custom_field_metadata_spec.rb +19 -1
- data/spec/features/add_items_spec.rb +19 -2
- data/spec/features/exhibits/custom_metadata_fields_spec.rb +23 -0
- data/spec/features/exhibits/translation_editing_spec.rb +8 -0
- data/spec/features/javascript/locale_selector_spec.rb +6 -0
- data/spec/fixtures/sample_solr_documents.yml +110 -110
- data/spec/helpers/spotlight/pages_helper_spec.rb +14 -0
- data/spec/jobs/spotlight/add_uploads_from_csv_spec.rb +4 -2
- data/spec/models/spotlight/blacklight_configuration_spec.rb +2 -2
- data/spec/models/spotlight/custom_field_spec.rb +8 -3
- data/spec/models/spotlight/custom_translation_extension_spec.rb +23 -0
- data/spec/models/spotlight/page_spec.rb +45 -0
- data/spec/services/spotlight/solr_document_builder_spec.rb +9 -0
- data/spec/spec_helper.rb +14 -16
- data/spec/test_app_templates/Gemfile.extra +0 -1
- metadata +80 -52
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8445fcedab2b6c93ecc559cb0ecc02c1c0d6e42c987d7467a7b17b1a04c86456
|
|
4
|
+
data.tar.gz: 63e9bc33643a7db25d6b3e875c3dae7374085389c42224bfb71572a8e7995221
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0e7ecb7302c87a9006ffcd74aa4c2b3da56d17cded2cfd90f2803c9582fa11cb35385ad9edfbabee44bed698acb7191ee2dd22f48e19034c106d7bfa447071e7
|
|
7
|
+
data.tar.gz: 9417a9864e63890323ace42f0b5d1b8f1d63449b2d437f22d47df9f4d882e7037713aa097910b24fd58a80b20b4939a4d39c4b2aee2c2a3d77b3329bbfa90dfd
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Spotlight.onLoad(function() {
|
|
2
|
+
$("[data-action='add-another']").on("click", function(event) {
|
|
3
|
+
event.preventDefault();
|
|
4
|
+
|
|
5
|
+
var templateId = $(this).data('template-id');
|
|
6
|
+
|
|
7
|
+
var template = document.querySelector('#' + templateId);
|
|
8
|
+
var clone = document.importNode(template.content, true);
|
|
9
|
+
|
|
10
|
+
var count = $(this).closest('.form-group').find('[name="' + $(clone).find('[name]').attr('name') + '"]').length + 1;
|
|
11
|
+
$(clone).find('[id]').each(function(index, el) {
|
|
12
|
+
$(el).attr('id', $(el).attr('id') + '_' + String(count));
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
$(clone).find('[for]').each(function(index, el) {
|
|
16
|
+
$(el).attr('for', $(el).attr('for') + '_' + String(count));
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
$(clone).insertBefore(this);
|
|
21
|
+
});
|
|
22
|
+
});
|
data/app/assets/javascripts/spotlight/{add_new_page_button.js → admin/add_new_page_button.js}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/app/assets/javascripts/spotlight/{block_mixins → admin/block_mixins}/autocompleteable.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//= require spotlight/blocks/browse_block
|
|
1
|
+
//= require spotlight/admin/blocks/browse_block
|
|
2
2
|
|
|
3
3
|
SirTrevor.Blocks.SearchResults = (function(){
|
|
4
4
|
|
|
@@ -15,7 +15,7 @@ SirTrevor.Blocks.SearchResults = (function(){
|
|
|
15
15
|
content: function() {
|
|
16
16
|
return _.template([this.items_selector()].join("<hr />\n"))(this);
|
|
17
17
|
},
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
item_options: function() {
|
|
20
20
|
var block = this;
|
|
21
21
|
var fields = $('[data-blacklight-configuration-search-views]').data('blacklight-configuration-search-views');
|
|
@@ -41,4 +41,4 @@ SirTrevor.Blocks.SearchResults = (function(){
|
|
|
41
41
|
},
|
|
42
42
|
|
|
43
43
|
});
|
|
44
|
-
})();
|
|
44
|
+
})();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//= require spotlight/blocks/resources_block
|
|
1
|
+
//= require spotlight/admin/blocks/resources_block
|
|
2
2
|
|
|
3
3
|
SirTrevor.Blocks.SolrDocumentsBase = (function(){
|
|
4
4
|
|
|
@@ -77,7 +77,7 @@ SirTrevor.Blocks.SolrDocumentsBase = (function(){
|
|
|
77
77
|
var manifestUrl = data.iiif_manifest || data.iiif_manifest_url;
|
|
78
78
|
|
|
79
79
|
if (!manifestUrl) {
|
|
80
|
-
$(panel).find('[name$="[thumbnail_image_url]"]').val(data.thumbnail);
|
|
80
|
+
$(panel).find('[name$="[thumbnail_image_url]"]').val(data.thumbnail_image_url || data.thumbnail);
|
|
81
81
|
$(panel).find('[name$="[full_image_url]"]').val(data.full_image_url);
|
|
82
82
|
|
|
83
83
|
return;
|
|
@@ -85,7 +85,7 @@ SirTrevor.Blocks.SolrDocumentsBase = (function(){
|
|
|
85
85
|
|
|
86
86
|
$.ajax(manifestUrl).success(
|
|
87
87
|
function(manifest) {
|
|
88
|
-
var Iiif = require('spotlight/iiif');
|
|
88
|
+
var Iiif = require('spotlight/admin/iiif');
|
|
89
89
|
var iiifManifest = new Iiif(manifestUrl, manifest);
|
|
90
90
|
|
|
91
91
|
var thumbs = iiifManifest.imagesArray();
|
data/app/assets/javascripts/spotlight/{blocks → admin/blocks}/solr_documents_features_block.js
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//= require spotlight/blocks/solr_documents_base_block
|
|
1
|
+
//= require spotlight/admin/blocks/solr_documents_base_block
|
|
2
2
|
|
|
3
3
|
SirTrevor.Blocks.SolrDocumentsFeatures = (function(){
|
|
4
4
|
|
|
@@ -7,7 +7,7 @@ SirTrevor.Blocks.SolrDocumentsFeatures = (function(){
|
|
|
7
7
|
type: "solr_documents_features",
|
|
8
8
|
|
|
9
9
|
icon_name: "item_features",
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
afterPreviewLoad: function(options) {
|
|
12
12
|
$(this.inner).find('.carousel').carousel();
|
|
13
13
|
|
|
File without changes
|
|
File without changes
|
data/app/assets/javascripts/spotlight/{copy_email_addresses.js → admin/copy_email_addresses.js}
RENAMED
|
File without changes
|
|
@@ -245,6 +245,8 @@ export default class Crop {
|
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
uploadFile() {
|
|
248
|
+
// Set a ujs adapter to support both rails-ujs and jquery-ujs
|
|
249
|
+
var ujs = typeof Rails === 'undefined' ? $.rails : Rails;
|
|
248
250
|
var url = this.fileInput.data('endpoint')
|
|
249
251
|
// Every post creates a new image/masthead.
|
|
250
252
|
// Because they create IIIF urls which are heavily cached.
|
|
@@ -255,6 +257,9 @@ export default class Crop {
|
|
|
255
257
|
// error: errorHandler,
|
|
256
258
|
// Form data
|
|
257
259
|
data: this.getData(),
|
|
260
|
+
headers: {
|
|
261
|
+
'X-CSRF-Token': ujs.csrfToken() || ''
|
|
262
|
+
},
|
|
258
263
|
//Options to tell jQuery not to process data or worry about content-type.
|
|
259
264
|
cache: false,
|
|
260
265
|
contentType: false,
|
|
@@ -12,7 +12,7 @@ Spotlight.onLoad(function() {
|
|
|
12
12
|
$.fn.croppable = function() {
|
|
13
13
|
var croppables = this;
|
|
14
14
|
|
|
15
|
-
var Crop = require('spotlight/crop');
|
|
15
|
+
var Crop = require('spotlight/admin/crop');
|
|
16
16
|
$(croppables).each(function() {
|
|
17
17
|
var cropElement = $(this);
|
|
18
18
|
var c = new Crop(cropElement);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//= require underscore
|
|
2
|
+
//= require eventable
|
|
3
|
+
//= require sir-trevor
|
|
4
|
+
//= require nestable
|
|
5
|
+
//= require parameterize
|
|
6
|
+
//= require bootstrap-tagsinput
|
|
7
|
+
//= require jquery.serializejson
|
|
8
|
+
//= require clipboard
|
|
9
|
+
//= require leaflet
|
|
10
|
+
//= require leaflet-iiif
|
|
11
|
+
//= require Leaflet.Editable
|
|
12
|
+
//= require Path.Drag
|
|
13
|
+
//= require MutationObserver
|
|
14
|
+
|
|
15
|
+
// Provide AMD module support
|
|
16
|
+
//= require almond
|
|
17
|
+
//= require polyfill.min.js
|
|
18
|
+
//= require_tree .
|
|
File without changes
|
data/app/assets/javascripts/spotlight/{multi_image_selector.js → admin/multi_image_selector.js}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -73,7 +73,7 @@ function addImageSelector(input, panel, manifestUrl, initialize) {
|
|
|
73
73
|
var cropper = input.data('iiifCropper');
|
|
74
74
|
$.ajax(manifestUrl).success(
|
|
75
75
|
function(manifest) {
|
|
76
|
-
var Iiif = require('spotlight/iiif');
|
|
76
|
+
var Iiif = require('spotlight/admin/iiif');
|
|
77
77
|
var iiifManifest = new Iiif(manifestUrl, manifest);
|
|
78
78
|
|
|
79
79
|
var thumbs = iiifManifest.imagesArray();
|
data/app/assets/javascripts/spotlight/{select_related_input.js → admin/select_related_input.js}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/app/assets/javascripts/spotlight/{translation_progress.js → admin/translation_progress.js}
RENAMED
|
File without changes
|
|
File without changes
|
|
@@ -10,25 +10,5 @@
|
|
|
10
10
|
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
|
11
11
|
// about supported directives.
|
|
12
12
|
//
|
|
13
|
-
//= require
|
|
14
|
-
//= require
|
|
15
|
-
//= require sir-trevor
|
|
16
|
-
//= require nestable
|
|
17
|
-
//= require parameterize
|
|
18
|
-
//= require spotlight/spotlight
|
|
19
|
-
//= require bootstrap/tab
|
|
20
|
-
//= require bootstrap/tooltip
|
|
21
|
-
//= require bootstrap/popover
|
|
22
|
-
//= require bootstrap/carousel
|
|
23
|
-
//= require bootstrap-tagsinput
|
|
24
|
-
//= require jquery.serializejson
|
|
25
|
-
//= require clipboard
|
|
26
|
-
//= require leaflet
|
|
27
|
-
//= require leaflet-iiif
|
|
28
|
-
//= require Leaflet.Editable
|
|
29
|
-
//= require Path.Drag
|
|
30
|
-
//= require MutationObserver
|
|
31
|
-
// Provide AMD module support
|
|
32
|
-
//= require almond
|
|
33
|
-
//= require polyfill.min.js
|
|
34
|
-
//= require_tree .
|
|
13
|
+
//= require spotlight/user/index
|
|
14
|
+
//= require spotlight/admin/index
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -18,7 +18,7 @@ module Spotlight
|
|
|
18
18
|
csv = CSV.parse(csv_io_param, headers: true, return_headers: false).map(&:to_hash)
|
|
19
19
|
Spotlight::AddUploadsFromCSV.perform_later(csv, current_exhibit, current_user)
|
|
20
20
|
flash[:notice] = t('spotlight.resources.upload.csv.success', file_name: csv_io_name)
|
|
21
|
-
|
|
21
|
+
redirect_to spotlight.admin_exhibit_catalog_path(current_exhibit)
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def template
|
|
@@ -9,35 +9,38 @@ module Spotlight
|
|
|
9
9
|
helper :all
|
|
10
10
|
|
|
11
11
|
before_action :authenticate_user!
|
|
12
|
+
before_action :set_tab, only: [:new, :create]
|
|
12
13
|
|
|
13
14
|
load_and_authorize_resource :exhibit, class: Spotlight::Exhibit
|
|
14
15
|
before_action :build_resource
|
|
15
16
|
|
|
16
17
|
load_and_authorize_resource class: 'Spotlight::Resources::Upload', through_association: 'exhibit.resources', instance_name: 'resource'
|
|
17
18
|
|
|
18
|
-
# rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
|
19
19
|
def create
|
|
20
|
-
@resource.attributes = resource_params
|
|
21
|
-
@resource.build_upload(image: params[:resources_upload][:url])
|
|
22
|
-
|
|
23
20
|
if @resource.save_and_index
|
|
24
21
|
flash[:notice] = t('spotlight.resources.upload.success')
|
|
25
|
-
if params['add-and-continue']
|
|
26
|
-
redirect_to new_exhibit_resource_path(@resource.exhibit, anchor: :new_resources_upload)
|
|
27
|
-
else
|
|
28
|
-
redirect_to admin_exhibit_catalog_path(@resource.exhibit, sort: :timestamp)
|
|
29
|
-
end
|
|
22
|
+
return redirect_to new_exhibit_resource_path(@resource.exhibit, tab: :upload) if params['add-and-continue']
|
|
30
23
|
else
|
|
31
24
|
flash[:error] = t('spotlight.resources.upload.error')
|
|
32
|
-
redirect_to admin_exhibit_catalog_path(@resource.exhibit, sort: :timestamp)
|
|
33
25
|
end
|
|
26
|
+
|
|
27
|
+
redirect_to admin_exhibit_catalog_path(@resource.exhibit, sort: :timestamp)
|
|
34
28
|
end
|
|
35
|
-
# rubocop:enable Metrics/MethodLength, Metrics/AbcSize
|
|
36
29
|
|
|
37
30
|
private
|
|
38
31
|
|
|
32
|
+
def set_tab
|
|
33
|
+
@tab = params[:tab] || 'external_resources_form'
|
|
34
|
+
end
|
|
35
|
+
|
|
39
36
|
def build_resource
|
|
40
|
-
@resource ||=
|
|
37
|
+
@resource ||= begin
|
|
38
|
+
resource = Spotlight::Resources::Upload.new exhibit: current_exhibit
|
|
39
|
+
resource.attributes = resource_params
|
|
40
|
+
resource.build_upload(image: params[:resources_upload][:url]) if params[:resources_upload][:url]
|
|
41
|
+
|
|
42
|
+
resource
|
|
43
|
+
end
|
|
41
44
|
end
|
|
42
45
|
|
|
43
46
|
def resource_params
|
|
@@ -45,7 +48,8 @@ module Spotlight
|
|
|
45
48
|
end
|
|
46
49
|
|
|
47
50
|
def data_param_keys
|
|
48
|
-
Spotlight::Resources::Upload.fields(current_exhibit).map(&:field_name) +
|
|
51
|
+
Spotlight::Resources::Upload.fields(current_exhibit).map(&:field_name) +
|
|
52
|
+
current_exhibit.custom_fields.as_strong_params
|
|
49
53
|
end
|
|
50
54
|
end
|
|
51
55
|
end
|
|
@@ -5,6 +5,7 @@ module Spotlight
|
|
|
5
5
|
# CRUD actions for exhibit resources
|
|
6
6
|
class ResourcesController < Spotlight::ApplicationController
|
|
7
7
|
before_action :authenticate_user!, except: [:show]
|
|
8
|
+
before_action :set_tab, only: [:new, :create]
|
|
8
9
|
|
|
9
10
|
load_and_authorize_resource :exhibit, class: Spotlight::Exhibit
|
|
10
11
|
|
|
@@ -44,6 +45,10 @@ module Spotlight
|
|
|
44
45
|
|
|
45
46
|
protected
|
|
46
47
|
|
|
48
|
+
def set_tab
|
|
49
|
+
@tab = params[:tab] || 'external_resources_form'
|
|
50
|
+
end
|
|
51
|
+
|
|
47
52
|
def resource_class
|
|
48
53
|
Spotlight::Resource
|
|
49
54
|
end
|