blacklight-spotlight 0.17.0 → 0.17.1
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/controllers/concerns/spotlight/config.rb +2 -2
- data/app/controllers/spotlight/concerns/application_controller.rb +1 -1
- data/app/helpers/spotlight/title_helper.rb +0 -10
- data/app/models/concerns/spotlight/default_thumbnailable.rb +1 -1
- data/app/models/concerns/spotlight/image_derivatives.rb +2 -2
- data/app/models/spotlight/exhibit.rb +1 -1
- data/app/views/spotlight/searches/index.html.erb +1 -1
- data/app/views/spotlight/tags/index.html.erb +1 -1
- data/lib/spotlight/version.rb +1 -1
- data/spec/controllers/spotlight/roles_controller_spec.rb +31 -8
- data/spec/helpers/spotlight/title_helper_spec.rb +0 -8
- data/spec/views/spotlight/tags/index.html.erb_spec.rb +0 -6
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0e7cf4f1e70ba9c0eceafb312f984eaaec2f196
|
4
|
+
data.tar.gz: 0d312a6be60fefc15e1a01d6c46629b01368c643
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce5ec4536695fe29b7f2dc34dc346c71dfd1f84552a3b1e02fc06bb54af26ab0b4ab1d54591a1bffeb56f5d0d03092e6c841fdaa1e821731c88fd763bf5e7d1b
|
7
|
+
data.tar.gz: d12bb30e5e9757d7189ac856dec1e59e570adfb3f673dc48f42218d4f8277048d1e4759ad5971db2578f465e883130ac30d9339d1b688100d897d64c8b70d047
|
data/Rakefile
CHANGED
@@ -5,8 +5,8 @@ module Spotlight
|
|
5
5
|
extend ActiveSupport::Concern
|
6
6
|
|
7
7
|
def exhibit_specific_blacklight_config
|
8
|
-
|
9
|
-
|
8
|
+
raise "Exhibit id exists (#{params[:exhibit_id]}), but @exhibit hasn't been loaded yet" if params[:exhibit_id] && current_exhibit.nil?
|
9
|
+
raise 'Exhibit not found' unless current_exhibit
|
10
10
|
|
11
11
|
@exhibit_specific_blacklight_config ||= current_exhibit.blacklight_config
|
12
12
|
end
|
@@ -19,7 +19,7 @@ module Spotlight
|
|
19
19
|
authenticate_user!
|
20
20
|
|
21
21
|
# If that fails (and we end up back here), offer a 404 error instead
|
22
|
-
|
22
|
+
raise ActionController::RoutingError, 'Not Found'
|
23
23
|
else
|
24
24
|
redirect_to main_app.root_url, alert: exception.message
|
25
25
|
end
|
@@ -20,15 +20,5 @@ module Spotlight
|
|
20
20
|
@page_title = strip_tags(t(:'spotlight.html_title', title: title || t(:'.title', default: :'.header'), application_name: application_name))
|
21
21
|
end
|
22
22
|
# rubocop:enable Style/AccessorMethodName
|
23
|
-
|
24
|
-
def header_with_count(*args)
|
25
|
-
title, count = if args.length == 2
|
26
|
-
args
|
27
|
-
else
|
28
|
-
[t(:'.header'), args.first]
|
29
|
-
end
|
30
|
-
|
31
|
-
safe_join([title, content_tag(:span, count, class: 'label label-default')], ' ')
|
32
|
-
end
|
33
23
|
end
|
34
24
|
end
|
@@ -38,7 +38,7 @@ module Spotlight
|
|
38
38
|
{
|
39
39
|
version: :thumb,
|
40
40
|
field: Spotlight::Engine.config.try(:thumbnail_field),
|
41
|
-
lambda: lambda do|_|
|
41
|
+
lambda: lambda do |_|
|
42
42
|
version :thumb do
|
43
43
|
process resize_to_fit: [400, 400]
|
44
44
|
end
|
@@ -47,7 +47,7 @@ module Spotlight
|
|
47
47
|
{
|
48
48
|
version: :square,
|
49
49
|
field: Spotlight::Engine.config.try(:square_image_field),
|
50
|
-
lambda: lambda do|_|
|
50
|
+
lambda: lambda do |_|
|
51
51
|
version :square do
|
52
52
|
process resize_to_fill: [100, 100]
|
53
53
|
end
|
@@ -52,7 +52,7 @@ module Spotlight
|
|
52
52
|
:main_navigations, :owned_taggings, :resources, :searches, :solr_document_sidecars
|
53
53
|
accepts_nested_attributes_for :blacklight_configuration, :home_page, :masthead, :thumbnail, :filters, update_only: true
|
54
54
|
accepts_nested_attributes_for :contact_emails, reject_if: proc { |attr| attr['email'].blank? }
|
55
|
-
accepts_nested_attributes_for :roles, allow_destroy: true, reject_if: proc { |attr| attr['user_key'].blank? }
|
55
|
+
accepts_nested_attributes_for :roles, allow_destroy: true, reject_if: proc { |attr| attr['user_key'].blank? && attr['id'].blank? }
|
56
56
|
|
57
57
|
before_save :sanitize_description, if: :description_changed?
|
58
58
|
include Spotlight::DefaultThumbnailable
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<%= render 'spotlight/shared/exhibit_sidebar' %>
|
2
2
|
<div id="content" class="col-md-9">
|
3
3
|
<%= curation_page_title %>
|
4
|
-
<h3><%=
|
4
|
+
<h3><%= t(:'.categories_header') %></h3>
|
5
5
|
|
6
6
|
<% if @searches.empty? %>
|
7
7
|
<%= t :'.no_saved_searches' %>
|
data/lib/spotlight/version.rb
CHANGED
@@ -16,6 +16,7 @@ describe Spotlight::RolesController, type: :controller do
|
|
16
16
|
|
17
17
|
describe 'when user is an admin' do
|
18
18
|
let(:admin) { FactoryGirl.create(:exhibit_admin, exhibit: exhibit) }
|
19
|
+
let(:user) { FactoryGirl.create(:user) }
|
19
20
|
let(:role) { admin.roles.first }
|
20
21
|
before { sign_in admin }
|
21
22
|
it 'allows index' do
|
@@ -28,24 +29,46 @@ describe Spotlight::RolesController, type: :controller do
|
|
28
29
|
end
|
29
30
|
|
30
31
|
describe 'PATCH update_all' do
|
31
|
-
it '
|
32
|
+
it 'creates new roles' do
|
32
33
|
patch :update_all, exhibit_id: exhibit, 'exhibit' => {
|
33
34
|
'roles_attributes' => {
|
34
|
-
'0' => { '
|
35
|
-
|
35
|
+
'0' => { 'role' => 'curator', 'user_key' => user.email }
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
expect(exhibit.roles.last.role).to eq 'curator'
|
40
|
+
expect(exhibit.roles.last.user.email).to eq user.email
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'updates roles' do
|
44
|
+
patch :update_all, exhibit_id: exhibit, 'exhibit' => {
|
45
|
+
'roles_attributes' => {
|
46
|
+
'0' => { 'role' => 'curator', 'id' => role.id }
|
36
47
|
}
|
37
48
|
}
|
38
49
|
expect(response).to redirect_to exhibit_roles_path(exhibit)
|
39
50
|
expect(flash[:notice]).to eq 'User has been updated.'
|
40
|
-
|
41
|
-
|
51
|
+
|
52
|
+
admin.reload
|
53
|
+
|
54
|
+
expect(admin.roles.first.role).to eq 'curator'
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'ignores empty roles' do
|
58
|
+
expect do
|
59
|
+
patch :update_all, exhibit_id: exhibit, 'exhibit' => {
|
60
|
+
'roles_attributes' => {
|
61
|
+
'0' => { 'user_key' => '', 'role' => '' }
|
62
|
+
}
|
63
|
+
}
|
64
|
+
end.not_to change { exhibit.roles.length }
|
42
65
|
end
|
43
66
|
|
44
67
|
it 'authorizes records' do
|
45
68
|
allow(controller).to receive(:authorize!).and_raise(CanCan::AccessDenied)
|
46
69
|
patch :update_all, exhibit_id: exhibit, 'exhibit' => {
|
47
70
|
'roles_attributes' => {
|
48
|
-
'0' => { '
|
71
|
+
'0' => { 'role' => 'curator', 'id' => role.id }
|
49
72
|
}
|
50
73
|
}
|
51
74
|
expect(response).to redirect_to main_app.root_path
|
@@ -56,7 +79,7 @@ describe Spotlight::RolesController, type: :controller do
|
|
56
79
|
it 'destroys records' do
|
57
80
|
patch :update_all, exhibit_id: exhibit, 'exhibit' => {
|
58
81
|
'roles_attributes' => {
|
59
|
-
'0' => { '
|
82
|
+
'0' => { 'role' => 'curator', 'id' => role.id, '_destroy' => '1' }
|
60
83
|
}
|
61
84
|
}
|
62
85
|
|
@@ -69,7 +92,7 @@ describe Spotlight::RolesController, type: :controller do
|
|
69
92
|
allow_any_instance_of(Spotlight::Exhibit).to receive_messages(update: false)
|
70
93
|
patch :update_all, exhibit_id: exhibit, 'exhibit' => {
|
71
94
|
'roles_attributes' => {
|
72
|
-
'0' => { '
|
95
|
+
'0' => { 'role' => 'curator', 'id' => role.id }
|
73
96
|
}
|
74
97
|
}
|
75
98
|
expect(response).to be_successful
|
@@ -47,12 +47,4 @@ describe Spotlight::TitleHelper, type: :helper do
|
|
47
47
|
expect(title).to have_selector 'h1 small', text: 'Some title'
|
48
48
|
end
|
49
49
|
end
|
50
|
-
|
51
|
-
describe '#header_with_count' do
|
52
|
-
it 'merges the title with a count label' do
|
53
|
-
val = helper.header_with_count 'some title', 5
|
54
|
-
expect(val).to include 'some title'
|
55
|
-
expect(val).to have_selector 'span.label', text: 5
|
56
|
-
end
|
57
|
-
end
|
58
50
|
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.17.
|
4
|
+
version: 0.17.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: 2016-
|
14
|
+
date: 2016-02-20 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|
@@ -437,14 +437,14 @@ dependencies:
|
|
437
437
|
requirements:
|
438
438
|
- - "~>"
|
439
439
|
- !ruby/object:Gem::Version
|
440
|
-
version: 4.0
|
440
|
+
version: '4.0'
|
441
441
|
type: :runtime
|
442
442
|
prerelease: false
|
443
443
|
version_requirements: !ruby/object:Gem::Requirement
|
444
444
|
requirements:
|
445
445
|
- - "~>"
|
446
446
|
- !ruby/object:Gem::Version
|
447
|
-
version: 4.0
|
447
|
+
version: '4.0'
|
448
448
|
- !ruby/object:Gem::Dependency
|
449
449
|
name: openseadragon
|
450
450
|
requirement: !ruby/object:Gem::Requirement
|
@@ -549,14 +549,14 @@ dependencies:
|
|
549
549
|
requirements:
|
550
550
|
- - "~>"
|
551
551
|
- !ruby/object:Gem::Version
|
552
|
-
version: '0.
|
552
|
+
version: '0.37'
|
553
553
|
type: :development
|
554
554
|
prerelease: false
|
555
555
|
version_requirements: !ruby/object:Gem::Requirement
|
556
556
|
requirements:
|
557
557
|
- - "~>"
|
558
558
|
- !ruby/object:Gem::Version
|
559
|
-
version: '0.
|
559
|
+
version: '0.37'
|
560
560
|
- !ruby/object:Gem::Dependency
|
561
561
|
name: rubocop-rspec
|
562
562
|
requirement: !ruby/object:Gem::Requirement
|