blacklight-gallery 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +11 -1
- data/README.md +5 -0
- data/Rakefile +1 -2
- data/app/assets/javascripts/blacklight_gallery/slideshow.js +119 -0
- data/app/assets/stylesheets/blacklight_gallery/_slideshow.css.scss +140 -0
- data/app/assets/stylesheets/blacklight_gallery/default.css.scss +36 -2
- data/app/views/catalog/_document_slideshow.html.erb +14 -0
- data/app/views/catalog/_grid_slideshow.html.erb +7 -0
- data/app/views/catalog/_index_gallery.html.erb +2 -2
- data/app/views/catalog/_index_slideshow.html.erb +11 -0
- data/app/views/catalog/_slideshow.html.erb +16 -0
- data/app/views/catalog/_slideshow_modal.html.erb +14 -0
- data/blacklight-gallery.gemspec +2 -2
- data/config/jetty.yml +2 -0
- data/config/locales/blacklight-gallery.en.yml +8 -1
- data/docs/screen_shot.png +0 -0
- data/lib/blacklight/gallery/engine.rb +2 -1
- data/lib/blacklight/gallery/version.rb +1 -1
- data/lib/generators/blacklight_gallery/install_generator.rb +2 -1
- data/lib/generators/blacklight_gallery/templates/blacklight_gallery.js +1 -0
- data/spec/features/slideshow_spec.rb +16 -0
- data/spec/spec_helper.rb +7 -1
- data/spec/views/catalog/_document_slideshow.html.erb_spec.rb +20 -0
- data/spec/views/catalog/_index_gallery.html.erb_spec.rb +22 -0
- metadata +24 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dba81d9ebc340387c2228289ecdde6641cf494d4
|
4
|
+
data.tar.gz: ce6c1b068aa9021a04428ae550d1ccec85f801e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69f036f9a806c8d645e7df9c7d4461b1ceffdbc30090a7b0f7aac019784b14083f7e07ab2df665316504a016350fe8148919d309d44df6faabba658de5c29090
|
7
|
+
data.tar.gz: 95677dd746ca34b0b2536c1be819c14c411d4e510be7d3838b80bf10301dbed24b2d8d0c067bb8a3902c8043353b6bb7f765cd54ec1d3aaa83dab990d9e4112e
|
data/Gemfile
CHANGED
@@ -3,6 +3,16 @@ 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
|
+
|
6
16
|
group :test do
|
7
17
|
gem "bootstrap-sass"
|
8
18
|
gem 'turbolinks'
|
@@ -13,4 +23,4 @@ gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
|
|
13
23
|
|
14
24
|
if File.exists?('spec/test_app_templates/Gemfile.extra')
|
15
25
|
eval File.read('spec/test_app_templates/Gemfile.extra'), nil, 'spec/test_app_templates/Gemfile.extra'
|
16
|
-
end
|
26
|
+
end
|
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# Blacklight::Gallery
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/blacklight-gallery.svg)](http://badge.fury.io/rb/blacklight-gallery)
|
2
3
|
|
3
4
|
Gallery views for Blacklight search results
|
4
5
|
|
@@ -22,6 +23,10 @@ Run the gallery generator:
|
|
22
23
|
|
23
24
|
$ rails g blacklight_gallery:install
|
24
25
|
|
26
|
+
## Screenshot
|
27
|
+
|
28
|
+
![Screenshot](docs/screen_shot.png)
|
29
|
+
|
25
30
|
## Contributing
|
26
31
|
|
27
32
|
1. Fork it ( http://github.com/<my-github-username>/blacklight-gallery/fork )
|
data/Rakefile
CHANGED
@@ -7,7 +7,6 @@ require 'rspec/core/rake_task'
|
|
7
7
|
require 'engine_cart/rake_task'
|
8
8
|
|
9
9
|
require 'jettywrapper'
|
10
|
-
require 'blacklight'
|
11
10
|
|
12
11
|
task :default => :ci
|
13
12
|
|
@@ -41,4 +40,4 @@ task :ci => ['jetty:clean', 'engine_cart:generate'] do
|
|
41
40
|
Rake::Task['spec'].invoke
|
42
41
|
end
|
43
42
|
raise "test failures: #{error}" if error
|
44
|
-
end
|
43
|
+
end
|
@@ -0,0 +1,119 @@
|
|
1
|
+
(function($){
|
2
|
+
var Slideshow = function (element, options) {
|
3
|
+
this.$element = $(element);
|
4
|
+
this.options = options;
|
5
|
+
this.paused = false;
|
6
|
+
this.activeIndex = 0;
|
7
|
+
|
8
|
+
this.init = function() {
|
9
|
+
this.$items = this.$element.find('.item');
|
10
|
+
}
|
11
|
+
|
12
|
+
this.attachEvents();
|
13
|
+
this.init();
|
14
|
+
}
|
15
|
+
|
16
|
+
|
17
|
+
Slideshow.prototype = {
|
18
|
+
|
19
|
+
slide: function(item) {
|
20
|
+
var $item = $(item),
|
21
|
+
$frame = $item.find('.frame'),
|
22
|
+
marginTop = 0;
|
23
|
+
|
24
|
+
this.$items.hide();
|
25
|
+
$item.show();
|
26
|
+
|
27
|
+
marginTop = Math.round($item.height() - $frame.height())/2;
|
28
|
+
this.activeIndex = this.$items.index(item);
|
29
|
+
|
30
|
+
if (this.options.autoPlay && !this.paused) this.play();
|
31
|
+
|
32
|
+
return this;
|
33
|
+
},
|
34
|
+
|
35
|
+
play: function() {
|
36
|
+
this.paused = false;
|
37
|
+
|
38
|
+
if (this.interval) clearInterval(this.interval);
|
39
|
+
this.interval = setInterval($.proxy(this.next, this), this.options.interval);
|
40
|
+
},
|
41
|
+
|
42
|
+
pause: function() {
|
43
|
+
this.paused = true;
|
44
|
+
this.interval = clearInterval(this.interval);
|
45
|
+
|
46
|
+
return this;
|
47
|
+
},
|
48
|
+
|
49
|
+
startAt: function(pos) {
|
50
|
+
this.to(pos);
|
51
|
+
},
|
52
|
+
|
53
|
+
next: function() {
|
54
|
+
return this.to('next');
|
55
|
+
},
|
56
|
+
|
57
|
+
to: function(pos) {
|
58
|
+
if (pos === 'next') pos = this.activeIndex + 1;
|
59
|
+
if (pos === 'prev') pos = this.activeIndex - 1;
|
60
|
+
|
61
|
+
return this.slide(this.$items[this.getValidIndex(pos)]);
|
62
|
+
},
|
63
|
+
|
64
|
+
getValidIndex: function(index) {
|
65
|
+
if (typeof index === 'undefined' || index > (this.$items.length - 1)) index = 0;
|
66
|
+
if (index < 0) index = this.$items.length - 1;
|
67
|
+
|
68
|
+
return index;
|
69
|
+
},
|
70
|
+
|
71
|
+
attachEvents: function() {
|
72
|
+
var $img = this.$element.find('.frame img'),
|
73
|
+
_this = this;
|
74
|
+
|
75
|
+
// pause slideshow on image mouseenter event
|
76
|
+
$img.on('mouseenter', function() { _this.pause(); });
|
77
|
+
|
78
|
+
// play slideshow on image mouseleave event
|
79
|
+
$img.on('mouseleave', function() {
|
80
|
+
if (_this.options.autoPlay) _this.play();
|
81
|
+
});
|
82
|
+
|
83
|
+
$(document).on('click', '[data-slide], [data-slide-to]', function() {
|
84
|
+
pos = parseInt($(this).attr('data-slide-to'), 10) || $(this).attr('data-slide');
|
85
|
+
|
86
|
+
if (pos === 'next' || pos === 'prev') _this.pause();
|
87
|
+
_this.to(pos);
|
88
|
+
});
|
89
|
+
|
90
|
+
// pause slideshow on modal close
|
91
|
+
$('#slideshow-modal').on('hidden.bs.modal', function() {
|
92
|
+
_this.pause();
|
93
|
+
});
|
94
|
+
}
|
95
|
+
}
|
96
|
+
|
97
|
+
|
98
|
+
Slideshow.DEFAULTS = {
|
99
|
+
autoPlay: true,
|
100
|
+
interval: 5000 // in milliseconds
|
101
|
+
}
|
102
|
+
|
103
|
+
|
104
|
+
$.fn.slideshow = function(option) {
|
105
|
+
return this.each(function() {
|
106
|
+
var $this = $(this);
|
107
|
+
var data = $this.data('slideshow');
|
108
|
+
var options = $.extend({}, Slideshow.DEFAULTS, $this.data(), typeof option == 'object' && option);
|
109
|
+
|
110
|
+
if (!data) $this.data('slideshow', (data = new Slideshow(this, options)));
|
111
|
+
})
|
112
|
+
}
|
113
|
+
|
114
|
+
})(jQuery);
|
115
|
+
|
116
|
+
|
117
|
+
Blacklight.onLoad(function() {
|
118
|
+
$('#slideshow').slideshow();
|
119
|
+
});
|
@@ -0,0 +1,140 @@
|
|
1
|
+
$gray-light: lightgray !default;
|
2
|
+
$gray-dark: darkgray !default;
|
3
|
+
|
4
|
+
#slideshow-modal {
|
5
|
+
.modal-dialog {
|
6
|
+
width: 100%;
|
7
|
+
margin: 1% auto;
|
8
|
+
|
9
|
+
.modal-content {
|
10
|
+
background-color: $gray-dark;
|
11
|
+
}
|
12
|
+
|
13
|
+
.modal-header {
|
14
|
+
border-bottom: none;
|
15
|
+
|
16
|
+
.close {
|
17
|
+
color: white;
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
.modal-body {
|
22
|
+
padding: 1%;
|
23
|
+
height: 90%;
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
#slideshow {
|
29
|
+
height: 100%;
|
30
|
+
|
31
|
+
.slideshow-inner {
|
32
|
+
height: 100%;
|
33
|
+
overflow: hidden;
|
34
|
+
|
35
|
+
.item {
|
36
|
+
width: 100%;
|
37
|
+
height: 100%;
|
38
|
+
display: table;
|
39
|
+
vertical-align: middle;
|
40
|
+
position: relative;
|
41
|
+
|
42
|
+
.frame {
|
43
|
+
margin: 0 auto;
|
44
|
+
display: table-cell;
|
45
|
+
text-align: center;
|
46
|
+
vertical-align: middle;
|
47
|
+
overflow: auto;
|
48
|
+
|
49
|
+
img {
|
50
|
+
display: inline-block;
|
51
|
+
vertical-align: middle;
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
.carousel-control {
|
58
|
+
background-image: none;
|
59
|
+
height: 100%;
|
60
|
+
width: 50px;
|
61
|
+
|
62
|
+
.glyphicon {
|
63
|
+
color: $gray-light;
|
64
|
+
}
|
65
|
+
}
|
66
|
+
.carousel-control.left .glyphicon {
|
67
|
+
padding-right: 3px;
|
68
|
+
}
|
69
|
+
.carousel-control.right .glyphicon {
|
70
|
+
padding-left: 2px;
|
71
|
+
}
|
72
|
+
|
73
|
+
.caption {
|
74
|
+
font-size: 14px;
|
75
|
+
color: $gray-light;
|
76
|
+
margin: 10px auto;
|
77
|
+
min-width: 200px;
|
78
|
+
max-width: 50%;
|
79
|
+
}
|
80
|
+
|
81
|
+
.counter {
|
82
|
+
// background-color: $gray-light;
|
83
|
+
border-radius: 12px;
|
84
|
+
border: 1px solid $gray-light;
|
85
|
+
color: $gray-light;
|
86
|
+
font-size: 12px;
|
87
|
+
overflow: auto;
|
88
|
+
padding: 4px 10px;
|
89
|
+
text-align: center;
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
#documents {
|
94
|
+
margin: 0;
|
95
|
+
|
96
|
+
.info {
|
97
|
+
text-align: center;
|
98
|
+
margin-bottom: 15px;
|
99
|
+
}
|
100
|
+
|
101
|
+
h3 {
|
102
|
+
background-color: whitesmoke;
|
103
|
+
border-radius: 3px;
|
104
|
+
border: 1px solid #ddd;
|
105
|
+
display: inline-block;
|
106
|
+
font-size: 16px;
|
107
|
+
margin: 10px auto;
|
108
|
+
padding: 10px 15px;
|
109
|
+
}
|
110
|
+
|
111
|
+
.grid {
|
112
|
+
$square-thumb-size: 100px;
|
113
|
+
|
114
|
+
.document {
|
115
|
+
float: left;
|
116
|
+
margin-right: 20px;
|
117
|
+
margin-top: 0;
|
118
|
+
padding-top: 0;
|
119
|
+
border-bottom: 0;
|
120
|
+
|
121
|
+
.thumbnail {
|
122
|
+
border: 1px solid #999;
|
123
|
+
border-radius: 0;
|
124
|
+
min-width: $square-thumb-size;
|
125
|
+
min-height: $square-thumb-size;
|
126
|
+
overflow: hidden;
|
127
|
+
position: relative;
|
128
|
+
width: $square-thumb-size;
|
129
|
+
|
130
|
+
a > img {
|
131
|
+
position: absolute;
|
132
|
+
max-width: none;
|
133
|
+
max-height: none;
|
134
|
+
left: -50%;
|
135
|
+
top: -50%;
|
136
|
+
}
|
137
|
+
}
|
138
|
+
}
|
139
|
+
}
|
140
|
+
}
|
@@ -1,7 +1,26 @@
|
|
1
|
+
@import "slideshow";
|
2
|
+
|
1
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
|
+
|
2
13
|
.document {
|
3
14
|
border-bottom: none;
|
4
|
-
|
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;
|
5
24
|
}
|
6
25
|
|
7
26
|
.index_title {
|
@@ -15,8 +34,23 @@
|
|
15
34
|
.index-document-functions {
|
16
35
|
clear: left;
|
17
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
|
+
}
|
18
49
|
}
|
19
50
|
|
20
51
|
.view-icon-gallery {
|
21
52
|
&:before { content: "\e011"; }
|
22
|
-
}
|
53
|
+
}
|
54
|
+
.view-icon-slideshow {
|
55
|
+
&:before { content: "\e158"; }
|
56
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<% # container for all documents in slideshow view -%>
|
2
|
+
<div id="documents" class="row slideshow">
|
3
|
+
<div class="info">
|
4
|
+
<h3><%= t(:'blacklight_gallery.catalog.document_slideshow.header') %></h3>
|
5
|
+
</div>
|
6
|
+
|
7
|
+
<div class="grid">
|
8
|
+
<%= render collection: documents, as: :document, partial: 'grid_slideshow' %>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<%= render layout: 'slideshow_modal', locals: {documents: documents} do %>
|
12
|
+
<%= render partial: 'slideshow', locals: {documents: documents} %>
|
13
|
+
<% end %>
|
14
|
+
</div>
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<div class="document col-xs-6 col-md-3">
|
2
2
|
<div class="thumbnail">
|
3
|
-
<%= render_thumbnail_tag
|
3
|
+
<%= render_thumbnail_tag(document, {}, :counter => document_counter_with_offset(document_counter)) %>
|
4
4
|
<div class="caption">
|
5
5
|
<%= render_document_partials document, blacklight_config.view_config(:gallery).partials, :document_counter => document_counter %>
|
6
6
|
</div>
|
7
7
|
</div>
|
8
|
-
</div>
|
8
|
+
</div>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<div class="item<%= ' active' if document_counter == 0 %>">
|
2
|
+
<div class="frame">
|
3
|
+
<%= image_tag thumbnail_url(document) %>
|
4
|
+
<div class="caption">
|
5
|
+
<%= render_document_index_label document, label: document_show_link_field(document) %>
|
6
|
+
</div>
|
7
|
+
<span class="counter">
|
8
|
+
<%= t :'blacklight_gallery.catalog.modal_slideshow.counter', counter: document_counter + 1, count: count %>
|
9
|
+
</span>
|
10
|
+
</div>
|
11
|
+
</div>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<div id="slideshow" class="">
|
2
|
+
<!-- Wrapper for slides -->
|
3
|
+
<div class="slideshow-inner">
|
4
|
+
<%= render collection: documents, as: :document, partial: 'index_slideshow', locals: {count: documents.count} %>
|
5
|
+
</div>
|
6
|
+
|
7
|
+
<!-- Controls -->
|
8
|
+
<a class="left carousel-control prev" href="#slideshow" data-slide="prev">
|
9
|
+
<span class="glyphicon glyphicon-chevron-left"></span>
|
10
|
+
</a>
|
11
|
+
<a class="right carousel-control next" href="#slideshow" data-slide="next">
|
12
|
+
<span class="glyphicon glyphicon-chevron-right"></span>
|
13
|
+
</a>
|
14
|
+
|
15
|
+
</div>
|
16
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!-- Modal -->
|
2
|
+
<div class="modal fade" id="slideshow-modal" tabindex="-1" role="dialog" aria-labelledby="slideshow-modal-label" aria-hidden="true">
|
3
|
+
<div class="modal-dialog col-md-10">
|
4
|
+
<div class="modal-content">
|
5
|
+
<div class="modal-header">
|
6
|
+
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-remove"></span></button>
|
7
|
+
</div>
|
8
|
+
<div class="modal-body">
|
9
|
+
<%= yield %>
|
10
|
+
</div>
|
11
|
+
</div>
|
12
|
+
</div>
|
13
|
+
</div>
|
14
|
+
|
data/blacklight-gallery.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Chris Beer"]
|
10
10
|
spec.email = ["cabeer@stanford.edu"]
|
11
11
|
spec.summary = %q{Gallery display for Blacklight}
|
12
|
-
spec.homepage = ""
|
12
|
+
spec.homepage = "https://github.com/projectblacklight/blacklight-gallery"
|
13
13
|
spec.license = "Apache 2.0"
|
14
14
|
|
15
15
|
spec.files = `git ls-files`.split($/)
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
20
|
spec.add_dependency "rails"
|
21
|
-
spec.add_dependency "blacklight", "
|
21
|
+
spec.add_dependency "blacklight", "~> 5.0"
|
22
22
|
spec.add_dependency "bootstrap-sass", "~> 3.0"
|
23
23
|
|
24
24
|
spec.add_development_dependency "bundler", "~> 1.5"
|
data/config/jetty.yml
ADDED
@@ -2,4 +2,11 @@ en:
|
|
2
2
|
blacklight:
|
3
3
|
search:
|
4
4
|
view:
|
5
|
-
gallery: "Gallery"
|
5
|
+
gallery: "Gallery"
|
6
|
+
slideshow: "Slideshow"
|
7
|
+
blacklight_gallery:
|
8
|
+
catalog:
|
9
|
+
document_slideshow:
|
10
|
+
header: "Select an image to start the slideshow"
|
11
|
+
modal_slideshow:
|
12
|
+
counter: "%{counter} of %{count}"
|
Binary file
|
@@ -3,7 +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]
|
6
|
+
Blacklight::Configuration.default_values[:view].gallery.partials = [:index_header, :index]
|
7
|
+
Blacklight::Configuration.default_values[:view].slideshow.partials = [:index]
|
7
8
|
end
|
8
9
|
end
|
9
10
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require blacklight_gallery/slideshow
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Slideshow", :js do
|
4
|
+
|
5
|
+
it "should open when one of the grid panes are clicked" do
|
6
|
+
visit catalog_index_path( :q => 'medicine', :view => 'slideshow' )
|
7
|
+
expect(page).to have_content "You searched for:"
|
8
|
+
within ".view-type" do
|
9
|
+
click_link "Slideshow"
|
10
|
+
end
|
11
|
+
|
12
|
+
find('.grid [data-slide-to="0"]').trigger('click')
|
13
|
+
expect(page).to have_selector '#slideshow', visible: true
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -7,4 +7,10 @@ require 'engine_cart'
|
|
7
7
|
EngineCart.load_application!
|
8
8
|
|
9
9
|
require 'rspec/rails'
|
10
|
-
require 'capybara/
|
10
|
+
require 'capybara/poltergeist'
|
11
|
+
Capybara.javascript_driver = :poltergeist
|
12
|
+
|
13
|
+
RSpec.configure do |c|
|
14
|
+
c.treat_symbols_as_metadata_keys_with_true_values = true
|
15
|
+
end
|
16
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "catalog/_document_slideshow.html.erb" do
|
4
|
+
let(:blacklight_config) { Blacklight::Configuration.new }
|
5
|
+
|
6
|
+
let(:document) { stub_model(::SolrDocument) }
|
7
|
+
|
8
|
+
before do
|
9
|
+
view.stub(blacklight_config: blacklight_config)
|
10
|
+
view.stub(documents: [document])
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should have a edit tag form" do
|
14
|
+
render
|
15
|
+
expect(rendered).to have_selector '#slideshow-modal'
|
16
|
+
expect(rendered).to have_selector '[data-slide="prev"]'
|
17
|
+
expect(rendered).to have_selector '[data-slide="next"]'
|
18
|
+
expect(rendered).to have_selector '[data-slide-to="0"][data-toggle="modal"][data-target="#slideshow-modal"]'
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "catalog/_index_gallery.html.erb" do
|
4
|
+
let(:blacklight_config) { Blacklight::Configuration.new }
|
5
|
+
|
6
|
+
let(:document) { stub_model(::SolrDocument) }
|
7
|
+
|
8
|
+
before do
|
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)
|
13
|
+
end
|
14
|
+
|
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')
|
18
|
+
render
|
19
|
+
expect(rendered).to have_selector '.thumbnail', text: 'Thumbnail'
|
20
|
+
expect(rendered).to have_selector '.caption', text: 'Z'
|
21
|
+
end
|
22
|
+
end
|
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.
|
4
|
+
version: 0.0.2
|
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-
|
11
|
+
date: 2014-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -28,22 +28,16 @@ dependencies:
|
|
28
28
|
name: blacklight
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 5.0.0.pre4
|
34
|
-
- - "<"
|
31
|
+
- - "~>"
|
35
32
|
- !ruby/object:Gem::Version
|
36
|
-
version: '
|
33
|
+
version: '5.0'
|
37
34
|
type: :runtime
|
38
35
|
prerelease: false
|
39
36
|
version_requirements: !ruby/object:Gem::Requirement
|
40
37
|
requirements:
|
41
|
-
- - "
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: 5.0.0.pre4
|
44
|
-
- - "<"
|
38
|
+
- - "~>"
|
45
39
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
40
|
+
version: '5.0'
|
47
41
|
- !ruby/object:Gem::Dependency
|
48
42
|
name: bootstrap-sass
|
49
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -155,21 +149,34 @@ files:
|
|
155
149
|
- LICENSE.txt
|
156
150
|
- README.md
|
157
151
|
- Rakefile
|
152
|
+
- app/assets/javascripts/blacklight_gallery/slideshow.js
|
153
|
+
- app/assets/stylesheets/blacklight_gallery/_slideshow.css.scss
|
158
154
|
- app/assets/stylesheets/blacklight_gallery/default.css.scss
|
159
155
|
- app/views/catalog/_document_gallery.html.erb
|
156
|
+
- app/views/catalog/_document_slideshow.html.erb
|
157
|
+
- app/views/catalog/_grid_slideshow.html.erb
|
160
158
|
- app/views/catalog/_index_gallery.html.erb
|
159
|
+
- app/views/catalog/_index_slideshow.html.erb
|
160
|
+
- app/views/catalog/_slideshow.html.erb
|
161
|
+
- app/views/catalog/_slideshow_modal.html.erb
|
161
162
|
- blacklight-gallery.gemspec
|
163
|
+
- config/jetty.yml
|
162
164
|
- config/locales/blacklight-gallery.en.yml
|
165
|
+
- docs/screen_shot.png
|
163
166
|
- lib/blacklight/gallery.rb
|
164
167
|
- lib/blacklight/gallery/engine.rb
|
165
168
|
- lib/blacklight/gallery/version.rb
|
166
169
|
- lib/generators/blacklight_gallery/install_generator.rb
|
167
170
|
- lib/generators/blacklight_gallery/templates/blacklight_gallery.css.scss
|
171
|
+
- lib/generators/blacklight_gallery/templates/blacklight_gallery.js
|
168
172
|
- spec/features/gallery_spec.rb
|
173
|
+
- spec/features/slideshow_spec.rb
|
169
174
|
- spec/spec_helper.rb
|
170
175
|
- spec/test_app_templates/Gemfile.extra
|
171
176
|
- spec/test_app_templates/lib/generators/test_app_generator.rb
|
172
|
-
|
177
|
+
- spec/views/catalog/_document_slideshow.html.erb_spec.rb
|
178
|
+
- spec/views/catalog/_index_gallery.html.erb_spec.rb
|
179
|
+
homepage: https://github.com/projectblacklight/blacklight-gallery
|
173
180
|
licenses:
|
174
181
|
- Apache 2.0
|
175
182
|
metadata: {}
|
@@ -189,12 +196,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
189
196
|
version: '0'
|
190
197
|
requirements: []
|
191
198
|
rubyforge_project:
|
192
|
-
rubygems_version: 2.
|
199
|
+
rubygems_version: 2.4.1
|
193
200
|
signing_key:
|
194
201
|
specification_version: 4
|
195
202
|
summary: Gallery display for Blacklight
|
196
203
|
test_files:
|
197
204
|
- spec/features/gallery_spec.rb
|
205
|
+
- spec/features/slideshow_spec.rb
|
198
206
|
- spec/spec_helper.rb
|
199
207
|
- spec/test_app_templates/Gemfile.extra
|
200
208
|
- spec/test_app_templates/lib/generators/test_app_generator.rb
|
209
|
+
- spec/views/catalog/_document_slideshow.html.erb_spec.rb
|
210
|
+
- spec/views/catalog/_index_gallery.html.erb_spec.rb
|