blacklight-spotlight 0.8.1 → 0.8.2

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: 79f3c55215f17eb642d2939afb0a526090b929ae
4
- data.tar.gz: 73621327bd47b37ef54c0a083cfd3efdbe170223
3
+ metadata.gz: b138edc90732ce33fe7f454da4f4a21858b016d6
4
+ data.tar.gz: 38b9e958eac1286631b35752da63bf583aa540bf
5
5
  SHA512:
6
- metadata.gz: 30ec54bcc766d93a529f47cfdec4ccef3dd0fc5fe1f361dea825c4020fab77c9b5de4268801c850e4706bf7167312f870517a09191bdc6492d9ef14b275bc966
7
- data.tar.gz: 8e01d90acd6a9c838d8cfe59d18caa50dbe02a39f5838af87b4764c798911b82da81b97bb3cdaee2c5e8bb917567fc3e7b718ad54d724bdfa831b5cfddf80a42
6
+ metadata.gz: 55de525b9576d2dd3153b107063d9ca1d8f9680049f53875f2e29fa9f13def90d664327827a871c360f5055f1fdc8f0131f354ec3f1d52a29551959e83e46150
7
+ data.tar.gz: 150fb2d102718f3284f3213b6c3d6146a3d521a0443932f95bbb238283811aa7a26e5e49d3fedb3778d48a5846ae73cfc3a389b6c5d60f7c765403c40331ed45
@@ -6,11 +6,14 @@ module Spotlight
6
6
 
7
7
  included do
8
8
  before_create :setup_defaults
9
+ attr_accessor :skip_default_configuration
9
10
  end
10
11
 
11
12
  protected
12
13
 
13
14
  def setup_defaults
15
+ return if skip_default_configuration
16
+
14
17
  default_search_fields
15
18
  default_sort_fields
16
19
  default_view_types
@@ -12,6 +12,14 @@ module Spotlight
12
12
  (Spotlight::BlacklightConfiguration.attribute_names - %w(id exhibit_id)).each do |prop|
13
13
  property prop
14
14
  end
15
+
16
+ property :skip_default_configuration, exec_context: :decorator
17
+
18
+ def skip_default_configuration
19
+ true
20
+ end
21
+
22
+ delegate :skip_default_configuration=, to: :represented
15
23
  end
16
24
 
17
25
  ##
@@ -53,6 +61,8 @@ module Spotlight
53
61
 
54
62
  property :thumbnail, class: Spotlight::FeaturedImage, decorator: FeaturedImageRepresenter
55
63
 
64
+ collection :main_navigations, class: Spotlight::MainNavigation, decorator: MainNavigationRepresenter
65
+
56
66
  property :blacklight_configuration, class: Spotlight::BlacklightConfiguration, decorator: ConfigurationRepresenter
57
67
 
58
68
  collection :custom_fields, parse_strategy: ->(fragment, _i, options) { options.represented.custom_fields.find_or_initialize_by(slug: fragment['slug']) },
@@ -0,0 +1,11 @@
1
+ module Spotlight
2
+ ##
3
+ # Serialize the Spotlight::BlacklightConfiguration
4
+ class MainNavigationRepresenter < Roar::Decorator
5
+ include Roar::JSON
6
+
7
+ (Spotlight::MainNavigation.attribute_names - %w(id exhibit_id)).each do |prop|
8
+ property prop
9
+ end
10
+ end
11
+ end
@@ -1,4 +1,4 @@
1
1
  #
2
2
  module Spotlight
3
- VERSION = '0.8.1'
3
+ VERSION = '0.8.2'
4
4
  end
@@ -100,6 +100,17 @@ describe Spotlight::ExhibitExportSerializer do
100
100
  expect(subject.blacklight_configuration).to be_persisted
101
101
  end
102
102
 
103
+ context 'for an exhibit without search fields' do
104
+ before do
105
+ source_exhibit.blacklight_configuration.search_fields = {}
106
+ source_exhibit.blacklight_configuration.save
107
+ end
108
+
109
+ it 'remains without search fields' do
110
+ expect(subject.blacklight_configuration.search_fields).to be_blank
111
+ end
112
+ end
113
+
103
114
  it 'has home page properties' do
104
115
  expect(subject.home_page).to be_persisted
105
116
  expect(subject.home_page.id).not_to eq source_exhibit.home_page.id
@@ -131,6 +142,24 @@ describe Spotlight::ExhibitExportSerializer do
131
142
  expect(subject.owned_taggings.first.tag.name).to eq 'xyz'
132
143
  end
133
144
 
145
+ context 'with custom main navigation labels' do
146
+ before do
147
+ nav = source_exhibit.main_navigations.about
148
+ nav.label = 'Custom Label'
149
+ nav.save
150
+ end
151
+
152
+ it 'persists across import/export' do
153
+ expect(subject.main_navigations.about.label).to eq 'Custom Label'
154
+ end
155
+ end
156
+
157
+ it 'has tags' do
158
+ expect(subject.owned_taggings.length).to eq source_exhibit.owned_taggings.length
159
+ expect(subject.owned_taggings.first).to be_persisted
160
+ expect(subject.owned_taggings.first.tag.name).to eq 'xyz'
161
+ end
162
+
134
163
  it 'deals with nested feature pages' do
135
164
  FactoryGirl.create :feature_subpage, exhibit: source_exhibit
136
165
  expect(subject.feature_pages.at_top_level.length).to eq 1
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.8.1
4
+ version: 0.8.2
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: 2015-11-23 00:00:00.000000000 Z
14
+ date: 2015-11-24 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
@@ -874,6 +874,7 @@ files:
874
874
  - app/models/spotlight/solr_document_sidecar.rb
875
875
  - app/serializers/spotlight/exhibit_export_serializer.rb
876
876
  - app/serializers/spotlight/featured_image_representer.rb
877
+ - app/serializers/spotlight/main_navigation_representer.rb
877
878
  - app/serializers/spotlight/page_representer.rb
878
879
  - app/uploaders/spotlight/attachment_uploader.rb
879
880
  - app/uploaders/spotlight/avatar_uploader.rb