blacklight-gallery 0.0.2 → 0.1.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: dba81d9ebc340387c2228289ecdde6641cf494d4
4
- data.tar.gz: ce6c1b068aa9021a04428ae550d1ccec85f801e9
3
+ metadata.gz: d7265445f18630a2d43755bd9322140a4e3c4f07
4
+ data.tar.gz: 71a212fcdfa7d93dbde1205b02fa907ccb7fbd0d
5
5
  SHA512:
6
- metadata.gz: 69f036f9a806c8d645e7df9c7d4461b1ceffdbc30090a7b0f7aac019784b14083f7e07ab2df665316504a016350fe8148919d309d44df6faabba658de5c29090
7
- data.tar.gz: 95677dd746ca34b0b2536c1be819c14c411d4e510be7d3838b80bf10301dbed24b2d8d0c067bb8a3902c8043353b6bb7f765cd54ec1d3aaa83dab990d9e4112e
6
+ metadata.gz: d43e289a9d072fb79144907c9eded29e54c57e70c5a3ba6b81815a5c431051eeb2f52beb1e29aede06c0eb775e9d9b656b72acfd55b136d84cb448b4acdbcf24
7
+ data.tar.gz: c015833a99afbeb4456f9c9224c0e8a1f860f140c0577f53bfb1461d5ecf2577441adb2484c86aa0a36907055a33faca1f15e308de7d4c35ec7453a13ba0ebc4
@@ -0,0 +1,23 @@
1
+ module Blacklight
2
+ module GalleryHelper
3
+ def render_gallery_collection documents
4
+ index = -1
5
+ documents.map do |object|
6
+ index += 1
7
+ template = gallery_wrapper_template(object)
8
+ template.render(self, {document: object, document_counter: index}) if template
9
+
10
+ end.join().html_safe
11
+ end
12
+
13
+ def gallery_wrapper_template(object)
14
+ format = document_partial_name(object, nil)
15
+ ['index_gallery_%{format}_wrapper', 'index_gallery'].each do |str|
16
+ partial = str % { format: format }
17
+ logger.debug "Looking for gallery document wrapper #{partial}"
18
+ template = lookup_context.find_all(partial, lookup_context.prefixes, true, [:document, :document_counter], {}).first
19
+ return template if template
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,4 +1,4 @@
1
1
  <% # container for all documents in index view -%>
2
2
  <div id="documents" class="row gallery">
3
- <%= render :collection => documents, :as => :document, :partial => 'index_gallery' %>
4
- </div>
3
+ <%= render_gallery_collection documents %>
4
+ </div>
@@ -1,5 +1,5 @@
1
1
  module Blacklight
2
2
  module Gallery
3
- VERSION = "0.0.2"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ describe Blacklight::GalleryHelper do
4
+ describe "#render_gallery_collection" do
5
+ let(:template) { double }
6
+ before do
7
+ allow(template).to receive(:render).and_return("hello ")
8
+ allow(helper).to receive(:gallery_wrapper_template).and_return(template)
9
+ end
10
+ let(:documents) { [ double, double] }
11
+ subject { helper.render_gallery_collection documents}
12
+
13
+ it { should eq 'hello hello ' }
14
+ end
15
+
16
+ describe "#gallery_wrapper_template" do
17
+ before do
18
+ helper.stub(:blacklight_config).and_return(CatalogController.blacklight_config)
19
+ helper.lookup_context.prefixes << "catalog"
20
+ end
21
+
22
+ subject { helper.gallery_wrapper_template SolrDocument.new }
23
+
24
+ it "should be the default template" do
25
+ expect(subject.virtual_path).to eq 'catalog/_index_gallery'
26
+ end
27
+ end
28
+ end
data/spec/spec_helper.rb CHANGED
@@ -12,5 +12,7 @@ Capybara.javascript_driver = :poltergeist
12
12
 
13
13
  RSpec.configure do |c|
14
14
  c.treat_symbols_as_metadata_keys_with_true_values = true
15
+ c.infer_spec_type_from_file_location!
16
+
15
17
  end
16
18
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight-gallery
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Beer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-28 00:00:00.000000000 Z
11
+ date: 2014-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -152,6 +152,7 @@ files:
152
152
  - app/assets/javascripts/blacklight_gallery/slideshow.js
153
153
  - app/assets/stylesheets/blacklight_gallery/_slideshow.css.scss
154
154
  - app/assets/stylesheets/blacklight_gallery/default.css.scss
155
+ - app/helpers/blacklight/gallery_helper.rb
155
156
  - app/views/catalog/_document_gallery.html.erb
156
157
  - app/views/catalog/_document_slideshow.html.erb
157
158
  - app/views/catalog/_grid_slideshow.html.erb
@@ -171,6 +172,7 @@ files:
171
172
  - lib/generators/blacklight_gallery/templates/blacklight_gallery.js
172
173
  - spec/features/gallery_spec.rb
173
174
  - spec/features/slideshow_spec.rb
175
+ - spec/helpers/blacklight/gallery_helper_spec.rb
174
176
  - spec/spec_helper.rb
175
177
  - spec/test_app_templates/Gemfile.extra
176
178
  - spec/test_app_templates/lib/generators/test_app_generator.rb
@@ -196,15 +198,17 @@ required_rubygems_version: !ruby/object:Gem::Requirement
196
198
  version: '0'
197
199
  requirements: []
198
200
  rubyforge_project:
199
- rubygems_version: 2.4.1
201
+ rubygems_version: 2.2.2
200
202
  signing_key:
201
203
  specification_version: 4
202
204
  summary: Gallery display for Blacklight
203
205
  test_files:
204
206
  - spec/features/gallery_spec.rb
205
207
  - spec/features/slideshow_spec.rb
208
+ - spec/helpers/blacklight/gallery_helper_spec.rb
206
209
  - spec/spec_helper.rb
207
210
  - spec/test_app_templates/Gemfile.extra
208
211
  - spec/test_app_templates/lib/generators/test_app_generator.rb
209
212
  - spec/views/catalog/_document_slideshow.html.erb_spec.rb
210
213
  - spec/views/catalog/_index_gallery.html.erb_spec.rb
214
+ has_rdoc: