blacklight-gallery 0.1.0 → 0.1.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: d7265445f18630a2d43755bd9322140a4e3c4f07
4
- data.tar.gz: 71a212fcdfa7d93dbde1205b02fa907ccb7fbd0d
3
+ metadata.gz: 98c59e605154729f071d84f594e00cf1cb1acef5
4
+ data.tar.gz: b0b8c6e17a2342e72007b72d83016e07a0384248
5
5
  SHA512:
6
- metadata.gz: d43e289a9d072fb79144907c9eded29e54c57e70c5a3ba6b81815a5c431051eeb2f52beb1e29aede06c0eb775e9d9b656b72acfd55b136d84cb448b4acdbcf24
7
- data.tar.gz: c015833a99afbeb4456f9c9224c0e8a1f860f140c0577f53bfb1461d5ecf2577441adb2484c86aa0a36907055a33faca1f15e308de7d4c35ec7453a13ba0ebc4
6
+ metadata.gz: 8b2b543edc5f4ec04347b7a25d43898ac1cc16bea5f17b1f6e4af53d05b5a63c8b08264d5b91d59eea183204d439e330383f33a7f8cc58761f8e632ce3dca9bf
7
+ data.tar.gz: a3d6e3e316f6d156d0cbe3a7210b3023d7691638e67ef5823746e86ad30bb88879a5709a8f0e6b5e492ae09c397c3258ca0bda75e744c6711d30e8fdf70e1700
data/Gemfile CHANGED
@@ -3,24 +3,21 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in blacklight-gallery.gemspec
4
4
  gemspec
5
5
 
6
- # If we don't specify 2.11.0 we'll end up with sprockets 2.12.0 in the main
7
- # Gemfile.lock but since sass-rails gets generated (rails new) into the test app
8
- # it'll want sprockets 2.11.0 and we'll have a conflict
9
- gem 'sprockets', '2.11.0'
10
-
11
- # If we don't specify 3.2.15 we'll end up with sass 3.3.2 in the main
12
- # Gemfile.lock but since sass-rails gets generated (rails new) into the test app
13
- # it'll want sass 3.2.0 and we'll have a conflict
14
- gem 'sass', '~> 3.2.0'
15
-
16
- group :test do
17
- gem "bootstrap-sass"
18
- gem 'turbolinks'
19
- gem 'sass-rails'
20
- end
21
-
22
6
  gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
23
7
 
