blacklight-spotlight 0.12.0 → 0.12.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/app/controllers/spotlight/roles_controller.rb +2 -2
- data/app/models/spotlight/ability.rb +1 -1
- data/app/models/spotlight/exhibit.rb +1 -1
- data/app/models/spotlight/page.rb +2 -2
- data/app/models/spotlight/resource.rb +0 -7
- data/app/models/spotlight/role.rb +2 -2
- data/app/models/spotlight/search.rb +26 -19
- data/app/serializers/spotlight/page_representer.rb +2 -2
- data/app/views/spotlight/browse/_search.html.erb +2 -2
- data/app/views/spotlight/browse/_search_title.html.erb +1 -1
- data/app/views/spotlight/searches/_search.html.erb +1 -1
- data/config/locales/devise.en.yml +5 -0
- data/config/locales/spotlight.en.yml +2 -2
- data/db/migrate/20151110082345_add_metadata_to_spotlight_resource.rb +5 -1
- data/db/migrate/20151210073829_create_spotlight_configuration.rb +7 -0
- data/lib/spotlight/engine.rb +6 -0
- data/lib/spotlight/version.rb +1 -1
- data/lib/tasks/spotlight_tasks.rake +1 -1
- data/spec/controllers/spotlight/roles_controller_spec.rb +3 -3
- data/spec/models/spotlight/search_spec.rb +30 -10
- data/spec/serializers/spotlight/exhibit_export_serializer_spec.rb +9 -2
- data/spec/spec_helper.rb +1 -1
- data/spec/views/_user_util_links.html.erb_spec.rb +4 -4
- data/spec/views/spotlight/browse/_search.html.erb_spec.rb +2 -2
- data/spec/views/spotlight/browse/show.html.erb_spec.rb +3 -3
- data/spec/views/spotlight/exhibits/index.html.erb_spec.rb +1 -1
- data/spec/views/spotlight/roles/index.html.erb_spec.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 04eb98fbaa9f7a11fbebb777f034d1537773bd2f
|
|
4
|
+
data.tar.gz: 8ced6a8356a1cb65c3ce5bbbf941108444b0fb7f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d9b5ea84c1d186ec0aab2fd47b59099c832caffd05ae6e151ab2088c71012ec76fec695cfaac258927ffb9cfaee9c2af388b11a3da06d704b8c251a984113294
|
|
7
|
+
data.tar.gz: 02290a5d60fc130bb1bbf96f335cd66e503a323436c48e207a631f468009d9ed5728911bfed807e5a818f8754eccaf16d4feffd2a47b796bf535036c37cbd3e6
|
|
@@ -33,7 +33,7 @@ module Spotlight
|
|
|
33
33
|
def exists
|
|
34
34
|
# note: the messages returned are not shown to users and really only useful for debug, hence no translation necessary
|
|
35
35
|
# app uses html status code to act on response
|
|
36
|
-
if ::
|
|
36
|
+
if Spotlight::Engine.user_class.where(email: exists_params).present?
|
|
37
37
|
render json: { message: 'User exists' }
|
|
38
38
|
else
|
|
39
39
|
render json: { message: 'User does not exist' }, status: :not_found
|
|
@@ -41,7 +41,7 @@ module Spotlight
|
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
def invite
|
|
44
|
-
user = ::
|
|
44
|
+
user = Spotlight::Engine.user_class.invite!(email: invite_params[:user], skip_invitation: true) # don't deliver the invitation yet
|
|
45
45
|
role = Spotlight::Role.create(exhibit: current_exhibit, user: user, role: invite_params[:role])
|
|
46
46
|
if role.save
|
|
47
47
|
user.deliver_invitation # now deliver it when we have saved the role
|
|
@@ -32,7 +32,7 @@ module Spotlight
|
|
|
32
32
|
has_many :roles, dependent: :delete_all
|
|
33
33
|
has_many :searches, dependent: :destroy, extend: FriendlyId::FinderMethods
|
|
34
34
|
has_many :solr_document_sidecars, dependent: :delete_all
|
|
35
|
-
has_many :users, through: :roles, class_name:
|
|
35
|
+
has_many :users, through: :roles, class_name: Spotlight::Engine.config.user_class
|
|
36
36
|
has_many :pages, dependent: :destroy
|
|
37
37
|
|
|
38
38
|
has_one :blacklight_configuration, class_name: 'Spotlight::BlacklightConfiguration', dependent: :delete
|
|
@@ -8,8 +8,8 @@ module Spotlight
|
|
|
8
8
|
friendly_id :title, use: [:slugged, :scoped, :finders, :history], scope: :exhibit
|
|
9
9
|
|
|
10
10
|
belongs_to :exhibit, touch: true
|
|
11
|
-
belongs_to :created_by, class_name:
|
|
12
|
-
belongs_to :last_edited_by, class_name:
|
|
11
|
+
belongs_to :created_by, class_name: Spotlight::Engine.config.user_class
|
|
12
|
+
belongs_to :last_edited_by, class_name: Spotlight::Engine.config.user_class
|
|
13
13
|
validates :weight, inclusion: { in: proc { 0..Spotlight::Page::MAX_PAGES } }
|
|
14
14
|
|
|
15
15
|
default_scope { order('weight ASC') }
|
|
@@ -18,7 +18,6 @@ module Spotlight
|
|
|
18
18
|
:last_index_elapsed_time,
|
|
19
19
|
:last_indexed_finished], coder: JSON
|
|
20
20
|
|
|
21
|
-
around_index :reindex_with_lock
|
|
22
21
|
around_index :reindex_with_logging
|
|
23
22
|
after_index :commit
|
|
24
23
|
|
|
@@ -134,12 +133,6 @@ module Spotlight
|
|
|
134
133
|
|
|
135
134
|
protected
|
|
136
135
|
|
|
137
|
-
def reindex_with_lock
|
|
138
|
-
with_lock do
|
|
139
|
-
yield
|
|
140
|
-
end
|
|
141
|
-
end
|
|
142
|
-
|
|
143
136
|
def reindex_with_logging
|
|
144
137
|
time_start = Time.zone.now
|
|
145
138
|
|
|
@@ -4,7 +4,7 @@ module Spotlight
|
|
|
4
4
|
class Role < ActiveRecord::Base
|
|
5
5
|
ROLES = %w(admin curator)
|
|
6
6
|
belongs_to :exhibit
|
|
7
|
-
belongs_to :user, class_name:
|
|
7
|
+
belongs_to :user, class_name: Spotlight::Engine.config.user_class, autosave: true
|
|
8
8
|
validates :role, inclusion: { in: ROLES }
|
|
9
9
|
validates :user_key, presence: true
|
|
10
10
|
validate :user_must_exist, if: -> { user_key.present? }
|
|
@@ -21,7 +21,7 @@ module Spotlight
|
|
|
21
21
|
# setting user key causes the user to get set
|
|
22
22
|
def user_key=(key)
|
|
23
23
|
@user_key = key
|
|
24
|
-
self.user ||= ::
|
|
24
|
+
self.user ||= Spotlight::Engine.user_class.find_by_user_key(key)
|
|
25
25
|
user.user_key = key if user
|
|
26
26
|
end
|
|
27
27
|
|
|
@@ -19,20 +19,15 @@ module Spotlight
|
|
|
19
19
|
accepts_nested_attributes_for :thumbnail, update_only: true
|
|
20
20
|
accepts_nested_attributes_for :masthead, update_only: true
|
|
21
21
|
|
|
22
|
-
include Blacklight::SearchHelper
|
|
23
|
-
include Spotlight::Catalog::AccessControlsEnforcement
|
|
24
|
-
|
|
25
22
|
def thumbnail_image_url
|
|
26
23
|
thumbnail.image.thumb.url if thumbnail && thumbnail.image
|
|
27
24
|
end
|
|
28
25
|
|
|
29
|
-
def count
|
|
30
|
-
repository.search(search_builder.with(query_params).rows(0).merge(facet: false))['response']['numFound']
|
|
31
|
-
end
|
|
32
|
-
|
|
33
26
|
def images
|
|
34
|
-
documents.
|
|
35
|
-
|
|
27
|
+
return enum_for(:images) { documents.size } unless block_given?
|
|
28
|
+
|
|
29
|
+
documents.each do |doc|
|
|
30
|
+
yield [
|
|
36
31
|
doc.first(blacklight_config.document_model.unique_key),
|
|
37
32
|
doc.first(blacklight_config.index.title_field),
|
|
38
33
|
doc.first(blacklight_config.index.thumbnail_field)
|
|
@@ -41,10 +36,15 @@ module Spotlight
|
|
|
41
36
|
end
|
|
42
37
|
|
|
43
38
|
def documents
|
|
44
|
-
|
|
39
|
+
start = 0
|
|
40
|
+
response = repository.search(search_params.start(start))
|
|
41
|
+
|
|
42
|
+
return to_enum(:documents) { response['response']['numFound'] } unless block_given?
|
|
45
43
|
|
|
46
|
-
|
|
47
|
-
yield
|
|
44
|
+
while response.documents.present?
|
|
45
|
+
response.documents.each { |x| yield x }
|
|
46
|
+
start += response.documents.length
|
|
47
|
+
response = repository.search(search_params.start(start))
|
|
48
48
|
end
|
|
49
49
|
end
|
|
50
50
|
|
|
@@ -67,15 +67,22 @@ module Spotlight
|
|
|
67
67
|
end
|
|
68
68
|
end
|
|
69
69
|
|
|
70
|
+
def search_params
|
|
71
|
+
search_builder.with(query_params.with_indifferent_access).merge(facet: false, fl: default_search_fields)
|
|
72
|
+
end
|
|
73
|
+
|
|
70
74
|
private
|
|
71
75
|
|
|
72
|
-
def
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
def search_builder_class
|
|
77
|
+
blacklight_config.search_builder_class
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def search_builder
|
|
81
|
+
search_builder_class.new(true, self)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def repository
|
|
85
|
+
Blacklight.default_index
|
|
79
86
|
end
|
|
80
87
|
|
|
81
88
|
def default_search_fields
|
|
@@ -12,8 +12,8 @@ module Spotlight
|
|
|
12
12
|
property :content, exec_context: :decorator
|
|
13
13
|
|
|
14
14
|
def content
|
|
15
|
-
# get the
|
|
16
|
-
represented.content
|
|
15
|
+
# get the original data, bypassing any Sir-Trevor transformations
|
|
16
|
+
represented.read_attribute(:content)
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
delegate :content=, to: :represented
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<%= cache [@exhibit, search, search.
|
|
1
|
+
<%= cache [@exhibit, search, search.documents.size] do %>
|
|
2
2
|
<div class="col-sm-4 col-xs-12 category">
|
|
3
3
|
<%= link_to spotlight.exhibit_browse_path(@exhibit, search) do %>
|
|
4
4
|
<div class="image-overlay">
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<div class="text-overlay">
|
|
7
7
|
<h2 class="browse-category-title">
|
|
8
8
|
<%= search.title%>
|
|
9
|
-
<small><%= t :'spotlight.browse.search.item_count', count: search.
|
|
9
|
+
<small><%= t :'spotlight.browse.search.item_count', count: search.documents.size %></small>
|
|
10
10
|
</h2>
|
|
11
11
|
</div>
|
|
12
12
|
</div>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
<h1><%= search.title %></h1>
|
|
2
|
-
<small class="item-count"><%= t :'spotlight.browse.search.item_count', count: search.
|
|
2
|
+
<small class="item-count"><%= t :'spotlight.browse.search.item_count', count: search.documents.size %></small>
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<div class="pic thumbnail"><%= image_tag(search.thumbnail.image.thumb) if search.thumbnail %></div>
|
|
9
9
|
<div class="main">
|
|
10
10
|
<div class="title panel-title"><%= search.title %></div>
|
|
11
|
-
<div class="count"><%= t :'.item_count', count: search.
|
|
11
|
+
<div class="count"><%= t :'.item_count', count: search.documents.size %></div>
|
|
12
12
|
<div class="actions"><%= exhibit_view_link(search) %> • <%= exhibit_edit_link(search) %> • <%= exhibit_delete_link(search) %></div>
|
|
13
13
|
<%= f.hidden_field :id %>
|
|
14
14
|
<%= f.hidden_field :weight, data: {property: "weight"} %>
|
|
@@ -264,9 +264,9 @@ en:
|
|
|
264
264
|
invitation_mailer:
|
|
265
265
|
invitation_instructions:
|
|
266
266
|
hello: "Hello %{email}!"
|
|
267
|
-
someone_invited_you: "The Exhibits Administrator has invited to
|
|
267
|
+
someone_invited_you: "The Exhibits Administrator has invited you to help work on the \"%{exhibit_name}\" exhibit at %{url}. You can accept this invitation by clicking the link below."
|
|
268
268
|
accept: "Accept invitation"
|
|
269
|
-
ignore_html: "If you don't want to accept the invitation, please ignore this email
|
|
269
|
+
ignore_html: "If you don't want to accept the invitation, please ignore this email. Your account won't be created until you access the link above."
|
|
270
270
|
confirmation_mailer:
|
|
271
271
|
confirmation_instructions:
|
|
272
272
|
welcome: "Welcome %{email}!"
|
data/lib/spotlight/engine.rb
CHANGED
|
@@ -47,6 +47,10 @@ module Spotlight
|
|
|
47
47
|
FactoryGirl.definition_file_paths << File.expand_path('../../../spec/factories', __FILE__) if defined?(FactoryGirl)
|
|
48
48
|
end
|
|
49
49
|
|
|
50
|
+
def self.user_class
|
|
51
|
+
Spotlight::Engine.config.user_class.constantize
|
|
52
|
+
end
|
|
53
|
+
|
|
50
54
|
def self.catalog_controller
|
|
51
55
|
Spotlight::Engine.config.catalog_controller_class.constantize
|
|
52
56
|
end
|
|
@@ -55,6 +59,8 @@ module Spotlight
|
|
|
55
59
|
Spotlight::Engine.config.default_blacklight_config || catalog_controller.blacklight_config
|
|
56
60
|
end
|
|
57
61
|
|
|
62
|
+
Spotlight::Engine.config.user_class = '::User'
|
|
63
|
+
|
|
58
64
|
Spotlight::Engine.config.catalog_controller_class = '::CatalogController'
|
|
59
65
|
Spotlight::Engine.config.default_blacklight_config = nil
|
|
60
66
|
|
data/lib/spotlight/version.rb
CHANGED
|
@@ -60,7 +60,7 @@ namespace :spotlight do
|
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
def prompt_to_create_user
|
|
63
|
-
|
|
63
|
+
Spotlight::Engine.user_class.find_or_create_by!(email: prompt_for_email) do |u|
|
|
64
64
|
puts 'User not found. Enter a password to create the user.'
|
|
65
65
|
u.password = prompt_for_password
|
|
66
66
|
end
|
|
@@ -101,9 +101,9 @@ describe Spotlight::RolesController, type: :controller do
|
|
|
101
101
|
it 'invites the selected user' do
|
|
102
102
|
expect do
|
|
103
103
|
post :invite, exhibit_id: exhibit, user: 'user@example.com', role: 'curator'
|
|
104
|
-
end.to change { ::
|
|
105
|
-
expect(::
|
|
106
|
-
expect(::
|
|
104
|
+
end.to change { Spotlight::Engine.user_class.count }.by(1)
|
|
105
|
+
expect(Spotlight::Engine.user_class.last.roles.length).to eq 1
|
|
106
|
+
expect(Spotlight::Engine.user_class.last.roles.first.exhibit).to eq exhibit
|
|
107
107
|
end
|
|
108
108
|
|
|
109
109
|
it 'adds the user to the exhibit via a role' do
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe Spotlight::Search, type: :model do
|
|
4
|
+
let(:exhibit) { FactoryGirl.create(:exhibit) }
|
|
5
|
+
|
|
4
6
|
let(:query_params) { { 'f' => { 'genre_sim' => ['map'] } } }
|
|
5
|
-
subject {
|
|
7
|
+
subject { exhibit.searches.build(title: 'Search', query_params: query_params) }
|
|
6
8
|
|
|
7
9
|
let(:blacklight_config) { ::CatalogController.blacklight_config }
|
|
8
10
|
let(:document) do
|
|
@@ -15,8 +17,6 @@ describe Spotlight::Search, type: :model do
|
|
|
15
17
|
blacklight_config.index.title_field => 'title')
|
|
16
18
|
end
|
|
17
19
|
|
|
18
|
-
it { is_expected.to be_a Spotlight::Catalog::AccessControlsEnforcement }
|
|
19
|
-
|
|
20
20
|
context 'thumbnail' do
|
|
21
21
|
it 'calls DefaultThumbnailJob to fetch a default feature image' do
|
|
22
22
|
expect(Spotlight::DefaultThumbnailJob).to receive(:perform_later).with(subject)
|
|
@@ -40,14 +40,18 @@ describe Spotlight::Search, type: :model do
|
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
end
|
|
43
|
+
describe 'for a search matching all items' do
|
|
44
|
+
let(:query_params) { {} }
|
|
46
45
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
it 'has items' do
|
|
47
|
+
expect(subject.documents.size).to eq 55
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it 'has images' do
|
|
51
|
+
expect(subject.images.size).to eq(55)
|
|
52
|
+
expect(subject.images.map(&:last)).to include 'https://stacks.stanford.edu/image/dq287tq6352/dq287tq6352_05_0001_thumb',
|
|
53
|
+
'https://stacks.stanford.edu/image/jp266yb7109/jp266yb7109_05_0001_thumb'
|
|
54
|
+
end
|
|
51
55
|
end
|
|
52
56
|
|
|
53
57
|
describe 'default_scope' do
|
|
@@ -79,4 +83,20 @@ describe Spotlight::Search, type: :model do
|
|
|
79
83
|
end
|
|
80
84
|
end
|
|
81
85
|
end
|
|
86
|
+
|
|
87
|
+
describe '#search_params' do
|
|
88
|
+
it 'maps the search to the appropriate facet values' do
|
|
89
|
+
expect(subject.search_params.to_hash).to include 'fq' => array_including('{!raw f=genre_sim}map')
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
context 'with filter_resources_by_exhibit configured' do
|
|
93
|
+
before do
|
|
94
|
+
allow(Spotlight::Engine.config).to receive(:filter_resources_by_exhibit).and_return(true)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
it 'includes the exhibit context' do
|
|
98
|
+
expect(subject.search_params.to_hash).to include 'fq' => array_including("spotlight_exhibit_slug_#{exhibit.slug}_bsi:true")
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
82
102
|
end
|
|
@@ -189,6 +189,7 @@ describe Spotlight::ExhibitExportSerializer do
|
|
|
189
189
|
let(:thumbnail) { FactoryGirl.create(:featured_image) }
|
|
190
190
|
|
|
191
191
|
before do
|
|
192
|
+
feature_page.content = { data: [{ type: 'text', data: { text: 'xyz' } }] }.to_json
|
|
192
193
|
feature_page.thumbnail = thumbnail
|
|
193
194
|
feature_page.save
|
|
194
195
|
end
|
|
@@ -199,8 +200,14 @@ describe Spotlight::ExhibitExportSerializer do
|
|
|
199
200
|
end
|
|
200
201
|
|
|
201
202
|
it 'copies the thumbnail' do
|
|
202
|
-
expect(subject.
|
|
203
|
-
expect(subject.
|
|
203
|
+
expect(subject.feature_pages.first.thumbnail).not_to be_blank
|
|
204
|
+
expect(subject.feature_pages.first.thumbnail.image.file.path).not_to eq source_exhibit.feature_pages.first.thumbnail.image.file.path
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
it 'copies the content' do
|
|
208
|
+
expect(JSON.parse(subject.feature_pages.first.read_attribute(:content))).to have_key 'data'
|
|
209
|
+
expect(subject.feature_pages.first.content.length).to eq 1
|
|
210
|
+
expect(subject.feature_pages.first.content.first).to be_a_kind_of SirTrevorRails::Blocks::TextBlock
|
|
204
211
|
end
|
|
205
212
|
end
|
|
206
213
|
|
data/spec/spec_helper.rb
CHANGED
|
@@ -59,7 +59,7 @@ RSpec.configure do |config|
|
|
|
59
59
|
DatabaseCleaner.start
|
|
60
60
|
|
|
61
61
|
# The first user is automatically granted admin privileges; we don't want that behavior for many of our tests
|
|
62
|
-
|
|
62
|
+
Spotlight::Engine.user_class.create email: 'initial+admin@example.com', password: 'password', password_confirmation: 'password'
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
config.after do
|
|
@@ -32,7 +32,7 @@ module Spotlight
|
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
describe 'when user is logged in' do
|
|
35
|
-
let(:current_user) { ::
|
|
35
|
+
let(:current_user) { Spotlight::Engine.user_class.new }
|
|
36
36
|
it 'renders the links' do
|
|
37
37
|
render
|
|
38
38
|
expect(rendered).to have_link 'Feedback'
|
|
@@ -42,7 +42,7 @@ module Spotlight
|
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
describe 'when user is a curator' do
|
|
45
|
-
let(:current_user) { ::
|
|
45
|
+
let(:current_user) { Spotlight::Engine.user_class.new }
|
|
46
46
|
before do
|
|
47
47
|
allow(view).to receive(:can?).with(:update, current_exhibit).and_return(false)
|
|
48
48
|
allow(view).to receive(:can?).with(:create, Spotlight::Exhibit).and_return(false)
|
|
@@ -56,7 +56,7 @@ module Spotlight
|
|
|
56
56
|
end
|
|
57
57
|
end
|
|
58
58
|
describe 'when user is an admin' do
|
|
59
|
-
let(:current_user) { ::
|
|
59
|
+
let(:current_user) { Spotlight::Engine.user_class.new }
|
|
60
60
|
before do
|
|
61
61
|
allow(view).to receive(:can?).with(:update, current_exhibit).and_return(true)
|
|
62
62
|
allow(view).to receive(:can?).with(:create, Spotlight::Exhibit).and_return(false)
|
|
@@ -71,7 +71,7 @@ module Spotlight
|
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
describe 'when user is a site-wide admin' do
|
|
74
|
-
let(:current_user) { ::
|
|
74
|
+
let(:current_user) { Spotlight::Engine.user_class.new }
|
|
75
75
|
before do
|
|
76
76
|
allow(view).to receive(:can?).with(:update, current_exhibit).and_return(true)
|
|
77
77
|
allow(view).to receive(:can?).with(:create, Spotlight::Exhibit).and_return(true)
|
|
@@ -4,7 +4,7 @@ describe 'spotlight/browse/search', type: :view do
|
|
|
4
4
|
let(:search) { FactoryGirl.create(:search) }
|
|
5
5
|
let(:exhibit) { FactoryGirl.create(:exhibit) }
|
|
6
6
|
before :each do
|
|
7
|
-
allow(search).to receive_messages(
|
|
7
|
+
allow(search).to receive_messages(documents: double(size: 15))
|
|
8
8
|
allow(search).to receive_message_chain(:thumbnail, :image, thumb: '/some/image')
|
|
9
9
|
end
|
|
10
10
|
|
|
@@ -24,6 +24,6 @@ describe 'spotlight/browse/search', type: :view do
|
|
|
24
24
|
|
|
25
25
|
it 'displays the item count' do
|
|
26
26
|
render partial: 'spotlight/browse/search', locals: { search: search }
|
|
27
|
-
expect(response).to have_selector 'small', text: /#{search.
|
|
27
|
+
expect(response).to have_selector 'small', text: /#{search.documents.size} items/i
|
|
28
28
|
end
|
|
29
29
|
end
|
|
@@ -8,7 +8,7 @@ describe 'spotlight/browse/show', type: :view do
|
|
|
8
8
|
allow(view).to receive_messages(exhibit_masthead?: true)
|
|
9
9
|
allow(view).to receive_messages(blacklight_config: Blacklight::Configuration.new)
|
|
10
10
|
view.blacklight_config.view.gallery = true
|
|
11
|
-
allow(search).to receive_messages(
|
|
11
|
+
allow(search).to receive_messages(documents: double(size: 15))
|
|
12
12
|
allow(view).to receive_messages(render_document_index_with_view: '')
|
|
13
13
|
stub_template('_results_pagination.html.erb' => '')
|
|
14
14
|
stub_template('_sort_and_per_page.html.erb' => 'Sort and Per Page actions')
|
|
@@ -23,14 +23,14 @@ describe 'spotlight/browse/show', type: :view do
|
|
|
23
23
|
it 'has a heading and item count when there is no current search masthead' do
|
|
24
24
|
render
|
|
25
25
|
expect(response).to have_selector 'h1', text: search.title
|
|
26
|
-
expect(response).to have_selector '.item-count', text: "#{search.
|
|
26
|
+
expect(response).to have_selector '.item-count', text: "#{search.documents.size} items"
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
it 'does not have the heading and item count when there is a current search masthead' do
|
|
30
30
|
allow(view).to receive_messages(exhibit_masthead?: false)
|
|
31
31
|
render
|
|
32
32
|
expect(response).to_not have_selector 'h1', text: search.title
|
|
33
|
-
expect(response).to_not have_selector '.item-count', text: "#{search.
|
|
33
|
+
expect(response).to_not have_selector '.item-count', text: "#{search.documents.size} items"
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
it 'has an edit button' do
|
|
@@ -4,7 +4,7 @@ module Spotlight
|
|
|
4
4
|
describe 'spotlight/exhibits/index', type: :view do
|
|
5
5
|
let(:exhibits) { Spotlight::Exhibit.none }
|
|
6
6
|
let(:ability) { ::Ability.new(user) }
|
|
7
|
-
let(:user) { ::
|
|
7
|
+
let(:user) { Spotlight::Engine.user_class.new }
|
|
8
8
|
|
|
9
9
|
before do
|
|
10
10
|
assign(:exhibits, exhibits)
|
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
|
2
2
|
|
|
3
3
|
module Spotlight
|
|
4
4
|
describe 'spotlight/roles/index', type: :view do
|
|
5
|
-
let(:user) { stub_model(::
|
|
5
|
+
let(:user) { stub_model(Spotlight::Engine.user_class, email: 'jane@example.com') }
|
|
6
6
|
|
|
7
7
|
let(:exhibit) { FactoryGirl.create(:exhibit) }
|
|
8
8
|
let(:admin_role) { FactoryGirl.create(:role, role: 'admin', user: user, exhibit: exhibit) }
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: blacklight-spotlight
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.12.
|
|
4
|
+
version: 0.12.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chris Beer
|
|
@@ -11,7 +11,7 @@ authors:
|
|
|
11
11
|
autorequire:
|
|
12
12
|
bindir: bin
|
|
13
13
|
cert_chain: []
|
|
14
|
-
date: 2015-12-
|
|
14
|
+
date: 2015-12-11 00:00:00.000000000 Z
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
17
17
|
name: rails
|
|
@@ -1058,6 +1058,7 @@ files:
|
|
|
1058
1058
|
- app/views/spotlight/sir_trevor/blocks/videos/_youtube.html.erb
|
|
1059
1059
|
- app/views/spotlight/tags/index.html.erb
|
|
1060
1060
|
- config/jetty.yml
|
|
1061
|
+
- config/locales/devise.en.yml
|
|
1061
1062
|
- config/locales/social_share_button.en.yml
|
|
1062
1063
|
- config/locales/spotlight.en.yml
|
|
1063
1064
|
- config/routes.rb
|
|
@@ -1097,6 +1098,7 @@ files:
|
|
|
1097
1098
|
- db/migrate/20151124101123_remove_default_from_spotlight_exhibit.rb
|
|
1098
1099
|
- db/migrate/20151124105543_update_custom_field_names.rb
|
|
1099
1100
|
- db/migrate/20151208085432_add_weight_to_exhibits.rb
|
|
1101
|
+
- db/migrate/20151210073829_create_spotlight_configuration.rb
|
|
1100
1102
|
- lib/blacklight/spotlight.rb
|
|
1101
1103
|
- lib/generators/spotlight/install_generator.rb
|
|
1102
1104
|
- lib/generators/spotlight/templates/catalog_controller.rb
|