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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 283d5c887e24780d4fa2c2eb0d8ea95c2716f383
4
- data.tar.gz: 4510724deeb46830e4d3b1b97477332908935850
3
+ metadata.gz: 136e58b1c7ddacee60a975326d3b482f88a19bb6
4
+ data.tar.gz: 607da59315b2155874802b87f117b940f358abc7
5
5
  SHA512:
6
- metadata.gz: 79f52fe10b09af9e316d7a42a07a6f8cc55ff1fa06b83d64bddc2e9255c36fe1539ce5402bafd7ae6070cfd06b7bc612de5ab14548a6231b715f5e52a9393d38
7
- data.tar.gz: 205927e362eee400c93ac200889701f948d681f5a2594ab85735ef5d79d56ae0471c809e731dbb7fd1f4114857abf535e79e63dfb36f0faa9ea35a8a87b6277b
6
+ metadata.gz: 531b33a80abda0a690e4120bcb4776bbadfe7bc4bba9d23a2e39f5878749547877a07b1a162596da47a8ca476a158215367d73e667ef226cf12bd6cdd97bf455
7
+ data.tar.gz: 9bfe3194807b9b227d768a63da611409f317a7d8e9e92b5e225ef0c6585e5d5ca9e640198066feea688903f5d8f36e85775ad45e2f1bb04c9c896641bfa2229a
data/Rakefile CHANGED
@@ -110,4 +110,4 @@ namespace :spotlight do
110
110
  end
111
111
  end
112
112
 
113
- task default: [:ci, :rubocop]
113
+ task default: [:rubocop, :ci]
@@ -21,7 +21,6 @@
21
21
  //= require bootstrap/popover
22
22
  //= require bootstrap/carousel
23
23
  //= require bootstrap-tagsinput
24
- //= require social-share-button
25
24
  //= require jquery.serializejson
26
25
 
27
26
  //= require_tree .
@@ -19,8 +19,5 @@ Blacklight.onLoad(function() {
19
19
 
20
20
  Spotlight.onLoad(function(){
21
21
  SpotlightNestable.init();
22
- $.each($('.social-share-button a'), function() {
23
- $(this).append($(this).attr('title'));
24
- });
25
22
  });
26
23
 
@@ -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
  }
@@ -30,14 +30,6 @@ module Spotlight
30
30
  false
31
31
  end
32
32
 
33
- def generated_feature_methods
34
- @generated_feature_methods ||= begin
35
- mod = const_set(:GeneratedFeatureMethods, Module.new)
36
- include mod
37
- mod
38
- end
39
- end
40
-
41
33
  def before_destroy(*_args)
42
34
  end
43
35
 
@@ -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
- if defined? ActiveModel::Type::DateTime
53
- ActiveModel::Type::DateTime.new.cast(super)
54
- else
55
- ActiveRecord::Type::DateTime.new.type_cast_from_database(super)
56
- end
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
- if defined? ActiveModel::Type::DateTime
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
@@ -1,7 +1 @@
1
- <footer class="site-footer">
2
- <div class="row">
3
- <%= render 'shared/share_follow' %>
4
- </div>
5
- </footer>
6
-
7
1
  <%= render 'shared/analytics' %>
@@ -118,8 +118,7 @@ module Spotlight
118
118
  end
119
119
  end
120
120
 
121
- def generate_social_share_button_initializer
122
- gem 'social-share-button', github: 'cbeer/social-share-button', branch: 'on_load'
121
+ def generate_config
123
122
  directory 'config'
124
123
  end
125
124
 
@@ -1,5 +1,4 @@
1
1
  /*
2
- *= require social-share-button
3
2
  *= require bootstrap-tagsinput
4
3
  *= require jquery.jcrop
5
4
  */
@@ -28,7 +28,6 @@ module Spotlight
28
28
 
29
29
  require 'carrierwave'
30
30
  require 'carrierwave/crop'
31
- require 'social-share-button'
32
31
  require 'lodash-rails'
33
32
  require 'github/markup'
34
33
  require 'sir_trevor_rails'
@@ -1,3 +1,3 @@
1
1
  module Spotlight
2
- VERSION = '0.21.0'.freeze
2
+ VERSION = '0.22.0'.freeze
3
3
  end
@@ -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: nil, role: 'admin')
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: nil, role: 'admin')
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
- let(:resources) { [first_resource, last_resource] }
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 makred as waiting' do
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
@@ -1,2 +1 @@
1
1
  gem 'friendly_id', github: 'norman/friendly_id'
2
- gem 'social-share-button', github: 'cbeer/social-share-button', branch: 'on_load'
@@ -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.21.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-01 00:00:00.000000000 Z
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
@@ -1,3 +0,0 @@
1
- SocialShareButton.configure do |config|
2
- config.allow_sites = %w(twitter facebook google_plus)
3
- end