blacklight-spotlight 1.4.1 → 1.5.1
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/Rakefile +5 -1
- data/app/assets/javascripts/spotlight/blocks/resources_block.js +3 -2
- data/app/assets/javascripts/spotlight/crop.es6 +2 -0
- data/app/assets/javascripts/spotlight/multi_image_selector.js +5 -4
- data/app/assets/javascripts/spotlight/reindex_monitor.js +16 -3
- data/app/controllers/concerns/spotlight/controller.rb +6 -1
- data/app/controllers/spotlight/browse_controller.rb +27 -0
- data/app/controllers/spotlight/catalog_controller.rb +2 -2
- data/app/helpers/spotlight/browse_helper.rb +0 -29
- data/app/helpers/spotlight/title_helper.rb +2 -2
- data/app/models/concerns/spotlight/custom_translation_extension.rb +23 -0
- data/app/models/concerns/spotlight/solr_document/atomic_updates.rb +4 -2
- data/app/models/spotlight/blacklight_configuration.rb +2 -2
- data/app/models/spotlight/exhibit.rb +1 -1
- data/app/views/layouts/spotlight/spotlight.html.erb +1 -0
- data/app/views/spotlight/dashboards/_analytics.html.erb +4 -4
- data/app/views/spotlight/search_configurations/_search_fields.html.erb +1 -1
- data/db/migrate/20180306142612_create_translations.rb +18 -0
- data/lib/generators/spotlight/install_generator.rb +4 -0
- data/lib/generators/spotlight/templates/config/initializers/translation.rb +17 -0
- data/lib/spotlight/engine.rb +1 -0
- data/lib/spotlight/version.rb +1 -1
- data/spec/controllers/spotlight/browse_controller_spec.rb +32 -0
- data/spec/controllers/spotlight/confirmations_controller_spec.rb +1 -1
- data/spec/controllers/spotlight/filters_controller_spec.rb +0 -1
- data/spec/controllers/spotlight/roles_controller_spec.rb +17 -0
- data/spec/controllers/spotlight/tags_controller_spec.rb +6 -1
- data/spec/examples.txt +1280 -1167
- data/spec/factories/translation.rb +6 -0
- data/spec/features/add_iiif_manifest_spec.rb +2 -0
- data/spec/features/browse_category_spec.rb +28 -0
- data/spec/features/edit_search_fields_spec.rb +1 -2
- data/spec/features/exhibit_masthead_spec.rb +2 -2
- data/spec/features/exhibit_themes_spec.rb +1 -1
- data/spec/features/exhibits/add_tags_spec.rb +1 -1
- data/spec/features/item_admin_spec.rb +1 -1
- data/spec/features/javascript/blocks/solr_documents_block_spec.rb +41 -28
- data/spec/features/javascript/multi_image_select_spec.rb +1 -1
- data/spec/features/javascript/reindex_monitor_spec.rb +1 -1
- data/spec/features/javascript/search_config_admin_spec.rb +16 -29
- data/spec/features/site_masthead_spec.rb +1 -1
- data/spec/features/slideshow_spec.rb +1 -2
- data/spec/features/translation_scope_spec.rb +24 -0
- data/spec/models/spotlight/ability_spec.rb +7 -10
- data/spec/models/spotlight/contact_email_spec.rb +1 -1
- data/spec/models/spotlight/contact_form_spec.rb +1 -1
- data/spec/models/spotlight/resources/iiif_harvester_spec.rb +3 -0
- data/spec/models/spotlight/solr_document/atomic_updates_spec.rb +2 -2
- data/spec/spec_helper.rb +12 -4
- data/spec/support/disable_friendly_id_deprecation_warnings.rb +8 -0
- data/spec/support/features/capybara_default_max_wait_metadata_helper.rb +16 -0
- data/spec/support/features/test_features_helpers.rb +12 -2
- data/spec/views/spotlight/browse/show.html.erb_spec.rb +0 -7
- data/spec/views/spotlight/roles/index.html.erb_spec.rb +2 -0
- data/spec/views/spotlight/tags/index.html.erb_spec.rb +1 -0
- data/vendor/assets/javascripts/Leaflet.Editable.js +22 -11
- data/vendor/assets/javascripts/leaflet-iiif.js +91 -23
- metadata +246 -227
- data/spec/features/curator_items.rb +0 -10
- data/spec/features/tags_admin_spec.rb +0 -27
- data/spec/features/user_admin_spec.rb +0 -29
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6283454c62ce693d7859d54abf0f6b8f231872a2
|
|
4
|
+
data.tar.gz: b3614482d805ac181bdd85908786897a83998413
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bc6add80eb86ad87548c3c4b40c9f73dd15de59b8b0443b9fcbdec2860ea1ef5c820190f8c288e471f8e7c021f4fd611be103ac66a39640c9d5d80600aa7194f
|
|
7
|
+
data.tar.gz: ac68408582986b2115ea46832b6ee2271501ecf99311bb56c2a37bb7dfee7337679850264217e76948e1afd03956732c9a3d643a09f940569d41491dcc4752cc
|
data/Rakefile
CHANGED
|
@@ -25,7 +25,6 @@ require 'rubocop/rake_task'
|
|
|
25
25
|
RuboCop::RakeTask.new(:rubocop)
|
|
26
26
|
|
|
27
27
|
require 'engine_cart/rake_task'
|
|
28
|
-
EngineCart.fingerprint_proc = EngineCart.rails_fingerprint_proc
|
|
29
28
|
|
|
30
29
|
require 'spotlight/version'
|
|
31
30
|
|
|
@@ -34,6 +33,11 @@ task ci: ['engine_cart:generate'] do
|
|
|
34
33
|
|
|
35
34
|
SolrWrapper.wrap(port: '8983') do |solr|
|
|
36
35
|
solr.with_collection(name: 'blacklight-core', dir: File.join(File.expand_path(File.dirname(__FILE__)), 'solr_conf', 'conf')) do
|
|
36
|
+
within_test_app do
|
|
37
|
+
system 'bundle install'
|
|
38
|
+
system 'bundle exec rake db:migrate'
|
|
39
|
+
end
|
|
40
|
+
|
|
37
41
|
Rake::Task['spotlight:fixtures'].invoke
|
|
38
42
|
|
|
39
43
|
# run the tests
|
|
@@ -33,9 +33,10 @@ Spotlight.Block.Resources = (function(){
|
|
|
33
33
|
} else {
|
|
34
34
|
checked = "";
|
|
35
35
|
}
|
|
36
|
+
var resource_id = data.slug || data.id;
|
|
36
37
|
var markup = [
|
|
37
|
-
'<li class="field form-inline dd-item dd3-item" data-id="' + index + '" id="' + this.formId("item_" + data.id) + '">',
|
|
38
|
-
'<input type="hidden" name="item[' + index + '][id]" value="' +
|
|
38
|
+
'<li class="field form-inline dd-item dd3-item" data-resource-id="' + resource_id + '" data-id="' + index + '" id="' + this.formId("item_" + data.id) + '">',
|
|
39
|
+
'<input type="hidden" name="item[' + index + '][id]" value="' + resource_id + '" />',
|
|
39
40
|
'<input type="hidden" name="item[' + index + '][title]" value="' + data.title + '" />',
|
|
40
41
|
this._itemPanelIiifFields(index, data),
|
|
41
42
|
'<input data-property="weight" type="hidden" name="item[' + index + '][weight]" value="' + data.weight + '" />',
|
|
@@ -230,6 +230,8 @@ export default class Crop {
|
|
|
230
230
|
tabs.on('shown.bs.tab', function() {
|
|
231
231
|
if(self.cropArea.data('initiallyVisible') === false && self.cropArea.is(':visible')) {
|
|
232
232
|
self.cropperMap.invalidateSize();
|
|
233
|
+
// Because the map size is 0,0 when image is loading (not visible) we need to refit the bounds of the layer
|
|
234
|
+
self.imageLayer._fitBounds();
|
|
233
235
|
self.cropArea.data('initiallyVisible', null);
|
|
234
236
|
}
|
|
235
237
|
});
|
|
@@ -111,12 +111,16 @@
|
|
|
111
111
|
|
|
112
112
|
function addThumbsToList(){
|
|
113
113
|
$.each(image_versions, function(i){
|
|
114
|
-
var listItem = $('<li><a href="javascript:;"><img src="' + image_versions[i]['thumb'] +'" data-image-id="' + image_versions[i]['imageId'] +'" /></a></li>');
|
|
114
|
+
var listItem = $('<li data-index="' + i + '"><a href="javascript:;"><img src="' + image_versions[i]['thumb'] +'" data-image-id="' + image_versions[i]['imageId'] +'" /></a></li>');
|
|
115
115
|
listItem.on('click', function(){
|
|
116
116
|
// get the current image id
|
|
117
117
|
var imageid = $('img', $(this)).data('image-id');
|
|
118
118
|
var src = $('img', $(this)).attr('src');
|
|
119
119
|
|
|
120
|
+
if (typeof clickCallback === 'function' ) {
|
|
121
|
+
clickCallback(image_versions[i]);
|
|
122
|
+
}
|
|
123
|
+
|
|
120
124
|
// mark the current selection as active
|
|
121
125
|
$('li.active', thumbList).removeClass('active');
|
|
122
126
|
$(this).addClass('active');
|
|
@@ -128,9 +132,6 @@
|
|
|
128
132
|
$('li', thumbList).index($(this)) + 1
|
|
129
133
|
);
|
|
130
134
|
scrollToActiveThumb();
|
|
131
|
-
if (typeof clickCallback === 'function' ) {
|
|
132
|
-
clickCallback(image_versions[i]);
|
|
133
|
-
}
|
|
134
135
|
});
|
|
135
136
|
$("img", listItem).on('load', function() {
|
|
136
137
|
updateThumbListWidth();
|
|
@@ -7,14 +7,27 @@ Spotlight.onLoad(function() {
|
|
|
7
7
|
var monitorElements = this;
|
|
8
8
|
var defaultRefreshRate = 3000;
|
|
9
9
|
var panelContainer;
|
|
10
|
+
var pollers = [];
|
|
10
11
|
|
|
11
12
|
$(monitorElements).each(function() {
|
|
12
13
|
panelContainer = $(this);
|
|
13
14
|
var monitorUrl = panelContainer.data('monitorUrl');
|
|
14
15
|
var refreshRate = panelContainer.data('refreshRate') || defaultRefreshRate;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
pollers.push(
|
|
17
|
+
setInterval(function() {
|
|
18
|
+
checkMonitorUrl(monitorUrl);
|
|
19
|
+
}, refreshRate)
|
|
20
|
+
);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// Clear the intervals on turbolink:click event (e.g. when the user navigates away from the page)
|
|
24
|
+
$(document).on('turbolinks:click', function() {
|
|
25
|
+
if (pollers.length > 0) {
|
|
26
|
+
$.each(pollers, function() {
|
|
27
|
+
clearInterval(this);
|
|
28
|
+
});
|
|
29
|
+
pollers = [];
|
|
30
|
+
}
|
|
18
31
|
});
|
|
19
32
|
|
|
20
33
|
function checkMonitorUrl(url) {
|
|
@@ -8,6 +8,11 @@ module Spotlight
|
|
|
8
8
|
|
|
9
9
|
included do
|
|
10
10
|
helper_method :current_site, :current_exhibit, :current_masthead, :exhibit_masthead?, :resource_masthead?
|
|
11
|
+
before_action :set_exhibit_locale_scope
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def set_exhibit_locale_scope
|
|
15
|
+
Translation.current_exhibit = current_exhibit
|
|
11
16
|
end
|
|
12
17
|
|
|
13
18
|
def current_site
|
|
@@ -15,7 +20,7 @@ module Spotlight
|
|
|
15
20
|
end
|
|
16
21
|
|
|
17
22
|
def current_exhibit
|
|
18
|
-
@exhibit
|
|
23
|
+
@exhibit || (Spotlight::Exhibit.find(params[:exhibit_id]) if params[:exhibit_id].present?)
|
|
19
24
|
end
|
|
20
25
|
|
|
21
26
|
def current_masthead
|
|
@@ -83,5 +83,32 @@ module Spotlight
|
|
|
83
83
|
def should_render_spotlight_search_bar?
|
|
84
84
|
!resource_masthead?
|
|
85
85
|
end
|
|
86
|
+
|
|
87
|
+
def document_index_view_type
|
|
88
|
+
return super if params[:view].present?
|
|
89
|
+
if @search && @search.default_index_view_type.present?
|
|
90
|
+
blacklight_config.view[@search.default_index_view_type].key
|
|
91
|
+
else
|
|
92
|
+
default_document_index_view_type
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
helper_method :document_index_view_type
|
|
97
|
+
|
|
98
|
+
def default_document_index_view_type
|
|
99
|
+
if view_available? default_browse_index_view_type
|
|
100
|
+
default_browse_index_view_type
|
|
101
|
+
else
|
|
102
|
+
super
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def view_available?(view)
|
|
107
|
+
blacklight_config.view.key?(view) && blacklight_configuration_context.evaluate_if_unless_configuration(blacklight_config.view)
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def default_browse_index_view_type
|
|
111
|
+
Spotlight::Engine.config.default_browse_index_view_type
|
|
112
|
+
end
|
|
86
113
|
end
|
|
87
114
|
end
|
|
@@ -122,11 +122,11 @@ module Spotlight
|
|
|
122
122
|
protected
|
|
123
123
|
|
|
124
124
|
# TODO: move this out of app/helpers/blacklight/catalog_helper_behavior.rb and into blacklight/catalog.rb
|
|
125
|
-
# rubocop:disable
|
|
125
|
+
# rubocop:disable Naming/PredicateName
|
|
126
126
|
def has_search_parameters?
|
|
127
127
|
!params[:q].blank? || !params[:f].blank? || !params[:search_field].blank?
|
|
128
128
|
end
|
|
129
|
-
# rubocop:enable
|
|
129
|
+
# rubocop:enable Naming/PredicateName
|
|
130
130
|
|
|
131
131
|
def attach_breadcrumbs
|
|
132
132
|
# The "q: ''" is necessary so that the breadcrumb builder recognizes that a path like this:
|
|
@@ -5,39 +5,10 @@ module Spotlight
|
|
|
5
5
|
include ::BlacklightConfigurationHelper
|
|
6
6
|
include Spotlight::RenderingHelper
|
|
7
7
|
|
|
8
|
-
def document_index_view_type
|
|
9
|
-
if @search && @search.default_index_view_type.present? && params[:view].blank?
|
|
10
|
-
blacklight_config.view[@search.default_index_view_type].key
|
|
11
|
-
else
|
|
12
|
-
super
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
##
|
|
17
|
-
# Override Blacklight's #default_document_index_view_type helper to
|
|
18
|
-
# use a different default view when presenting browse categories
|
|
19
|
-
def default_document_index_view_type
|
|
20
|
-
if view_available? default_browse_index_view_type
|
|
21
|
-
default_browse_index_view_type
|
|
22
|
-
else
|
|
23
|
-
super
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
|
|
27
8
|
##
|
|
28
9
|
# Get parent results count of a browse category search
|
|
29
10
|
def parent_search_count
|
|
30
11
|
@parent_search_count ||= Spotlight::Search.find(@search.id).count
|
|
31
12
|
end
|
|
32
|
-
|
|
33
|
-
private
|
|
34
|
-
|
|
35
|
-
def view_available?(view)
|
|
36
|
-
blacklight_config.view.key?(view) && blacklight_configuration_context.evaluate_if_unless_configuration(blacklight_config.view)
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def default_browse_index_view_type
|
|
40
|
-
Spotlight::Engine.config.default_browse_index_view_type
|
|
41
|
-
end
|
|
42
13
|
end
|
|
43
14
|
end
|
|
@@ -15,10 +15,10 @@ module Spotlight
|
|
|
15
15
|
content_tag(:h1, safe_join([section, content_tag(:small, title || t(:'.header'))], "\n"), class: 'page-header')
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
# rubocop:disable
|
|
18
|
+
# rubocop:disable Naming/AccessorMethodName
|
|
19
19
|
def set_html_page_title(title = nil)
|
|
20
20
|
@page_title = strip_tags(t(:'spotlight.html_title', title: title || t(:'.title', default: :'.header'), application_name: application_name)).html_safe
|
|
21
21
|
end
|
|
22
|
-
# rubocop:enable
|
|
22
|
+
# rubocop:enable Naming/AccessorMethodName
|
|
23
23
|
end
|
|
24
24
|
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module Spotlight
|
|
2
|
+
##
|
|
3
|
+
# Module that extends I18n::Backend::ActiveRecord::Translation to provide
|
|
4
|
+
# additional Spotlight behavior, such as exhibit specific Translations
|
|
5
|
+
module CustomTranslationExtension
|
|
6
|
+
extend ActiveSupport::Concern
|
|
7
|
+
|
|
8
|
+
included do
|
|
9
|
+
default_scope { where(exhibit: current_exhibit) }
|
|
10
|
+
belongs_to :exhibit, class_name: 'Spotlight::Exhibit', inverse_of: :translations
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
class_methods do
|
|
14
|
+
def current_exhibit
|
|
15
|
+
Thread.current[:current_exhibit]
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def current_exhibit=(exhibit)
|
|
19
|
+
Thread.current[:current_exhibit] = exhibit
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -17,17 +17,19 @@ module Spotlight
|
|
|
17
17
|
private
|
|
18
18
|
|
|
19
19
|
def hash_for_solr_update(data)
|
|
20
|
-
Array.wrap(data).map { |doc| convert_document_to_atomic_update_hash(doc) }.reject { |x| x.length <=
|
|
20
|
+
Array.wrap(data).map { |doc| convert_document_to_atomic_update_hash(doc) }.reject { |x| x.length <= 2 }
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def convert_document_to_atomic_update_hash(doc)
|
|
24
|
-
doc.each_with_object({}) do |(k, v), hash|
|
|
24
|
+
output = doc.each_with_object({}) do |(k, v), hash|
|
|
25
25
|
hash[k] = if k.to_sym == self.class.unique_key.to_sym
|
|
26
26
|
v
|
|
27
27
|
else
|
|
28
28
|
{ set: v }
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
|
+
output[Blacklight::Configuration.default_values[:index].timestamp_field] ||= { set: nil }
|
|
32
|
+
output
|
|
31
33
|
end
|
|
32
34
|
end
|
|
33
35
|
end
|
|
@@ -314,7 +314,7 @@ module Spotlight
|
|
|
314
314
|
].flatten.join(' ')
|
|
315
315
|
end
|
|
316
316
|
|
|
317
|
-
# rubocop:disable
|
|
317
|
+
# rubocop:disable Naming/AccessorMethodName
|
|
318
318
|
def set_index_field_defaults(field)
|
|
319
319
|
return unless index_fields.blank?
|
|
320
320
|
|
|
@@ -341,7 +341,7 @@ module Spotlight
|
|
|
341
341
|
field.show = true
|
|
342
342
|
field.enabled = true
|
|
343
343
|
end
|
|
344
|
-
# rubocop:enable
|
|
344
|
+
# rubocop:enable Naming/AccessorMethodName
|
|
345
345
|
|
|
346
346
|
# @return [Integer] the weight (sort order) for this field
|
|
347
347
|
def field_weight(fields, index)
|
|
@@ -34,7 +34,6 @@ module Spotlight
|
|
|
34
34
|
has_many :custom_fields, dependent: :delete_all
|
|
35
35
|
has_many :feature_pages, extend: FriendlyId::FinderMethods
|
|
36
36
|
has_many :main_navigations, dependent: :delete_all
|
|
37
|
-
has_many :owned_taggings, class_name: 'ActsAsTaggableOn::Tagging', as: :tagger
|
|
38
37
|
has_many :reindexing_log_entries, dependent: :destroy
|
|
39
38
|
has_many :resources
|
|
40
39
|
has_many :roles, as: :resource, dependent: :delete_all
|
|
@@ -43,6 +42,7 @@ module Spotlight
|
|
|
43
42
|
has_many :users, through: :roles, class_name: Spotlight::Engine.config.user_class
|
|
44
43
|
has_many :pages, dependent: :destroy
|
|
45
44
|
has_many :filters, dependent: :delete_all
|
|
45
|
+
has_many :translations, class_name: 'I18n::Backend::ActiveRecord::Translation', dependent: :destroy, inverse_of: :exhibit
|
|
46
46
|
|
|
47
47
|
has_one :blacklight_configuration, class_name: 'Spotlight::BlacklightConfiguration', dependent: :delete
|
|
48
48
|
has_one :home_page
|
|
@@ -17,19 +17,19 @@
|
|
|
17
17
|
<% page_analytics = current_exhibit.page_analytics(1.month, exhibit_root_path(current_exhibit)) %>
|
|
18
18
|
<% unless page_analytics.empty? %>
|
|
19
19
|
<h4><%= t :'.pages.header' %></h4>
|
|
20
|
-
<table class="table table-striped">
|
|
20
|
+
<table class="table table-striped popular-pages">
|
|
21
21
|
<thead>
|
|
22
22
|
<tr>
|
|
23
23
|
<th><%= t(:".pagetitle") %></th>
|
|
24
|
-
<th><%= t(:".pageviews") %></th>
|
|
24
|
+
<th class="text-right"><%= t(:".pageviews") %></th>
|
|
25
25
|
</tr>
|
|
26
26
|
</thead>
|
|
27
27
|
<% page_analytics.each do |p| %>
|
|
28
28
|
<tr>
|
|
29
29
|
<td><%= link_to p.pageTitle, p.pagePath %></td>
|
|
30
|
-
<td><%= p.pageviews %></td>
|
|
30
|
+
<td class="text-right"><%= p.pageviews %></td>
|
|
31
31
|
</tr>
|
|
32
32
|
<% end %>
|
|
33
33
|
</table>
|
|
34
34
|
<% end %>
|
|
35
|
-
<% end %>
|
|
35
|
+
<% end %>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<% default_field = @blacklight_configuration.blacklight_config.default_search_field %>
|
|
2
2
|
<div class="checkbox">
|
|
3
|
-
<label>
|
|
3
|
+
<label for="enable_feature">
|
|
4
4
|
<%= check_box_tag :enable_feature, '1', @blacklight_configuration.blacklight_config.search_fields.select { |_k, v| v.enabled && v.include_in_simple_select != false }.any?, data: { behavior: 'enable-feature', target: '#search_fields' } %> <%= t(:'.enable_feature') %>
|
|
5
5
|
</label>
|
|
6
6
|
</div>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
class CreateTranslations < ActiveRecord::Migration[5.0]
|
|
2
|
+
def self.up
|
|
3
|
+
create_table :translations do |t|
|
|
4
|
+
t.string :locale
|
|
5
|
+
t.string :key
|
|
6
|
+
t.text :value
|
|
7
|
+
t.text :interpolations
|
|
8
|
+
t.boolean :is_proc, default: false
|
|
9
|
+
t.references :exhibit
|
|
10
|
+
|
|
11
|
+
t.timestamps
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.down
|
|
16
|
+
drop_table :translations
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require 'i18n/backend/active_record'
|
|
2
|
+
|
|
3
|
+
Translation = I18n::Backend::ActiveRecord::Translation
|
|
4
|
+
|
|
5
|
+
if Translation.table_exists?
|
|
6
|
+
##
|
|
7
|
+
# Sets up the new Spotlight Translation backend, backed by ActiveRecord. To
|
|
8
|
+
# turn on the ActiveRecord backend, uncomment the following lines.
|
|
9
|
+
|
|
10
|
+
# I18n.backend = I18n::Backend::ActiveRecord.new
|
|
11
|
+
I18n::Backend::ActiveRecord.send(:include, I18n::Backend::Memoize)
|
|
12
|
+
Translation.send(:include, Spotlight::CustomTranslationExtension)
|
|
13
|
+
I18n::Backend::Simple.send(:include, I18n::Backend::Memoize)
|
|
14
|
+
I18n::Backend::Simple.send(:include, I18n::Backend::Pluralization)
|
|
15
|
+
|
|
16
|
+
# I18n.backend = I18n::Backend::Chain.new(I18n.backend, I18n::Backend::Simple.new)
|
|
17
|
+
end
|
data/lib/spotlight/engine.rb
CHANGED
data/lib/spotlight/version.rb
CHANGED
|
@@ -5,6 +5,38 @@ describe Spotlight::BrowseController, type: :controller do
|
|
|
5
5
|
let!(:unpublished) { FactoryBot.create(:search, exhibit: exhibit) }
|
|
6
6
|
let(:admin) { FactoryBot.create(:site_admin) }
|
|
7
7
|
|
|
8
|
+
describe 'protected methods' do
|
|
9
|
+
it 'uses the blacklight.browse configuration for the document actions when additional configuration layers are not defined' do
|
|
10
|
+
expect(controller).to receive(:view_available?).and_return true
|
|
11
|
+
expect(controller.send(:document_index_view_type)).to equal :gallery
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it 'uses the blacklight_config view configuration when there are no params' do
|
|
15
|
+
allow(controller).to receive(:current_exhibit).and_return exhibit
|
|
16
|
+
expect(controller).to receive(:view_available?).and_return false
|
|
17
|
+
expect(controller.send(:document_index_view_type)).to equal :list
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it 'returns document_index_view_type from a search object' do
|
|
21
|
+
allow(controller).to receive(:current_exhibit).and_return exhibit
|
|
22
|
+
expect(controller).to receive(:view_available?).and_return true
|
|
23
|
+
search.default_index_view_type = 'gallery'
|
|
24
|
+
controller.instance_variable_set(:@search, search)
|
|
25
|
+
expect(controller.send(:default_document_index_view_type)).to equal :gallery
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it 'returns default_document_index_view_type from super when there is no view available' do
|
|
29
|
+
allow(controller).to receive(:current_exhibit).and_return exhibit
|
|
30
|
+
expect(controller).to receive(:view_available?).and_return false
|
|
31
|
+
expect(controller.send(:default_document_index_view_type)).to equal :list
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it 'returns the default_browse_index_view_type from exhibit configuration' do
|
|
35
|
+
allow(controller).to receive(:current_exhibit).and_return exhibit
|
|
36
|
+
expect(controller.send(:default_browse_index_view_type)).to equal :gallery
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
8
40
|
describe 'when authenticated as an admin' do
|
|
9
41
|
before { sign_in admin }
|
|
10
42
|
describe 'GET index' do
|