blacklight-spotlight 0.17.1 → 0.18.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/README.md +7 -7
- data/Rakefile +22 -36
- data/app/assets/javascripts/spotlight/blocks/solr_documents_block.js +1 -1
- data/app/assets/javascripts/spotlight/search_typeahead.js +1 -1
- data/app/assets/javascripts/spotlight/spotlight.js +3 -9
- data/app/assets/stylesheets/spotlight/_footer.scss +2 -19
- data/app/controllers/concerns/spotlight/base.rb +2 -2
- data/app/controllers/concerns/spotlight/catalog.rb +7 -5
- data/app/controllers/concerns/spotlight/controller.rb +4 -4
- data/app/controllers/spotlight/application_controller.rb +2 -0
- data/app/controllers/spotlight/browse_controller.rb +1 -2
- data/app/controllers/spotlight/catalog_controller.rb +8 -8
- data/app/controllers/spotlight/concerns/application_controller.rb +59 -0
- data/app/controllers/spotlight/dashboards_controller.rb +1 -2
- data/app/controllers/spotlight/home_pages_controller.rb +1 -1
- data/app/controllers/spotlight/pages_controller.rb +1 -2
- data/app/controllers/spotlight/resources/upload_controller.rb +3 -3
- data/app/controllers/spotlight/resources_controller.rb +3 -3
- data/app/controllers/spotlight/searches_controller.rb +1 -1
- data/app/helpers/spotlight/application_helper.rb +3 -7
- data/app/helpers/spotlight/main_app_helpers.rb +10 -29
- data/app/helpers/spotlight/pages_helper.rb +1 -1
- data/app/jobs/spotlight/reindex_job.rb +2 -3
- data/app/models/concerns/spotlight/access_controls_enforcement_search_builder.rb +34 -0
- data/app/models/concerns/spotlight/exhibit_documents.rb +2 -3
- data/app/models/concerns/spotlight/sitemap.rb +1 -1
- data/app/models/concerns/spotlight/solr_document/uploaded_resource.rb +1 -2
- data/app/models/sir_trevor_rails/blocks/browse_block.rb +7 -1
- data/app/models/sir_trevor_rails/blocks/textable.rb +2 -1
- data/app/models/spotlight/ability.rb +2 -1
- data/app/models/spotlight/contact_form.rb +1 -1
- data/app/models/spotlight/custom_field.rb +7 -15
- data/app/models/spotlight/field_metadata.rb +1 -1
- data/app/models/spotlight/resource.rb +2 -1
- data/app/models/spotlight/search.rb +1 -1
- data/app/values/custom_field_name.rb +36 -0
- data/app/views/blacklight/nav/_saved_searches.html.erb +1 -1
- data/app/views/blacklight/nav/_search_history.html.erb +1 -1
- data/app/views/catalog/_save_search.html.erb +1 -1
- data/app/views/catalog/_search_form.html.erb +1 -1
- data/app/views/layouts/spotlight/spotlight.html.erb +1 -1
- data/app/views/shared/_site_sidebar.html.erb +2 -2
- data/app/views/spotlight/about_pages/_empty.html.erb +1 -1
- data/app/views/spotlight/appearances/edit.html.erb +1 -1
- data/app/views/spotlight/catalog/_document_visibility_control.html.erb +1 -1
- data/app/views/spotlight/catalog/_edit_default.html.erb +4 -4
- data/app/views/spotlight/dashboards/analytics.html.erb +1 -1
- data/app/views/spotlight/exhibits/_missing_exhibits.html.erb +1 -1
- data/app/views/spotlight/feature_pages/_empty.html.erb +1 -1
- data/app/views/spotlight/home_pages/_empty.html.erb +2 -2
- data/app/views/spotlight/pages/_form.html.erb +1 -1
- data/app/views/spotlight/pages/_order_pages.html.erb +1 -1
- data/app/views/spotlight/resources/_missing_external_resources_partials.html.erb +1 -1
- data/app/views/spotlight/searches/_form.html.erb +1 -1
- data/app/views/spotlight/shared/_curation_sidebar.html.erb +2 -2
- data/config/locales/spotlight.en.yml +3 -3
- data/config/routes.rb +13 -9
- data/db/migrate/20160329215014_add_readonly_to_custom_fields.rb +5 -0
- data/lib/generators/spotlight/install_generator.rb +4 -4
- data/lib/spotlight/engine.rb +6 -1
- data/lib/spotlight/version.rb +1 -1
- data/spec/controllers/spotlight/about_pages_controller_spec.rb +4 -4
- data/spec/controllers/spotlight/application_controller_spec.rb +1 -1
- data/spec/controllers/spotlight/browse_controller_spec.rb +0 -2
- data/spec/controllers/spotlight/catalog_controller_spec.rb +103 -17
- data/spec/controllers/spotlight/dashboards_controller_spec.rb +1 -1
- data/spec/controllers/spotlight/feature_pages_controller_spec.rb +0 -2
- data/spec/controllers/spotlight/home_pages_controller_spec.rb +0 -2
- data/spec/controllers/spotlight/resources/upload_controller_spec.rb +1 -1
- data/spec/controllers/spotlight/resources_controller_spec.rb +1 -1
- data/spec/controllers/spotlight/search_configurations_controller_spec.rb +1 -1
- data/spec/features/add_custom_field_metadata_spec.rb +16 -3
- data/spec/features/catalog_spec.rb +2 -2
- data/spec/features/edit_search_fields_spec.rb +1 -1
- data/spec/features/exhibits/add_tags_spec.rb +2 -2
- data/spec/features/item_admin_spec.rb +5 -5
- data/spec/features/javascript/reindex_monitor_spec.rb +1 -1
- data/spec/features/javascript/search_context_spec.rb +4 -2
- data/spec/features/report_a_problem_spec.rb +2 -2
- data/spec/features/slideshow_spec.rb +1 -1
- data/spec/fixtures/sample_solr_documents.yml +44 -44
- data/spec/helpers/spotlight/application_helper_spec.rb +2 -23
- data/spec/helpers/spotlight/main_app_helpers_spec.rb +4 -62
- data/spec/helpers/spotlight/pages_helper_spec.rb +1 -2
- data/spec/models/sir_trevor_rails/blocks/browse_block_spec.rb +22 -0
- data/spec/{lib/spotlight/catalog/access_controls_enforcement_spec.rb → models/spotlight/access_controls_enforcement_search_builder_spec.rb} +5 -18
- data/spec/models/spotlight/contact_form_spec.rb +35 -0
- data/spec/models/spotlight/custom_field_spec.rb +6 -0
- data/spec/models/spotlight/exhibit_spec.rb +3 -2
- data/spec/models/spotlight/search_spec.rb +2 -2
- data/spec/spec_helper.rb +7 -0
- data/spec/support/helpers/controller_level_helpers.rb +13 -0
- data/spec/test_app_templates/catalog_controller.rb +1 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +9 -1
- data/spec/views/shared/_footer.html.erb_spec.rb +3 -3
- data/spec/views/spotlight/about_pages/index.html.erb_spec.rb +7 -11
- data/spec/views/spotlight/catalog/admin.html.erb_spec.rb +3 -1
- data/spec/views/spotlight/home_pages/_empty.html.erb_spec.rb +1 -1
- data/spec/views/spotlight/metadata_configurations/_metadata_field.html.erb_spec.rb +2 -1
- data/spec/views/spotlight/metadata_configurations/edit.html.erb_spec.rb +2 -1
- data/spec/views/spotlight/pages/index.html.erb_spec.rb +2 -4
- data/spec/views/spotlight/pages/show.html.erb_spec.rb +1 -2
- data/spec/views/spotlight/search_configurations/_sort.html.erb_spec.rb +2 -1
- data/spec/views/spotlight/searches/_search.html.erb_spec.rb +1 -1
- data/spec/views/spotlight/searches/edit.html.erb_spec.rb +1 -1
- metadata +30 -25
- data/app/controllers/concerns/spotlight/catalog/access_controls_enforcement.rb +0 -47
- data/config/jetty.yml +0 -6
- data/spec/test_app_templates/Gemfile.extra +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6bff0876109f9e68d8dcadddb01e465330d67d25
|
|
4
|
+
data.tar.gz: 9f7f3daa3104c882c01e8edc24731d8e5fd9401f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f27a7aab2b68144eeecd58b51b98fbaf9d78bafb38a780eecdf5a7efe74c3aefe299e4e05f4da8f5fd0251d2422bf8a45e43b6c83b7379768280e6aa0edb72d5
|
|
7
|
+
data.tar.gz: 85db41321a6ba7e8baaa8db613bb149d88b6afaf9689bbb27c2c7538dba062e79d66a86902b6b8f9dfe0e2a519c9ad79e67a72ecb4009b454507027b288219c9
|
data/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
spotlight
|
|
2
2
|
=========
|
|
3
3
|
|
|
4
|
-
[](https://travis-ci.org/projectblacklight/spotlight) | [](https://coveralls.io/r/projectblacklight/spotlight) | [](http://badge.fury.io/rb/blacklight-spotlight) | [Release Notes](https://github.com/projectblacklight/spotlight/releases) | [Design Documents](https://github.com/projectblacklight/spotlight/releases/tag/v0.0.0)
|
|
5
5
|
|
|
6
6
|
Spotlight is open source software that enables librarians, curators, and other content experts to easily build feature-rich websites that showcase collections and objects from a digital repository, uploaded items, or a combination of the two. Spotlight is a plug-in for [Blacklight](https://github.com/projectblacklight/blacklight), an open source, Ruby on Rails Engine that provides a basic discovery interface for searching an Apache Solr index.
|
|
7
7
|
|
|
8
|
-
Read more about what Spotlight is, our motivations for creating it, and how to install and configure it in the [wiki pages](https://github.com/
|
|
8
|
+
Read more about what Spotlight is, our motivations for creating it, and how to install and configure it in the [wiki pages](https://github.com/projectblacklight/spotlight/wiki). You might also want to take a look at our demo videos, especially the [tour of a completed Spotlight exhibit](https://www.youtube.com/watch?v=_A7vTbbiF4g) and the walkthrough of [building an exhibit with Spotlight](https://www.youtube.com/watch?v=qPJtgajJ4ic).
|
|
9
9
|
|
|
10
10
|
## Requirements
|
|
11
11
|
|
|
@@ -19,13 +19,13 @@ Read more about what Spotlight is, our motivations for creating it, and how to i
|
|
|
19
19
|
To bootstrap a new Rails application:
|
|
20
20
|
|
|
21
21
|
```
|
|
22
|
-
$ rails new app-name -m https://raw.githubusercontent.com/
|
|
22
|
+
$ rails new app-name -m https://raw.githubusercontent.com/projectblacklight/spotlight/master/template.rb
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
or from an existing Rails application:
|
|
26
26
|
|
|
27
27
|
```
|
|
28
|
-
$ rake rails:template LOCATION=https://raw.githubusercontent.com/
|
|
28
|
+
$ rake rails:template LOCATION=https://raw.githubusercontent.com/projectblacklight/spotlight/master/template.rb
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
*During this process you will be prompted to enter an initial administrator email and password (this is a super-admin that can administer any exhibit in the installation).* If you choose not to create one, the first user will be given administrative privileges.
|
|
@@ -65,7 +65,7 @@ Spotlight introduces functionality that depends on being able to send emails to
|
|
|
65
65
|
|
|
66
66
|
### More
|
|
67
67
|
|
|
68
|
-
See the [Spotlight wiki](https://github.com/
|
|
68
|
+
See the [Spotlight wiki](https://github.com/projectblacklight/spotlight/wiki) for more detailed information on configuring Spotlight.
|
|
69
69
|
|
|
70
70
|
# Developing Spotlight
|
|
71
71
|
|
|
@@ -78,8 +78,8 @@ Our `$ rake ci` and `$ rake spotlight:server` tasks utilize Solr and the testing
|
|
|
78
78
|
|
|
79
79
|
## More Information for Developers
|
|
80
80
|
|
|
81
|
-
* [Contributing to Spotlight](https://github.com/
|
|
82
|
-
* [Testing](https://github.com/
|
|
81
|
+
* [Contributing to Spotlight](https://github.com/projectblacklight/spotlight/wiki/Contributing-to-Spotlight)
|
|
82
|
+
* [Testing](https://github.com/projectblacklight/spotlight/wiki/Testing)
|
|
83
83
|
|
|
84
84
|
## Tests
|
|
85
85
|
|
data/Rakefile
CHANGED
|
@@ -4,8 +4,6 @@ rescue LoadError
|
|
|
4
4
|
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
|
5
5
|
end
|
|
6
6
|
|
|
7
|
-
ZIP_URL = 'https://github.com/projectblacklight/blacklight-jetty/archive/v4.10.4.zip'.freeze
|
|
8
|
-
|
|
9
7
|
require 'rdoc/task'
|
|
10
8
|
|
|
11
9
|
RDoc::Task.new(:rdoc) do |rdoc|
|
|
@@ -18,40 +16,33 @@ end
|
|
|
18
16
|
|
|
19
17
|
Bundler::GemHelper.install_tasks
|
|
20
18
|
|
|
19
|
+
require 'solr_wrapper'
|
|
20
|
+
|
|
21
21
|
require 'rspec/core/rake_task'
|
|
22
22
|
RSpec::Core::RakeTask.new(:spec)
|
|
23
23
|
|
|
24
24
|
require 'rubocop/rake_task'
|
|
25
25
|
RuboCop::RakeTask.new(:rubocop)
|
|
26
26
|
|
|
27
|
-
require 'jettywrapper'
|
|
28
|
-
|
|
29
27
|
require 'engine_cart/rake_task'
|
|
30
28
|
EngineCart.fingerprint_proc = EngineCart.rails_fingerprint_proc
|
|
31
29
|
|
|
32
30
|
require 'spotlight/version'
|
|
33
31
|
|
|
34
|
-
task ci: ['engine_cart:generate'
|
|
32
|
+
task ci: ['engine_cart:generate'] do
|
|
35
33
|
ENV['environment'] = 'test'
|
|
36
|
-
jetty_params = Jettywrapper.load_config
|
|
37
|
-
jetty_params[:startup_wait] = 60
|
|
38
34
|
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
SolrWrapper.wrap(port: '8983') do |solr|
|
|
36
|
+
solr.with_collection(name: 'blacklight-core', dir: File.join(File.expand_path(File.dirname(__FILE__)), 'solr_conf', 'conf')) do
|
|
37
|
+
Rake::Task['spotlight:fixtures'].invoke
|
|
41
38
|
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
# run the tests
|
|
40
|
+
Rake::Task['spec'].invoke
|
|
41
|
+
end
|
|
44
42
|
end
|
|
45
43
|
end
|
|
46
44
|
|
|
47
45
|
namespace :spotlight do
|
|
48
|
-
desc 'Copies the default SOLR config for the bundled Testing Server'
|
|
49
|
-
task :configure_jetty do
|
|
50
|
-
FileList['solr_conf/conf/*'].each do |f|
|
|
51
|
-
cp(f, 'jetty/solr/blacklight-core/conf/', verbose: true)
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
|
|
55
46
|
desc 'Load fixtures'
|
|
56
47
|
task fixtures: ['engine_cart:generate'] do
|
|
57
48
|
within_test_app do
|
|
@@ -64,22 +55,16 @@ namespace :spotlight do
|
|
|
64
55
|
task :server do
|
|
65
56
|
Rake::Task['engine_cart:generate'].invoke
|
|
66
57
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
within_test_app do
|
|
77
|
-
unless File.exist? '.initialized'
|
|
78
|
-
system 'bundle exec rake spotlight:initialize'
|
|
79
|
-
system 'bundle exec rake spotlight_test:solr:seed'
|
|
80
|
-
File.open('.initialized', 'w') {}
|
|
58
|
+
SolrWrapper.wrap(port: '8983') do |solr|
|
|
59
|
+
solr.with_collection(name: 'blacklight-core', dir: File.join(File.expand_path(File.dirname(__FILE__)), 'solr_conf', 'conf')) do
|
|
60
|
+
within_test_app do
|
|
61
|
+
unless File.exist? '.initialized'
|
|
62
|
+
system 'bundle exec rake spotlight:initialize'
|
|
63
|
+
system 'bundle exec rake spotlight_test:solr:seed'
|
|
64
|
+
File.open('.initialized', 'w') {}
|
|
65
|
+
end
|
|
66
|
+
system 'bundle exec rails s'
|
|
81
67
|
end
|
|
82
|
-
system 'bundle exec rails s'
|
|
83
68
|
end
|
|
84
69
|
end
|
|
85
70
|
end
|
|
@@ -111,9 +96,10 @@ namespace :spotlight do
|
|
|
111
96
|
Bundler.with_clean_env do
|
|
112
97
|
Dir.chdir('internal') do
|
|
113
98
|
APP_ROOT = Dir.pwd
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
99
|
+
SolrWrapper.wrap(port: '8983') do |solr|
|
|
100
|
+
solr.with_collection(name: 'blacklight-core', dir: File.join(File.expand_path('..', File.dirname(__FILE__)), 'solr', 'conf')) do
|
|
101
|
+
system 'bundle exec rails s'
|
|
102
|
+
end
|
|
117
103
|
end
|
|
118
104
|
end
|
|
119
105
|
end
|
|
@@ -9,7 +9,7 @@ SirTrevor.Blocks.SolrDocuments = (function(){
|
|
|
9
9
|
|
|
10
10
|
icon_name: "items",
|
|
11
11
|
|
|
12
|
-
autocomplete_url: function() { return this.$instance().closest('form[data-autocomplete-exhibit-catalog-
|
|
12
|
+
autocomplete_url: function() { return this.$instance().closest('form[data-autocomplete-exhibit-catalog-path]').data('autocomplete-exhibit-catalog-path').replace("%25QUERY", "%QUERY"); },
|
|
13
13
|
autocomplete_template: function() { return '<div class="autocomplete-item{{#if private}} blacklight-private{{/if}}">{{#if thumbnail}}<div class="document-thumbnail thumbnail"><img src="{{thumbnail}}" /></div>{{/if}}<span class="autocomplete-title">{{title}}</span><br/><small> {{description}}</small></div>' },
|
|
14
14
|
|
|
15
15
|
transform_autocomplete_results: function(response) {
|
|
@@ -36,7 +36,7 @@ function itemsBloodhound() {
|
|
|
36
36
|
queryTokenizer: Bloodhound.tokenizers.whitespace,
|
|
37
37
|
limit: 10,
|
|
38
38
|
remote: {
|
|
39
|
-
url: $('form[data-autocomplete-exhibit-catalog-
|
|
39
|
+
url: $('form[data-autocomplete-exhibit-catalog-path]').data('autocomplete-exhibit-catalog-path').replace("%25QUERY", "%QUERY"),
|
|
40
40
|
filter: function(response) {
|
|
41
41
|
return $.map(response['docs'], function(doc) {
|
|
42
42
|
return doc;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Spotlight = function() {
|
|
2
|
-
var buffer =
|
|
2
|
+
var buffer = [];
|
|
3
3
|
return {
|
|
4
4
|
onLoad: function(func) {
|
|
5
5
|
buffer.push(func);
|
|
@@ -10,19 +10,13 @@ Spotlight = function() {
|
|
|
10
10
|
buffer[i].call();
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
}
|
|
13
|
+
};
|
|
14
14
|
}();
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
$(document).on('page:load', function() {
|
|
18
|
-
Spotlight.activate();
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
$(document).ready(function() {
|
|
16
|
+
Blacklight.onLoad(function() {
|
|
22
17
|
Spotlight.activate();
|
|
23
18
|
});
|
|
24
19
|
|
|
25
|
-
|
|
26
20
|
Spotlight.onLoad(function(){
|
|
27
21
|
SpotlightNestable.init();
|
|
28
22
|
$.each($('.social-share-button a'), function() {
|
|
@@ -14,30 +14,13 @@
|
|
|
14
14
|
a {
|
|
15
15
|
display: block;
|
|
16
16
|
margin-bottom: 5px;
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
padding-left: 18px;
|
|
18
|
+
text-indent: 10px;
|
|
19
19
|
color: $gray-light;
|
|
20
20
|
}
|
|
21
21
|
a:hover, a:focus {
|
|
22
22
|
color: $gray;
|
|
23
23
|
text-decoration: none;
|
|
24
24
|
}
|
|
25
|
-
a:before {
|
|
26
|
-
content: '';
|
|
27
|
-
margin-right: 5px;
|
|
28
|
-
margin-bottom: -3px;
|
|
29
|
-
display: inline-block;
|
|
30
|
-
width: 16px;
|
|
31
|
-
height: 16px;
|
|
32
|
-
}
|
|
33
|
-
a.social-share-button-twitter:before {
|
|
34
|
-
background: image-url("sprites/social-share-button.png") -32px -48px no-repeat;
|
|
35
|
-
}
|
|
36
|
-
a.social-share-button-facebook:before {
|
|
37
|
-
background: image-url("sprites/social-share-button.png") -32px 0px no-repeat;
|
|
38
|
-
}
|
|
39
|
-
a.social-share-button-google_plus:before {
|
|
40
|
-
background: image-url("sprites/social-share-button.png") -16px -32px no-repeat;
|
|
41
|
-
}
|
|
42
25
|
}
|
|
43
26
|
}
|
|
@@ -22,14 +22,14 @@ module Spotlight
|
|
|
22
22
|
def autocomplete_json_response_for_document(doc)
|
|
23
23
|
{
|
|
24
24
|
id: doc.id,
|
|
25
|
-
title: CGI.unescapeHTML(view_context.presenter(doc).
|
|
25
|
+
title: CGI.unescapeHTML(view_context.presenter(doc).heading.to_str),
|
|
26
26
|
thumbnail: doc.first(blacklight_config.index.thumbnail_field),
|
|
27
27
|
thumbnails: doc.spotlight_image_versions.try(:thumb) || doc[blacklight_config.index.thumbnail_field],
|
|
28
28
|
full_image_url: doc.spotlight_image_versions.try(:full).try(:first),
|
|
29
29
|
full_images: doc.spotlight_image_versions.try(:full),
|
|
30
30
|
image_versions: doc.spotlight_image_versions.image_versions(:thumb, :full),
|
|
31
31
|
description: doc.id,
|
|
32
|
-
url:
|
|
32
|
+
url: polymorphic_path([current_exhibit, doc]),
|
|
33
33
|
private: doc.private?(current_exhibit),
|
|
34
34
|
global_id: doc.to_global_id.to_s
|
|
35
35
|
}
|
|
@@ -6,10 +6,6 @@ module Spotlight
|
|
|
6
6
|
include Blacklight::Catalog
|
|
7
7
|
include Spotlight::Base
|
|
8
8
|
|
|
9
|
-
require 'spotlight/catalog/access_controls_enforcement'
|
|
10
|
-
|
|
11
|
-
include Spotlight::Catalog::AccessControlsEnforcement
|
|
12
|
-
|
|
13
9
|
included do
|
|
14
10
|
before_action :add_facet_visibility_field
|
|
15
11
|
end
|
|
@@ -23,8 +19,14 @@ module Spotlight
|
|
|
23
19
|
query: {
|
|
24
20
|
private: {
|
|
25
21
|
label: I18n.t(:'spotlight.catalog.facets.exhibit_visibility.private'),
|
|
26
|
-
fq: "#{blacklight_config.document_model.visibility_field(current_exhibit)}:false"
|
|
22
|
+
fq: "#{blacklight_config.document_model.visibility_field(current_exhibit)}:false"
|
|
23
|
+
}
|
|
27
24
|
}
|
|
28
25
|
end
|
|
26
|
+
|
|
27
|
+
def render_save_this_search?
|
|
28
|
+
(current_exhibit && can?(:curate, current_exhibit)) &&
|
|
29
|
+
!(params[:controller] == 'spotlight/catalog' && params[:action] == 'admin')
|
|
30
|
+
end
|
|
29
31
|
end
|
|
30
32
|
end
|
|
@@ -56,7 +56,7 @@ module Spotlight
|
|
|
56
56
|
if current_exhibit
|
|
57
57
|
exhibit_search_action_url(*args)
|
|
58
58
|
else
|
|
59
|
-
main_app.
|
|
59
|
+
main_app.search_catalog_url(*args)
|
|
60
60
|
end
|
|
61
61
|
end
|
|
62
62
|
|
|
@@ -74,9 +74,9 @@ module Spotlight
|
|
|
74
74
|
options.except! :exhibit_id, :only_path
|
|
75
75
|
|
|
76
76
|
if only_path
|
|
77
|
-
spotlight.
|
|
77
|
+
spotlight.search_exhibit_catalog_path(current_exhibit, *args, options)
|
|
78
78
|
else
|
|
79
|
-
spotlight.
|
|
79
|
+
spotlight.search_exhibit_catalog_url(current_exhibit, *args, options)
|
|
80
80
|
end
|
|
81
81
|
end
|
|
82
82
|
|
|
@@ -84,7 +84,7 @@ module Spotlight
|
|
|
84
84
|
options = args.extract_options!
|
|
85
85
|
options = params.merge(options).except(:exhibit_id, :only_path)
|
|
86
86
|
|
|
87
|
-
spotlight.
|
|
87
|
+
spotlight.facet_exhibit_catalog_url(current_exhibit, *args, options)
|
|
88
88
|
end
|
|
89
89
|
end
|
|
90
90
|
end
|
|
@@ -5,7 +5,6 @@ module Spotlight
|
|
|
5
5
|
class BrowseController < Spotlight::ApplicationController
|
|
6
6
|
load_and_authorize_resource :exhibit, class: 'Spotlight::Exhibit'
|
|
7
7
|
include Spotlight::Base
|
|
8
|
-
include Spotlight::Catalog::AccessControlsEnforcement
|
|
9
8
|
|
|
10
9
|
load_and_authorize_resource :search, except: :index, through: :exhibit, parent: false
|
|
11
10
|
before_action :attach_breadcrumbs
|
|
@@ -21,7 +20,7 @@ module Spotlight
|
|
|
21
20
|
blacklight_config.index.document_actions = blacklight_config.browse.document_actions
|
|
22
21
|
|
|
23
22
|
add_breadcrumb @search.title, exhibit_browse_path(@exhibit, @search)
|
|
24
|
-
(@response, @document_list) = search_results(@search.query_params.with_indifferent_access.merge(params)
|
|
23
|
+
(@response, @document_list) = search_results(@search.query_params.with_indifferent_access.merge(params))
|
|
25
24
|
end
|
|
26
25
|
|
|
27
26
|
protected
|
|
@@ -52,7 +52,7 @@ module Spotlight
|
|
|
52
52
|
# results when a partial match is passed in the "q" parameter.
|
|
53
53
|
def autocomplete
|
|
54
54
|
search_params = params.merge(search_field: Spotlight::Engine.config.autocomplete_search_field)
|
|
55
|
-
(_, @document_list) = search_results(search_params.merge(public: true)
|
|
55
|
+
(_, @document_list) = search_results(search_params.merge(public: true))
|
|
56
56
|
|
|
57
57
|
respond_to do |format|
|
|
58
58
|
format.json do
|
|
@@ -63,8 +63,8 @@ module Spotlight
|
|
|
63
63
|
|
|
64
64
|
def admin
|
|
65
65
|
add_breadcrumb t(:'spotlight.curation.sidebar.header'), exhibit_dashboard_path(@exhibit)
|
|
66
|
-
add_breadcrumb t(:'spotlight.curation.sidebar.items'),
|
|
67
|
-
(@response, @document_list) = search_results(params
|
|
66
|
+
add_breadcrumb t(:'spotlight.curation.sidebar.items'), admin_exhibit_catalog_path(@exhibit)
|
|
67
|
+
(@response, @document_list) = search_results(params)
|
|
68
68
|
@filters = params[:f] || []
|
|
69
69
|
|
|
70
70
|
respond_to do |format|
|
|
@@ -79,7 +79,7 @@ module Spotlight
|
|
|
79
79
|
|
|
80
80
|
try_solr_commit!
|
|
81
81
|
|
|
82
|
-
redirect_to
|
|
82
|
+
redirect_to polymorphic_path([current_exhibit, @document])
|
|
83
83
|
end
|
|
84
84
|
|
|
85
85
|
def edit
|
|
@@ -87,7 +87,7 @@ module Spotlight
|
|
|
87
87
|
end
|
|
88
88
|
|
|
89
89
|
def make_private
|
|
90
|
-
@response, @document = fetch params[:
|
|
90
|
+
@response, @document = fetch params[:id]
|
|
91
91
|
@document.make_private!(current_exhibit)
|
|
92
92
|
@document.save
|
|
93
93
|
|
|
@@ -98,7 +98,7 @@ module Spotlight
|
|
|
98
98
|
end
|
|
99
99
|
|
|
100
100
|
def make_public
|
|
101
|
-
@response, @document = fetch params[:
|
|
101
|
+
@response, @document = fetch params[:id]
|
|
102
102
|
@document.make_public!(current_exhibit)
|
|
103
103
|
@document.save
|
|
104
104
|
|
|
@@ -179,7 +179,7 @@ module Spotlight
|
|
|
179
179
|
end
|
|
180
180
|
|
|
181
181
|
def custom_field_params
|
|
182
|
-
current_exhibit.custom_fields.pluck(:field)
|
|
182
|
+
current_exhibit.custom_fields.writeable.pluck(:field)
|
|
183
183
|
end
|
|
184
184
|
|
|
185
185
|
def check_authorization
|
|
@@ -205,7 +205,7 @@ module Spotlight
|
|
|
205
205
|
add_breadcrumb t(:'spotlight.catalog.breadcrumb.index'), search_action_url(current_search_session.query_params)
|
|
206
206
|
end
|
|
207
207
|
|
|
208
|
-
add_breadcrumb Array(document[blacklight_config.view_config(:show).title_field]).join(', '),
|
|
208
|
+
add_breadcrumb Array(document[blacklight_config.view_config(:show).title_field]).join(', '), polymorphic_path([current_exhibit, document])
|
|
209
209
|
end
|
|
210
210
|
# rubocop:enable Metrics/AbcSize
|
|
211
211
|
|
|
@@ -25,6 +25,65 @@ module Spotlight
|
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
end
|
|
28
|
+
|
|
29
|
+
def enabled_in_spotlight_view_type_configuration?(config, *args)
|
|
30
|
+
if config.respond_to?(:upstream_if) &&
|
|
31
|
+
!config.upstream_if.nil? &&
|
|
32
|
+
!blacklight_configuration_context.evaluate_configuration_conditional(config.upstream_if, config, *args)
|
|
33
|
+
false
|
|
34
|
+
elsif current_exhibit.nil? || is_a?(Spotlight::PagesController)
|
|
35
|
+
true
|
|
36
|
+
else
|
|
37
|
+
current_exhibit.blacklight_configuration.document_index_view_types.include? config.key.to_s
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/MethodLength
|
|
42
|
+
def field_enabled?(field, *args)
|
|
43
|
+
if !field.enabled
|
|
44
|
+
false
|
|
45
|
+
elsif field.respond_to?(:upstream_if) &&
|
|
46
|
+
!field.upstream_if.nil? &&
|
|
47
|
+
!blacklight_configuration_context.evaluate_configuration_conditional(field.upstream_if, field, *args)
|
|
48
|
+
false
|
|
49
|
+
elsif field.is_a?(Blacklight::Configuration::SortField) || field.is_a?(Blacklight::Configuration::SearchField)
|
|
50
|
+
field.enabled
|
|
51
|
+
elsif field.is_a?(Blacklight::Configuration::FacetField) || (is_a?(Blacklight::Catalog) && %w(edit show).include?(action_name))
|
|
52
|
+
field.show
|
|
53
|
+
else
|
|
54
|
+
field.send(document_index_view_type)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
# rubocop:enable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/MethodLength
|
|
58
|
+
|
|
59
|
+
private
|
|
60
|
+
|
|
61
|
+
##
|
|
62
|
+
# Get the current "view type" (and ensure it is a valid type)
|
|
63
|
+
#
|
|
64
|
+
# @param [Hash] the query parameters to check
|
|
65
|
+
# @return [Symbol]
|
|
66
|
+
def document_index_view_type
|
|
67
|
+
view_param = params[:view]
|
|
68
|
+
view_param ||= session[:preferred_view]
|
|
69
|
+
if view_param && document_index_views.keys.include?(view_param.to_sym)
|
|
70
|
+
view_param.to_sym
|
|
71
|
+
else
|
|
72
|
+
default_document_index_view_type
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def document_index_views
|
|
77
|
+
blacklight_config.view.select do |_k, config|
|
|
78
|
+
blacklight_configuration_context.evaluate_if_unless_configuration config
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
##
|
|
83
|
+
# Get the default index view type
|
|
84
|
+
def default_document_index_view_type
|
|
85
|
+
document_index_views.select { |_k, config| config.respond_to?(:default) && config.default }.keys.first || document_index_views.keys.first
|
|
86
|
+
end
|
|
28
87
|
end
|
|
29
88
|
end
|
|
30
89
|
end
|