24
- if File.exists?('spec/test_app_templates/Gemfile.extra')
25
- eval File.read('spec/test_app_templates/Gemfile.extra'), nil, 'spec/test_app_templates/Gemfile.extra'
26
- end
8
+ file = File.expand_path("Gemfile", ENV['ENGINE_CART_DESTINATION'] || ENV['RAILS_ROOT'] || File.expand_path("../spec/internal", __FILE__))
9
+ if File.exists?(file)
10
+ puts "Loading #{file} ..." if $DEBUG # `ruby -d` or `bundle -v`
11
+ instance_eval File.read(file)
12
+ else
13
+ gem 'rails', ENV['RAILS_VERSION']
14
+
15
+ # explicitly include sass-rails to get compatible sprocket dependencies
16
+ if ENV['RAILS_VERSION'] and ENV['RAILS_VERSION'] =~ /^4.2/
17
+ gem 'sass-rails', ">= 5.0.0.beta1"
18
+ gem 'responders', "~> 2.0"
19
+ else
20
+ gem 'sass-rails'
21
+ gem 'coffee-rails', "~> 4.0.0"
22
+ end
23
+ end
@@ -0,0 +1,2 @@
1
+ //= require blacklight_gallery/slideshow
2
+ //= require blacklight_gallery/osd_viewer
@@ -0,0 +1 @@
1
+ //= require openseadragon/rails
@@ -0,0 +1,51 @@
1
+ .view-icon-gallery {
2
+ &:before { content: "\e011"; }
3
+ }
4
+
5
+ #documents.gallery {
6
+
7
+ display: -webkit-box;
8
+ display: -moz-box;
9
+ display: -ms-flexbox;
10
+ display: -webkit-flex;
11
+ display: flex;
12
+ flex-flow: row wrap;
13
+
14
+
15
+ .document {
16
+ border-bottom: none;
17
+
18
+ -webkit-box-flex: 1;
19
+ -moz-box-flex: 1;
20
+ -webkit-flex: 1;
21
+ -ms-flex: 1;
22
+ flex: 1;
23
+
24
+ min-width: 250px;
25
+ min-height: 250px;
26
+ }
27
+
28
+ .index_title {
29
+ width: 100%;
30
+ }
31
+
32
+ .document-counter {
33
+ display: none;
34
+ }
35
+
36
+ .index-document-functions {
37
+ clear: left;
38
+ }
39
+
40
+ .document-metadata {
41
+ dt, dd {
42
+ float: none;
43
+ width: auto;
44
+ clear: none;
45
+ text-align: left;
46
+ margin: 0;
47
+ padding: 0;
48
+ }
49
+
50
+ }
51
+ }
@@ -0,0 +1,29 @@
1
+ #document {
2
+
3
+ .osd-toolbar {
4
+ padding: 5px 0;
5
+
6
+ a {
7
+ cursor: pointer;
8
+ margin: 0 5px;
9
+ }
10
+
11
+ .pagination {
12
+ margin: 0;
13
+ padding: 0;
14
+ text-align: left;
15
+ }
16
+
17
+ .controls {
18
+ float: right;
19
+ padding: 0;
20
+ text-align: right;
21
+ }
22
+ }
23
+
24
+ .osd-image {
25
+ border: 1px solid #ccc;
26
+ height: 400px;
27
+
28
+ }
29
+ }
@@ -1,3 +1,7 @@
1
+ .view-icon-slideshow {
2
+ &:before { content: "\e158"; }
3
+ }
4
+
1
5
  $gray-light: lightgray !default;
2
6
  $gray-dark: darkgray !default;
3
7
 
@@ -1,56 +1,3 @@
1
+ @import "gallery";
1
2
  @import "slideshow";
2
-
3
- #documents.gallery {
4
-
5
- display: -webkit-box;
6
- display: -moz-box;
7
- display: -ms-flexbox;
8
- display: -webkit-flex;
9
- display: flex;
10
- flex-flow: row wrap;
11
-
12
-
13
- .document {
14
- border-bottom: none;
15
-
16
- -webkit-box-flex: 1;
17
- -moz-box-flex: 1;
18
- -webkit-flex: 1;
19
- -ms-flex: 1;
20
- flex: 1;
21
-
22
- min-width: 250px;
23
- min-height: 250px;
24
- }
25
-
26
- .index_title {
27
- width: 100%;
28
- }
29
-
30
- .document-counter {
31
- display: none;
32
- }
33
-
34
- .index-document-functions {
35
- clear: left;
36
- }
37
-
38
- .document-metadata {
39
- dt, dd {
40
- float: none;
41
- width: auto;
42
- clear: none;
43
- text-align: left;
44
- margin: 0;
45
- padding: 0;
46
- }
47
-
48
- }
49
- }
50
-
51
- .view-icon-gallery {
52
- &:before { content: "\e011"; }
53
- }
54
- .view-icon-slideshow {
55
- &:before { content: "\e158"; }
56
- }
3
+ @import "osd_viewer";
@@ -0,0 +1,7 @@
1
+ module Blacklight::Gallery::OpenseadragonSolrDocument
2
+ def to_openseadragon view_config = nil
3
+ if view_config and view_config.tile_source_field
4
+ Array(get(view_config.tile_source_field, sep: nil))
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,47 @@
1
+ <% image = document.to_openseadragon(blacklight_config.view_config(:show)) %>
2
+ <%
3
+ osd_config = {
4
+ crossOriginPolicy: false,
5
+ zoomInButton: "osd-zoom-in",
6
+ zoomOutButton: "osd-zoom-out",
7
+ homeButton: "osd-home",
8
+ fullPageButton: "osd-full-page",
9
+ nextButton: "osd-next",
10
+ previousButton: "osd-previous"
11
+ }
12
+
13
+ osd_config_referencestrip = {
14
+ showReferenceStrip: true,
15
+ referenceStripPosition: 'OUTSIDE',
16
+ referenceStripScroll: 'vertical',
17
+ referenceStripWidth: 100,
18
+ referenceStripBackgroundColor: 'transparent'
19
+ }
20
+ %>
21
+
22
+ <% unless image.nil? %>
23
+ <% count = Array(image).length %>
24
+
25
+ <div class="col-md-6">
26
+ <div class="osd-toolbar row">
27
+ <% if count > 1 %>
28
+ <% osd_config = osd_config_referencestrip.merge(osd_config) %>
29
+
30
+ <div class="col-md-6 pagination">
31
+ <a id="osd-previous"><span class="glyphicon glyphicon-chevron-left"></span></a>
32
+ <span id="osd-page">1</span> of <%= count %>
33
+ <a id="osd-next"><span class="glyphicon glyphicon-chevron-right"></span></a>
34
+ </div>
35
+ <% end %>
36
+ <div class="col-md-6 controls">
37
+ <a id="osd-zoom-in"><span class="glyphicon glyphicon-plus-sign"></span></a>
38
+ <a id="osd-zoom-out"><span class="glyphicon glyphicon-minus-sign"></span></a>
39
+ <a id="osd-home"><span class="glyphicon glyphicon-resize-small"></span></a>
40
+ <a id="osd-full-page"><span class="glyphicon glyphicon-fullscreen"></span></a>
41
+ </div>
42
+ </div>
43
+ <%= openseadragon_picture_tag image, class: 'osd-image row', data: { openseadragon: osd_config } %>
44
+ </div>
45
+
46
+ <% end %>
47
+
@@ -20,11 +20,16 @@ Gem::Specification.new do |spec|
20
20
  spec.add_dependency "rails"
