blacklight-spotlight 0.21.0 → 0.22.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/app/assets/javascripts/spotlight/application.js +0 -1
- data/app/assets/javascripts/spotlight/spotlight.js +0 -3
- data/app/assets/stylesheets/spotlight/_footer.scss +0 -14
- data/app/models/concerns/spotlight/ar_light.rb +0 -8
- data/app/models/spotlight/reindex_progress.rb +3 -3
- data/app/models/spotlight/resource.rb +16 -10
- data/app/views/shared/_footer.html.erb +0 -6
- data/lib/generators/spotlight/install_generator.rb +1 -2
- data/lib/generators/spotlight/templates/spotlight.scss +0 -1
- data/lib/spotlight/engine.rb +0 -1
- data/lib/spotlight/version.rb +1 -1
- data/lib/tasks/spotlight_tasks.rake +2 -2
- data/spec/models/spotlight/reindex_progress_spec.rb +15 -2
- data/spec/models/spotlight/resource_spec.rb +5 -0
- data/spec/test_app_templates/Gemfile.extra +0 -1
- data/spec/views/shared/_footer.html.erb_spec.rb +0 -7
- metadata +2 -17
- data/lib/generators/spotlight/templates/config/initializers/social_share_button.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 136e58b1c7ddacee60a975326d3b482f88a19bb6
|
4
|
+
data.tar.gz: 607da59315b2155874802b87f117b940f358abc7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 531b33a80abda0a690e4120bcb4776bbadfe7bc4bba9d23a2e39f5878749547877a07b1a162596da47a8ca476a158215367d73e667ef226cf12bd6cdd97bf455
|
7
|
+
data.tar.gz: 9bfe3194807b9b227d768a63da611409f317a7d8e9e92b5e225ef0c6585e5d5ca9e640198066feea688903f5d8f36e85775ad45e2f1bb04c9c896641bfa2229a
|
data/Rakefile
CHANGED
@@ -9,18 +9,4 @@
|
|
9
9
|
bottom: 0;
|
10
10
|
height: $footer-height;
|
11
11
|
width: 100%;
|
12
|
-
|
13
|
-
.social-share-button {
|
14
|
-
a {
|
15
|
-
display: block;
|
16
|
-
margin-bottom: 5px;
|
17
|
-
padding-left: 18px;
|
18
|
-
text-indent: 10px;
|
19
|
-
color: $gray-light;
|
20
|
-
}
|
21
|
-
a:hover, a:focus {
|
22
|
-
color: $gray;
|
23
|
-
text-decoration: none;
|
24
|
-
}
|
25
|
-
}
|
26
12
|
}
|
@@ -17,7 +17,7 @@ module Spotlight
|
|
17
17
|
def started_at
|
18
18
|
return unless resources.present?
|
19
19
|
|
20
|
-
@started ||= resources.min_by(&:enqueued_at).enqueued_at
|
20
|
+
@started ||= resources.select(&:enqueued_at?).min_by(&:enqueued_at).enqueued_at
|
21
21
|
end
|
22
22
|
|
23
23
|
def updated_at
|
@@ -34,11 +34,11 @@ module Spotlight
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def total
|
37
|
-
@total ||= resources.map(&:last_indexed_estimate).sum
|
37
|
+
@total ||= resources.map(&:last_indexed_estimate).compact.sum
|
38
38
|
end
|
39
39
|
|
40
40
|
def completed
|
41
|
-
@completed ||= completed_resources.map(&:last_indexed_count).sum
|
41
|
+
@completed ||= completed_resources.map(&:last_indexed_count).compact.sum
|
42
42
|
end
|
43
43
|
|
44
44
|
def errored?
|
@@ -49,19 +49,15 @@ module Spotlight
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def enqueued_at
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
52
|
+
cast_to_date_time(super)
|
53
|
+
end
|
54
|
+
|
55
|
+
def enqueued_at?
|
56
|
+
enqueued_at.present?
|
57
57
|
end
|
58
58
|
|
59
59
|
def last_indexed_finished
|
60
|
-
|
61
|
-
ActiveModel::Type::DateTime.new.cast(super)
|
62
|
-
else
|
63
|
-
ActiveRecord::Type::DateTime.new.type_cast_from_database(super)
|
64
|
-
end
|
60
|
+
cast_to_date_time(super)
|
65
61
|
end
|
66
62
|
|
67
63
|
def document_model
|
@@ -141,6 +137,16 @@ module Spotlight
|
|
141
137
|
def write?
|
142
138
|
Spotlight::Engine.config.writable_index
|
143
139
|
end
|
140
|
+
|
141
|
+
def cast_to_date_time(value)
|
142
|
+
return unless value
|
143
|
+
|
144
|
+
if defined? ActiveModel::Type::DateTime
|
145
|
+
ActiveModel::Type::DateTime.new.cast(value)
|
146
|
+
else
|
147
|
+
ActiveRecord::Type::DateTime.new.type_cast_from_database(value)
|
148
|
+
end
|
149
|
+
end
|
144
150
|
end
|
145
151
|
end
|
146
152
|
end
|
data/lib/spotlight/engine.rb
CHANGED
data/lib/spotlight/version.rb
CHANGED
@@ -4,14 +4,14 @@ namespace :spotlight do
|
|
4
4
|
puts 'Creating an initial admin user.'
|
5
5
|
u = prompt_to_create_user
|
6
6
|
|
7
|
-
Spotlight::Role.create(user: u, resource:
|
7
|
+
Spotlight::Role.create(user: u, resource: Spotlight::Site.instance, role: 'admin')
|
8
8
|
puts 'User created.'
|
9
9
|
end
|
10
10
|
|
11
11
|
desc 'Add application-wide admin privileges to a user'
|
12
12
|
task admin: :environment do
|
13
13
|
u = prompt_to_create_user
|
14
|
-
Spotlight::Role.create(user: u, resource:
|
14
|
+
Spotlight::Role.create(user: u, resource: Spotlight::Site.instance, role: 'admin')
|
15
15
|
end
|
16
16
|
|
17
17
|
desc 'Create a new exhibit'
|
@@ -26,7 +26,15 @@ describe Spotlight::ReindexProgress, type: :model do
|
|
26
26
|
index_status: 1
|
27
27
|
)
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
|
+
let(:new_resource) do
|
31
|
+
FactoryGirl.create(
|
32
|
+
:resource,
|
33
|
+
index_status: 0
|
34
|
+
)
|
35
|
+
end
|
36
|
+
|
37
|
+
let(:resources) { [first_resource, last_resource, new_resource] }
|
30
38
|
subject { described_class.new(Spotlight::Resource.all) }
|
31
39
|
let(:json) { JSON.parse(subject.to_json) }
|
32
40
|
|
@@ -35,13 +43,14 @@ describe Spotlight::ReindexProgress, type: :model do
|
|
35
43
|
end
|
36
44
|
|
37
45
|
describe '#recently_in_progress?' do
|
46
|
+
let(:resources) { [first_resource, last_resource] }
|
38
47
|
context 'when the last resource has been updated within the allotted time' do
|
39
48
|
it 'is true' do
|
40
49
|
expect(subject).to be_recently_in_progress
|
41
50
|
end
|
42
51
|
end
|
43
52
|
|
44
|
-
context 'when any of the resources is
|
53
|
+
context 'when any of the resources is marked as waiting' do
|
45
54
|
before do
|
46
55
|
first_resource.waiting!
|
47
56
|
end
|
@@ -75,6 +84,8 @@ describe Spotlight::ReindexProgress, type: :model do
|
|
75
84
|
end
|
76
85
|
|
77
86
|
describe '#updated_at' do
|
87
|
+
let(:resources) { [first_resource, last_resource] }
|
88
|
+
|
78
89
|
it 'returns the updated_at attribute of the last resource' do
|
79
90
|
expect(subject.updated_at).to eq updated_time
|
80
91
|
end
|
@@ -85,6 +96,8 @@ describe Spotlight::ReindexProgress, type: :model do
|
|
85
96
|
end
|
86
97
|
|
87
98
|
describe '#finished_at' do
|
99
|
+
let(:resources) { [first_resource, last_resource] }
|
100
|
+
|
88
101
|
it 'returns the updated_at attribute of the last resource' do
|
89
102
|
expect(subject.finished_at).to eq finish_time
|
90
103
|
end
|
@@ -11,6 +11,11 @@ describe Spotlight::Resource, type: :model do
|
|
11
11
|
|
12
12
|
expect(subject.enqueued_at).to eq t
|
13
13
|
end
|
14
|
+
|
15
|
+
it 'handles blank values' do
|
16
|
+
subject.enqueued_at = nil
|
17
|
+
expect(subject.enqueued_at).to be_nil
|
18
|
+
end
|
14
19
|
end
|
15
20
|
|
16
21
|
describe '#last_indexed_finished' do
|
@@ -10,11 +10,4 @@ describe 'shared/_footer', type: :view do
|
|
10
10
|
render
|
11
11
|
expect(rendered).to have_content 'analytics'
|
12
12
|
end
|
13
|
-
|
14
|
-
it 'displays social media links' do
|
15
|
-
render
|
16
|
-
expect(rendered).to have_selector('footer .social-share-button a.ssb-icon[title="Twitter"]')
|
17
|
-
expect(rendered).to have_selector('footer .social-share-button a.ssb-icon[title="Facebook"]')
|
18
|
-
expect(rendered).to have_selector('footer .social-share-button a.ssb-icon[title="Google+"]')
|
19
|
-
end
|
20
13
|
end
|
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.
|
4
|
+
version: 0.22.0
|
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: 2016-08-
|
14
|
+
date: 2016-08-02 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|
@@ -193,20 +193,6 @@ dependencies:
|
|
193
193
|
- - "~>"
|
194
194
|
- !ruby/object:Gem::Version
|
195
195
|
version: 2.3.0
|
196
|
-
- !ruby/object:Gem::Dependency
|
197
|
-
name: social-share-button
|
198
|
-
requirement: !ruby/object:Gem::Requirement
|
199
|
-
requirements:
|
200
|
-
- - "~>"
|
201
|
-
- !ruby/object:Gem::Version
|
202
|
-
version: '0.3'
|
203
|
-
type: :runtime
|
204
|
-
prerelease: false
|
205
|
-
version_requirements: !ruby/object:Gem::Requirement
|
206
|
-
requirements:
|
207
|
-
- - "~>"
|
208
|
-
- !ruby/object:Gem::Version
|
209
|
-
version: '0.3'
|
210
196
|
- !ruby/object:Gem::Dependency
|
211
197
|
name: blacklight-gallery
|
212
198
|
requirement: !ruby/object:Gem::Requirement
|
@@ -1151,7 +1137,6 @@ files:
|
|
1151
1137
|
- lib/generators/spotlight/install_generator.rb
|
1152
1138
|
- lib/generators/spotlight/templates/catalog_controller.rb
|
1153
1139
|
- lib/generators/spotlight/templates/config/initializers/riiif.rb
|
1154
|
-
- lib/generators/spotlight/templates/config/initializers/social_share_button.rb
|
1155
1140
|
- lib/generators/spotlight/templates/config/sitemap.rb
|
1156
1141
|
- lib/generators/spotlight/templates/solr/config/schema.xml
|
1157
1142
|
- lib/generators/spotlight/templates/solr/config/solrconfig.xml
|