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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6a47fab678bff54d54f4d4c3e9f2784b7f3333cf
4
- data.tar.gz: 704d71ac8946a3f767ddf3d97347aeac8e72d91f
3
+ metadata.gz: a0e7cf4f1e70ba9c0eceafb312f984eaaec2f196
4
+ data.tar.gz: 0d312a6be60fefc15e1a01d6c46629b01368c643
5
5
  SHA512:
6
- metadata.gz: baaadb1e9a1abcf1122af09b59443fd47e4673068c1c7870b852d6a65433c8d9f4652d40a49b4521fc71c0e3a861d815ad5f5ed538bb5a4256801428ee4ed070
7
- data.tar.gz: 9a7537f66f35fe0b3a60159510a803c081da6e69de8ea63871215db0c469cb9df38636dae65670d1b2048bca25d09de7ad81ce1fc7690d47cbc5decc4649ff96
6
+ metadata.gz: ce5ec4536695fe29b7f2dc34dc346c71dfd1f84552a3b1e02fc06bb54af26ab0b4ab1d54591a1bffeb56f5d0d03092e6c841fdaa1e821731c88fd763bf5e7d1b
7
+ data.tar.gz: d12bb30e5e9757d7189ac856dec1e59e570adfb3f673dc48f42218d4f8277048d1e4759ad5971db2578f465e883130ac30d9339d1b688100d897d64c8b70d047
data/Rakefile CHANGED
@@ -104,7 +104,7 @@ namespace :spotlight do
104
104
 
105
105
  _, exit_status = Process.wait2(io.pid)
106
106
 
107
- fail 'Failed to generate spotlight' if exit_status != 0
107
+ raise 'Failed to generate spotlight' if exit_status != 0
108
108
  end
109
109
  end
110
110
 
@@ -5,8 +5,8 @@ module Spotlight
5
5
  extend ActiveSupport::Concern
6
6
 
7
7
  def exhibit_specific_blacklight_config
8
- fail "Exhibit id exists (#{params[:exhibit_id]}), but @exhibit hasn't been loaded yet" if params[:exhibit_id] && current_exhibit.nil?
9
- fail 'Exhibit not found' unless current_exhibit
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
- fail ActionController::RoutingError, 'Not Found'
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
@@ -19,7 +19,7 @@ module Spotlight
19
19
  end
20
20
 
21
21
  def set_default_thumbnail
22
- fail NotImplementedError
22
+ raise NotImplementedError
23
23
  end
24
24
  end
25
25
  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><%= header_with_count(t(:'.categories_header'), @searches.count) %></h3>
4
+ <h3><%= t(:'.categories_header') %></h3>
5
5
 
6
6
  <% if @searches.empty? %>
7
7
  <%= t :'.no_saved_searches' %>
@@ -1,6 +1,6 @@
1
1
  <%= render 'spotlight/shared/exhibit_sidebar' %>
2
2
  <div id="content" class="col-md-9">
3
- <%= curation_page_title(header_with_count(@tags.length)) %>
3
+ <%= curation_page_title t(:".header") %>
4
4
 
5
5
  <% if @tags.empty? %>
6
6
  <p><%= t :'.no_tags' %></p>
@@ -1,4 +1,4 @@
1
1
  #
2
2
  module Spotlight
3
- VERSION = '0.17.0'.freeze
3
+ VERSION = '0.17.1'.freeze
4
4
  end
@@ -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 'is successful' do
32
+ it 'creates new roles' do
32
33
  patch :update_all, exhibit_id: exhibit, 'exhibit' => {
33
34
  'roles_attributes' => {
34
- '0' => { 'user_key' => 'cbeer@cbeer.io', 'role' => 'curator', 'id' => role.id },
35
- '1' => { 'user_key' => '', 'role' => 'admin' }
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
- expect(admin.reload.roles.first.role).to eq 'curator'
41
- expect(admin.reload.roles.first.user.email).to eq 'cbeer@cbeer.io'
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' => { 'user_key' => 'cbeer@cbeer.info', 'role' => 'curator', 'id' => role.id }
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' => { 'user_key' => 'cbeer@cbeer.info', 'role' => 'curator', 'id' => role.id, '_destroy' => '1' }
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' => { 'user_key' => 'cbeer@cbeer.info', 'role' => 'curator', 'id' => role.id }
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
@@ -19,10 +19,4 @@ describe 'spotlight/tags/index.html.erb', type: :view do
19
19
  end
20
20
  end
21
21
  end
22
- describe 'Total tags' do
23
- it 'is displayed' do
24
- render
25
- expect(rendered).to have_css('span.label.label-default', text: 2)
26
- end
27
- end
28
22
  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.0
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-01-28 00:00:00.000000000 Z
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.0.beta
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.0.beta
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.36'
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.36'
559
+ version: '0.37'
560
560
  - !ruby/object:Gem::Dependency
561
561
  name: rubocop-rspec
562
562
  requirement: !ruby/object:Gem::Requirement