21
21
  spec.add_dependency "blacklight", "~> 5.0"
22
22
  spec.add_dependency "bootstrap-sass", "~> 3.0"
23
+ spec.add_dependency "openseadragon", ">= 0.0.9"
23
24
 
24
25
  spec.add_development_dependency "bundler", "~> 1.5"
25
26
  spec.add_development_dependency "rake"
26
- spec.add_development_dependency "rspec-rails"
27
+ spec.add_development_dependency "rspec-rails", "~> 3.1"
28
+ spec.add_development_dependency "rspec-its"
29
+ spec.add_development_dependency "rspec-activemodel-mocks"
30
+ spec.add_development_dependency "rspec-collection_matchers"
27
31
  spec.add_development_dependency "jettywrapper"
28
32
  spec.add_development_dependency "engine_cart"
29
33
  spec.add_development_dependency "capybara"
34
+ spec.add_development_dependency "poltergeist", ">= 1.5.0"
30
35
  end
@@ -3,8 +3,8 @@ require 'blacklight'
3
3
  module Blacklight
4
4
  module Gallery
5
5
  class Engine < Rails::Engine
6
- Blacklight::Configuration.default_values[:view].gallery.partials = [:index_header, :index]
7
- Blacklight::Configuration.default_values[:view].slideshow.partials = [:index]
6
+ require 'openseadragon'
7
+
8
8
  end
9
9
  end
10
10
  end
@@ -1,5 +1,5 @@
1
1
  module Blacklight
2
2
  module Gallery
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
@@ -9,5 +9,29 @@ module BlacklightGallery
9
9
  copy_file "blacklight_gallery.css.scss", "app/assets/stylesheets/blacklight_gallery.css.scss"
10
10
  copy_file "blacklight_gallery.js", "app/assets/javascripts/blacklight_gallery.js"
11
11
  end
