blacklight-spotlight 0.22.0 → 0.23.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/spotlight/application.js +1 -0
- data/app/assets/javascripts/spotlight/copy_email_addresses.js +9 -0
- data/app/controllers/concerns/spotlight/controller.rb +1 -1
- data/app/models/concerns/spotlight/user.rb +2 -0
- data/app/models/spotlight/reindex_progress.rb +5 -1
- data/app/views/spotlight/admin_users/index.html.erb +10 -0
- data/app/views/spotlight/search_configurations/_document_index_view_types.html.erb +1 -1
- data/config/locales/spotlight.en.yml +2 -0
- data/lib/spotlight/engine.rb +1 -0
- data/lib/spotlight/version.rb +1 -1
- data/spec/features/javascript/reindex_monitor_spec.rb +2 -1
- data/spec/features/site_admin_management_spec.rb +13 -1
- data/spec/lib/spotlight/controller_spec.rb +16 -1
- data/spec/models/spotlight/reindex_progress_spec.rb +8 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d51b05fb4abe823ca225314173cd629c12a963ec
|
4
|
+
data.tar.gz: 8ee0d3c095e06d42de53f10f2041c929948192be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9dba2d6f177687cba357fdee4948c3af932983c4c8c2c16b8371ea8ccc6ec42778ac952083255a1d5cc891e465597736a7fa09fb58ead53f620540267892408d
|
7
|
+
data.tar.gz: 28a1090a7a5aaa46f12eed7a9e11f994b7f48ca1ec2fa4bb102d7ba0c18dbc9f056f6da8b3ac0bc585c4d56b257591d8525ac313e50e171775dd72f861abb459
|
@@ -82,7 +82,7 @@ module Spotlight
|
|
82
82
|
|
83
83
|
def exhibit_search_facet_url(*args)
|
84
84
|
options = args.extract_options!
|
85
|
-
options = params.to_unsafe_h.merge(options).except(:exhibit_id, :only_path)
|
85
|
+
options = Blacklight::Parameters.sanitize(params.to_unsafe_h.with_indifferent_access).merge(options).except(:exhibit_id, :only_path)
|
86
86
|
spotlight.facet_exhibit_catalog_url(current_exhibit, *args, options)
|
87
87
|
end
|
88
88
|
end
|
@@ -7,6 +7,8 @@ module Spotlight
|
|
7
7
|
has_many :roles, class_name: 'Spotlight::Role', dependent: :destroy
|
8
8
|
has_many :exhibits, class_name: 'Spotlight::Exhibit', through: :roles, source: 'resource', source_type: 'Spotlight::Exhibit'
|
9
9
|
|
10
|
+
scope :with_roles, -> { where(id: Spotlight::Role.uniq.pluck(:user_id)) }
|
11
|
+
|
10
12
|
before_create :add_default_roles
|
11
13
|
end
|
12
14
|
|
@@ -17,7 +17,11 @@ module Spotlight
|
|
17
17
|
def started_at
|
18
18
|
return unless resources.present?
|
19
19
|
|
20
|
-
|
20
|
+
enqueued_resources = resources.select(&:enqueued_at?)
|
21
|
+
|
22
|
+
return unless enqueued_resources.any?
|
23
|
+
|
24
|
+
@started ||= enqueued_resources.min_by(&:enqueued_at).enqueued_at
|
21
25
|
end
|
22
26
|
|
23
27
|
def updated_at
|
@@ -50,6 +50,16 @@
|
|
50
50
|
</div>
|
51
51
|
</div>
|
52
52
|
<% end %>
|
53
|
+
|
54
|
+
<p class="instructions"><%= t :'.all_users' %></p>
|
55
|
+
<div id="all_users" class="well well-sm">
|
56
|
+
<div class='btn-toolbar pull-right'>
|
57
|
+
<button class="btn btn-xs btn-default copy-email-addresses" data-clipboard-target="#all_users">
|
58
|
+
Copy
|
59
|
+
</button>
|
60
|
+
</div>
|
61
|
+
<%= Spotlight::Engine.user_class.with_roles.pluck(:email).sort.join(', ') %>
|
62
|
+
</div>
|
53
63
|
</div>
|
54
64
|
|
55
65
|
<aside class="col-md-3">
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<%= f.form_group :document_index_view_types, label: {text: t(:'.label')} do %>
|
2
2
|
<%= f.fields_for :document_index_view_types, @blacklight_configuration.document_index_view_types_selected_hash do |vt| %>
|
3
3
|
<% @blacklight_configuration.default_blacklight_config.view.select { |_k, v| v.if != false }.keys.each do |key| %>
|
4
|
-
<%= vt.check_box key %>
|
4
|
+
<%= vt.check_box key, label: view_label(key) %>
|
5
5
|
<% end %>
|
6
6
|
<% end %>
|
7
7
|
<% end %>
|
@@ -136,6 +136,8 @@ en:
|
|
136
136
|
section: Manage exhibits
|
137
137
|
page_title: Manage administrators
|
138
138
|
instructions: Existing exhibits administrators
|
139
|
+
all_users: Administrators and curators of all exhibits
|
140
|
+
copy: Copy
|
139
141
|
add: Add new administrator
|
140
142
|
destroy: Remove from role
|
141
143
|
save: Add role
|
data/lib/spotlight/engine.rb
CHANGED
data/lib/spotlight/version.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
feature 'Reindex Monitor', js: true do
|
2
2
|
let(:resources) do
|
3
|
-
[FactoryGirl.create(:resource
|
3
|
+
[FactoryGirl.create(:resource)]
|
4
4
|
end
|
5
5
|
let(:exhibit) { FactoryGirl.create(:exhibit, resources: resources) }
|
6
6
|
let(:exhibit_curator) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }
|
7
7
|
|
8
8
|
before do
|
9
|
+
resources.each(&:waiting!)
|
9
10
|
login_as exhibit_curator
|
10
11
|
visit spotlight.admin_exhibit_catalog_path(exhibit)
|
11
12
|
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
describe 'Site admin management', js: true do
|
2
2
|
let(:user) { FactoryGirl.create(:site_admin) }
|
3
|
-
let(:existing_user) { FactoryGirl.create(:exhibit_visitor) }
|
3
|
+
let!(:existing_user) { FactoryGirl.create(:exhibit_visitor) }
|
4
|
+
let!(:exhibit_admin) { FactoryGirl.create(:exhibit_admin) }
|
5
|
+
let!(:exhibit_curator) { FactoryGirl.create(:exhibit_curator) }
|
4
6
|
|
5
7
|
before do
|
6
8
|
login_as(user)
|
@@ -11,6 +13,16 @@ describe 'Site admin management', js: true do
|
|
11
13
|
expect(page).to have_css('td', text: user.email)
|
12
14
|
end
|
13
15
|
|
16
|
+
describe 'copy email addresses' do
|
17
|
+
it 'displays only email addresses of users w/ roles' do
|
18
|
+
expect(page).to have_css('div#all_users', text: user.email)
|
19
|
+
expect(page).to have_css('div#all_users', text: exhibit_admin.email)
|
20
|
+
expect(page).to have_css('div#all_users', text: exhibit_curator.email)
|
21
|
+
expect(page).not_to have_css('div#all_users', text: existing_user.email)
|
22
|
+
expect(page).to have_css('button.copy-email-addresses')
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
14
26
|
it 'allows for existing users to be added as site adminstrators' do
|
15
27
|
expect(page).not_to have_css('td', text: existing_user.email)
|
16
28
|
click_link 'Add new administrator'
|
@@ -6,8 +6,10 @@ describe Spotlight::Controller do
|
|
6
6
|
|
7
7
|
subject { MockController.new }
|
8
8
|
|
9
|
+
let(:params) { { action: 'show' } }
|
10
|
+
|
9
11
|
before do
|
10
|
-
allow(subject).to receive_messages(params:
|
12
|
+
allow(subject).to receive_messages(params: ActionController::Parameters.new(params))
|
11
13
|
end
|
12
14
|
|
13
15
|
describe '#current_exhibit' do
|
@@ -82,4 +84,17 @@ describe Spotlight::Controller do
|
|
82
84
|
expect(subject.resource_masthead?).to eq false
|
83
85
|
end
|
84
86
|
end
|
87
|
+
|
88
|
+
describe '#exhibit_search_facet_url' do
|
89
|
+
let(:exhibit) { FactoryGirl.create(:exhibit) }
|
90
|
+
let(:params) { { action: 'index', q: 'xyz' } }
|
91
|
+
|
92
|
+
before do
|
93
|
+
allow(subject).to receive(:current_exhibit).and_return(exhibit)
|
94
|
+
end
|
95
|
+
it 'adds the current exhibit context to the route' do
|
96
|
+
expect(subject.spotlight).to receive(:facet_exhibit_catalog_url).with(exhibit, id: 'some_field', q: 'xyz')
|
97
|
+
subject.exhibit_search_facet_url(id: 'some_field')
|
98
|
+
end
|
99
|
+
end
|
85
100
|
end
|
@@ -81,6 +81,14 @@ describe Spotlight::ReindexProgress, type: :model do
|
|
81
81
|
it 'is included in the json as a localized string' do
|
82
82
|
expect(json['started_at']).to eq I18n.l(start_time, format: :short)
|
83
83
|
end
|
84
|
+
|
85
|
+
context 'with unqueued resources' do
|
86
|
+
subject { described_class.new(Spotlight::Resource.where(id: new_resource.id)) }
|
87
|
+
|
88
|
+
it 'returns the indexed_at attribute of the first resource' do
|
89
|
+
expect(subject.started_at).to be_nil
|
90
|
+
end
|
91
|
+
end
|
84
92
|
end
|
85
93
|
|
86
94
|
describe '#updated_at' do
|
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.23.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-03 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|
@@ -431,6 +431,20 @@ dependencies:
|
|
431
431
|
- - ">="
|
432
432
|
- !ruby/object:Gem::Version
|
433
433
|
version: '0'
|
434
|
+
- !ruby/object:Gem::Dependency
|
435
|
+
name: clipboard-rails
|
436
|
+
requirement: !ruby/object:Gem::Requirement
|
437
|
+
requirements:
|
438
|
+
- - "~>"
|
439
|
+
- !ruby/object:Gem::Version
|
440
|
+
version: '1.5'
|
441
|
+
type: :runtime
|
442
|
+
prerelease: false
|
443
|
+
version_requirements: !ruby/object:Gem::Requirement
|
444
|
+
requirements:
|
445
|
+
- - "~>"
|
446
|
+
- !ruby/object:Gem::Version
|
447
|
+
version: '1.5'
|
434
448
|
- !ruby/object:Gem::Dependency
|
435
449
|
name: sqlite3
|
436
450
|
requirement: !ruby/object:Gem::Requirement
|
@@ -747,6 +761,7 @@ files:
|
|
747
761
|
- app/assets/javascripts/spotlight/catalog_edit.js
|
748
762
|
- app/assets/javascripts/spotlight/check_user_existence.js
|
749
763
|
- app/assets/javascripts/spotlight/compat.js
|
764
|
+
- app/assets/javascripts/spotlight/copy_email_addresses.js
|
750
765
|
- app/assets/javascripts/spotlight/croppable.js
|
751
766
|
- app/assets/javascripts/spotlight/edit_in_place.js
|
752
767
|
- app/assets/javascripts/spotlight/exhibits.js
|