12
+
13
+ def configuration
14
+ inject_into_file 'app/controllers/catalog_controller.rb', after: "configure_blacklight do |config|" do
15
+ <<-EOF
16
+ config.view.gallery.partials = [:index_header, :index]
17
+ config.view.slideshow.partials = [:index]
18
+
19
+ config.show.tile_source_field = :content_metadata_image_iiif_info_ssm
20
+ config.show.partials.insert(1, :openseadragon)
21
+ EOF
22
+ end
23
+ end
24
+
25
+ def add_model_mixin
26
+ inject_into_file 'app/models/solr_document.rb', after: "include Blacklight::Solr::Document" do
27
+ "\n include Blacklight::Gallery::OpenseadragonSolrDocument\n"
28
+ end
29
+ end
30
+
31
+ def add_controller_helpers
32
+ inject_into_class 'app/controllers/catalog_controller.rb', CatalogController do
33
+ "\n helper Openseadragon::OpenseadragonHelper\n"
34
+ end
35
+ end
12
36
  end
13
37
  end
@@ -1 +1 @@
1
- //= require blacklight_gallery/slideshow
1
+ //= require blacklight_gallery/default
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "Gallery view" do
3
+ describe "Gallery view", :type => :feature do
4
4
  before { visit catalog_index_path :q => 'medicine', :view => 'gallery' }
5
5
 
6
6
  it "should display results in a galley view" do
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "Slideshow", :js do
3
+ describe "Slideshow", :js, :type => :feature do
4
4
 
5
5
  it "should open when one of the grid panes are clicked" do
6
6
  visit catalog_index_path( :q => 'medicine', :view => 'slideshow' )
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Blacklight::GalleryHelper do
3
+ describe Blacklight::GalleryHelper, :type => :helper do
4
4
  describe "#render_gallery_collection" do
5
5
  let(:template) { double }
6
6
  before do
@@ -10,12 +10,12 @@ describe Blacklight::GalleryHelper do
10
10
  let(:documents) { [ double, double] }
11
11
  subject { helper.render_gallery_collection documents}
12
12
 
13
- it { should eq 'hello hello ' }
13
+ it { is_expected.to eq 'hello hello ' }
14
14
  end
15
15
 
16
16
  describe "#gallery_wrapper_template" do
17
17
  before do
18
- helper.stub(:blacklight_config).and_return(CatalogController.blacklight_config)
18
+ allow(helper).to receive(:blacklight_config).and_return(CatalogController.blacklight_config)
19
19
  helper.lookup_context.prefixes << "catalog"
20
20
  end
21
21
 
data/spec/spec_helper.rb CHANGED
@@ -1,18 +1,20 @@
1
1
  ENV["RAILS_ENV"] ||= 'test'
2
2
 
3
- require 'blacklight'
4
- require 'blacklight/gallery'
5
-
6
3
  require 'engine_cart'
7
4
  EngineCart.load_application!
8
5
 
6
+ require 'rspec/collection_matchers'
7
+ require 'rspec/its'
9
8
  require 'rspec/rails'
9
+ require 'rspec/active_model/mocks'
10
+
10
11
  require 'capybara/poltergeist'
11
12
  Capybara.javascript_driver = :poltergeist
12
13
 
14
+ require 'blacklight'
15
+ require 'blacklight/gallery'
16
+
13
17
  RSpec.configure do |c|
14
- c.treat_symbols_as_metadata_keys_with_true_values = true
15
18
  c.infer_spec_type_from_file_location!
16
-
17
19
  end
18
20
 
@@ -1,13 +1,13 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "catalog/_document_slideshow.html.erb" do
3
+ describe "catalog/_document_slideshow.html.erb", :type => :view do
4
4
  let(:blacklight_config) { Blacklight::Configuration.new }
5
5
 
6
6
  let(:document) { stub_model(::SolrDocument) }
7
7
 
8
8
  before do
9
- view.stub(blacklight_config: blacklight_config)
10
- view.stub(documents: [document])
9
+ allow(view).to receive_messages(blacklight_config: blacklight_config)
10
+ allow(view).to receive_messages(documents: [document])
11
11
  end
12
12
 
13
13
  it "should have a edit tag form" do
@@ -1,20 +1,20 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "catalog/_index_gallery.html.erb" do
3
+ describe "catalog/_index_gallery.html.erb", :type => :view do
4
4
  let(:blacklight_config) { Blacklight::Configuration.new }
5
5
 
6
6
  let(:document) { stub_model(::SolrDocument) }
7
7
 
8
8
  before do
9
9
  blacklight_config.view.gallery.partials = ['a', 'b']
10
- view.stub(blacklight_config: blacklight_config)
11
- view.stub(document: document)
12
- view.stub(document_counter: 3, document_counter_with_offset: 3)
10
+ allow(view).to receive_messages(blacklight_config: blacklight_config)
11
+ allow(view).to receive_messages(document: document)
12
+ allow(view).to receive_messages(document_counter: 3, document_counter_with_offset: 3)
13
13
  end
14
14
 
15
15
  it "should have thumbnail and caption" do
16
- view.should_receive(:render_thumbnail_tag).with(document, {}, hash_including(:counter)).and_return('Thumbnail')
17
- view.should_receive(:render_document_partials).with(document, ['a', 'b'], document_counter: 3).and_return('Z')
16
+ expect(view).to receive(:render_thumbnail_tag).with(document, {}, hash_including(:counter)).and_return('Thumbnail')
17
+ expect(view).to receive(:render_document_partials).with(document, ['a', 'b'], document_counter: 3).and_return('Z')
18
18
  render
19
19
  expect(rendered).to have_selector '.thumbnail', text: 'Thumbnail'
20
20
  expect(rendered).to have_selector '.caption', text: 'Z'
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.1.0
4
+ version: 0.1.1
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-09-05 00:00:00.000000000 Z
11
+ date: 2014-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: openseadragon
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 0.0.9
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 0.0.9
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: bundler
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -82,6 +96,48 @@ dependencies:
82
96
  version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: rspec-rails
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '3.1'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '3.1'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rspec-its
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rspec-activemodel-mocks
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rspec-collection_matchers
85
141
  requirement: !ruby/object:Gem::Requirement
86
142
  requirements:
87
143
  - - ">="
@@ -136,6 +192,20 @@ dependencies:
136
192
  - - ">="
137
193
  - !ruby/object:Gem::Version
138
194
  version: '0'
195
+ - !ruby/object:Gem::Dependency
196
+ name: poltergeist
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: 1.5.0
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: 1.5.0
139
209
  description:
140
210
  email:
141
211
  - cabeer@stanford.edu
@@ -149,15 +219,21 @@ files:
149
219
  - LICENSE.txt
150
220
  - README.md
151
221
  - Rakefile
222
+ - app/assets/javascripts/blacklight_gallery/default.js
223
+ - app/assets/javascripts/blacklight_gallery/osd_viewer.js
152
224
  - app/assets/javascripts/blacklight_gallery/slideshow.js
225
+ - app/assets/stylesheets/blacklight_gallery/_gallery.css.scss
226
+ - app/assets/stylesheets/blacklight_gallery/_osd_viewer.css.scss
153
227
  - app/assets/stylesheets/blacklight_gallery/_slideshow.css.scss
154
228
  - app/assets/stylesheets/blacklight_gallery/default.css.scss
155
229
  - app/helpers/blacklight/gallery_helper.rb
230
+ - app/models/concerns/blacklight/gallery/openseadragon_solr_document.rb
156
231
  - app/views/catalog/_document_gallery.html.erb
157
232
  - app/views/catalog/_document_slideshow.html.erb
158
233
  - app/views/catalog/_grid_slideshow.html.erb
159
234
  - app/views/catalog/_index_gallery.html.erb
160
235
  - app/views/catalog/_index_slideshow.html.erb
236
+ - app/views/catalog/_openseadragon_default.html.erb
161
237
  - app/views/catalog/_slideshow.html.erb
162
238
  - app/views/catalog/_slideshow_modal.html.erb
163
239
  - blacklight-gallery.gemspec
@@ -211,4 +287,3 @@ test_files:
211
287
  - spec/test_app_templates/lib/generators/test_app_generator.rb
212
288
  - spec/views/catalog/_document_slideshow.html.erb_spec.rb
213
289
  - spec/views/catalog/_index_gallery.html.erb_spec.rb
214
- has_rdoc: