carousel 1.0.0 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/README.md +2 -2
- data/carousel.gemspec +9 -8
- data/vendor/assets/javascripts/carousel.js.coffee.erb +45 -1
- data/vendor/assets/stylesheets/carousel.css.scss +8 -6
- metadata +9 -28
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NTVjNDQwY2UyOWQ1ZDRhNjIyYzUxYjc5NGI1MjUyYzJjNDE1ZjdjMg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZmRmMGQ2Y2RhOGZhMDMxZTc5ZmJhMDQ4NjhiNmRhY2JmZGQ0NDNjNQ==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
OTc4ZTc0MjYzNmQ3YzI0ZTYxMTIyODA2N2NlZDE4YjQ2MjIzZWEwYWU2ZTQ4
|
10
|
+
MmE2MWEyN2Y4NTQwMDFjZjY5M2I4MTljOTc4MzQ0NmY5ZGQzMzY2Y2E0ZmY2
|
11
|
+
NGU5Y2Y4NzE4YjA0ZjE0NTFiODllYzc2NDEyZjA3ZDljM2I2NzA=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MmNkZWZmZjUyNDQzMjQ5MGNhNmZkN2FjN2Q1MjJjNjA4ZDExMDY0YWU2Njcz
|
14
|
+
MTZiM2M5YTZiMDcyMDVmM2Q2ZTBjODEyYzUwMWZjYzY5OTdlMjdmNWNkOTMz
|
15
|
+
NTg0ZTk3OWFjMDY2YmEyMmU0MTVkNWFiMTlkZjU4ZDBkYjJmMDQ=
|
data/README.md
CHANGED
@@ -113,5 +113,5 @@ Sub-Licenses
|
|
113
113
|
------------
|
114
114
|
|
115
115
|
Portions of this code were written by
|
116
|
-
|
117
|
-
under the CCAttribution-Share-Alike 2.5 (Brazil) license.
|
116
|
+
[Leandro Vieira Pinho](http://leandrovieira.com). These portions are
|
117
|
+
distributed under the CCAttribution-Share-Alike 2.5 (Brazil) license.
|
data/carousel.gemspec
CHANGED
@@ -2,14 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: carousel 1.1.2 ruby lib
|
5
6
|
|
6
7
|
Gem::Specification.new do |s|
|
7
8
|
s.name = "carousel"
|
8
|
-
s.version = "1.
|
9
|
+
s.version = "1.1.2"
|
9
10
|
|
10
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib"]
|
11
13
|
s.authors = ["Tim Morgan"]
|
12
|
-
s.date = "
|
14
|
+
s.date = "2014-12-20"
|
13
15
|
s.description = "Adds CoffeeScript and SCSS files to your Rails apps allowing you to easily create an Ajax-powered Carousel."
|
14
16
|
s.email = "rubygems@timothymorgan.info"
|
15
17
|
s.extra_rdoc_files = [
|
@@ -34,35 +36,34 @@ Gem::Specification.new do |s|
|
|
34
36
|
]
|
35
37
|
s.homepage = "http://github.com/RISCfuture/carousel"
|
36
38
|
s.licenses = ["MIT"]
|
37
|
-
s.
|
38
|
-
s.rubygems_version = "1.8.21"
|
39
|
+
s.rubygems_version = "2.4.5"
|
39
40
|
s.summary = "Simple image carousels in your Rails apps."
|
40
41
|
|
41
42
|
if s.respond_to? :specification_version then
|
42
|
-
s.specification_version =
|
43
|
+
s.specification_version = 4
|
43
44
|
|
44
45
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
45
46
|
s.add_runtime_dependency(%q<rails>, [">= 0"])
|
46
|
-
s.add_runtime_dependency(%q<compass>, [">= 0"])
|
47
47
|
s.add_runtime_dependency(%q<jquery-rails>, [">= 0"])
|
48
48
|
s.add_development_dependency(%q<yard>, [">= 0"])
|
49
|
+
s.add_development_dependency(%q<redcarpet>, [">= 0"])
|
49
50
|
s.add_development_dependency(%q<bundler>, [">= 0"])
|
50
51
|
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
51
52
|
s.add_development_dependency(%q<paperclip>, [">= 0"])
|
52
53
|
else
|
53
54
|
s.add_dependency(%q<rails>, [">= 0"])
|
54
|
-
s.add_dependency(%q<compass>, [">= 0"])
|
55
55
|
s.add_dependency(%q<jquery-rails>, [">= 0"])
|
56
56
|
s.add_dependency(%q<yard>, [">= 0"])
|
57
|
+
s.add_dependency(%q<redcarpet>, [">= 0"])
|
57
58
|
s.add_dependency(%q<bundler>, [">= 0"])
|
58
59
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
59
60
|
s.add_dependency(%q<paperclip>, [">= 0"])
|
60
61
|
end
|
61
62
|
else
|
62
63
|
s.add_dependency(%q<rails>, [">= 0"])
|
63
|
-
s.add_dependency(%q<compass>, [">= 0"])
|
64
64
|
s.add_dependency(%q<jquery-rails>, [">= 0"])
|
65
65
|
s.add_dependency(%q<yard>, [">= 0"])
|
66
|
+
s.add_dependency(%q<redcarpet>, [">= 0"])
|
66
67
|
s.add_dependency(%q<bundler>, [">= 0"])
|
67
68
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
68
69
|
s.add_dependency(%q<paperclip>, [">= 0"])
|
@@ -1,4 +1,25 @@
|
|
1
|
+
# An image carousel. Loads images from an Ajax endpoint and displays them in a
|
2
|
+
# grid. Clicking an image reveals it in a lightbox. The carousel uses infinite
|
3
|
+
# scrolling.
|
4
|
+
#
|
5
|
+
# The endpoint must return data in a specific format; see the README.md file.
|
6
|
+
#
|
7
|
+
# Use the `$(...).carousel(...)` method for a more jQuery-like syntax.
|
8
|
+
#
|
1
9
|
class Carousel
|
10
|
+
|
11
|
+
# Creates a new carousel manager.
|
12
|
+
#
|
13
|
+
# @param [jQuery element array] element The element to render the carousel
|
14
|
+
# into.
|
15
|
+
# @param [String] url The Ajax JSON endpoint that returns image metadata.
|
16
|
+
# @param [String] orientation Either 'horizontal' or 'vertical'.
|
17
|
+
# @param [Object] options Additional options.
|
18
|
+
# @option options [Boolean] captions (true) Whether to display captions next
|
19
|
+
# to images. (Captions are always displayed in lightboxes.)
|
20
|
+
# @option options [Boolean] lightboxes (true) Whether to enable lightbox
|
21
|
+
# functionality.
|
22
|
+
#
|
2
23
|
constructor: (@element, @url, @orientation, @options={}) ->
|
3
24
|
@options = $.extend({ captions: true, lightboxes: true }, @options)
|
4
25
|
@element.addClass "carousel-#{@orientation}"
|
@@ -7,6 +28,8 @@ class Carousel
|
|
7
28
|
this.refresh()
|
8
29
|
this.setScroll()
|
9
30
|
|
31
|
+
# Reloads images from the endpoint.
|
32
|
+
#
|
10
33
|
refresh: ->
|
11
34
|
this.clear()
|
12
35
|
$.ajax @url,
|
@@ -16,10 +39,13 @@ class Carousel
|
|
16
39
|
success: (data) =>
|
17
40
|
this.populate data
|
18
41
|
|
42
|
+
# Empties this carousel of images.
|
43
|
+
#
|
19
44
|
clear: ->
|
20
45
|
@element.find('>li').remove()
|
21
46
|
@data = []
|
22
47
|
|
48
|
+
# @private
|
23
49
|
populate: (data) ->
|
24
50
|
@data = @data.concat(data) # must clone it
|
25
51
|
|
@@ -45,30 +71,41 @@ class Carousel
|
|
45
71
|
|
46
72
|
this.loadNextPage() if this.noScroll() and data.length > 0
|
47
73
|
|
74
|
+
# Replaces the contents of this carousel with an error message.
|
75
|
+
#
|
76
|
+
# @param [String] error The error message.
|
48
77
|
setError: (error) ->
|
49
78
|
this.clear()
|
50
79
|
li = $('<li/>').addClass('center').appendTo @element
|
51
80
|
$('<p/>').addClass('error').text(error).appendTo li
|
52
81
|
|
82
|
+
# Replaces the contents of this carousel with a message.
|
83
|
+
#
|
84
|
+
# @param [String] note The message.
|
85
|
+
#
|
53
86
|
setNote: (note) ->
|
54
87
|
this.clear()
|
55
88
|
li = $('<li/>').addClass('center').appendTo @element
|
56
89
|
$('<p/>').addClass('note').text(note).appendTo li
|
57
90
|
|
91
|
+
# @private
|
58
92
|
setScroll: ->
|
59
93
|
@element.scroll =>
|
60
94
|
this.loadNextPage() if this.isAtEnd()
|
61
95
|
|
96
|
+
# @private
|
62
97
|
noScroll: ->
|
63
98
|
switch @orientation
|
64
99
|
when 'horizontal' then @element.width() == @element[0].scrollWidth
|
65
100
|
when 'vertical' then @element.height() == @element[0].scrollHeight
|
66
101
|
|
102
|
+
# @private
|
67
103
|
isAtEnd: ->
|
68
104
|
switch @orientation
|
69
105
|
when 'horizontal' then @element.scrollLeft() == @element[0].scrollWidth - @element.width()
|
70
|
-
when 'vertical' then @element.scrollTop() == @element[0].
|
106
|
+
when 'vertical' then @element.scrollTop() == @element[0].scrollHeight - @element.height()
|
71
107
|
|
108
|
+
# @private
|
72
109
|
loadNextPage: ->
|
73
110
|
return if @data.length == 0
|
74
111
|
$.ajax @url,
|
@@ -80,5 +117,12 @@ class Carousel
|
|
80
117
|
this.populate data
|
81
118
|
|
82
119
|
$.fn.extend
|
120
|
+
|
121
|
+
# Renders a new carousel into the target.
|
122
|
+
# @param [String] url The Ajax JSON endpoint that returns image metadata.
|
123
|
+
# @param [String] orientation Either 'horizontal' or 'vertical'.
|
124
|
+
# @param [Object] options Additional options to pass to {Carousel}.
|
125
|
+
# @return [Carousel] The new carousel manager.
|
126
|
+
#
|
83
127
|
carousel: (url, orient, options={}) ->
|
84
128
|
new Carousel(this, url, orient, options)
|
@@ -1,13 +1,11 @@
|
|
1
1
|
@import "vars";
|
2
|
-
@import "compass/css3/box";
|
3
|
-
@import "compass/css3/border-radius";
|
4
2
|
|
5
3
|
@mixin carousel {
|
6
|
-
|
4
|
+
border-radius: 5px;
|
7
5
|
|
8
6
|
margin-top: 1em;
|
9
7
|
|
10
|
-
|
8
|
+
&>li {
|
11
9
|
margin: 0.5em;
|
12
10
|
width: 140px;
|
13
11
|
}
|
@@ -20,10 +18,14 @@
|
|
20
18
|
|
21
19
|
ul.carousel-horizontal {
|
22
20
|
@include carousel;
|
23
|
-
|
24
|
-
|
21
|
+
display: flex;
|
22
|
+
flex-flow: row nowrap;
|
25
23
|
|
26
24
|
overflow-x: auto;
|
25
|
+
|
26
|
+
&>li {
|
27
|
+
flex: 0 0 auto;
|
28
|
+
}
|
27
29
|
}
|
28
30
|
|
29
31
|
ul.carousel-vertical {
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carousel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.1.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Tim Morgan
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-12-20 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rails
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ! '>='
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,15 +20,13 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ! '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
|
-
name:
|
28
|
+
name: jquery-rails
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ! '>='
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,31 +34,27 @@ dependencies:
|
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ! '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
|
-
name:
|
42
|
+
name: yard
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - ! '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
|
-
type: :
|
48
|
+
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - ! '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
56
|
+
name: redcarpet
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
59
|
- - ! '>='
|
68
60
|
- !ruby/object:Gem::Version
|
@@ -70,7 +62,6 @@ dependencies:
|
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
66
|
- - ! '>='
|
76
67
|
- !ruby/object:Gem::Version
|
@@ -78,7 +69,6 @@ dependencies:
|
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: bundler
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
73
|
- - ! '>='
|
84
74
|
- !ruby/object:Gem::Version
|
@@ -86,7 +76,6 @@ dependencies:
|
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
80
|
- - ! '>='
|
92
81
|
- !ruby/object:Gem::Version
|
@@ -94,7 +83,6 @@ dependencies:
|
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: jeweler
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
87
|
- - ! '>='
|
100
88
|
- !ruby/object:Gem::Version
|
@@ -102,7 +90,6 @@ dependencies:
|
|
102
90
|
type: :development
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
94
|
- - ! '>='
|
108
95
|
- !ruby/object:Gem::Version
|
@@ -110,7 +97,6 @@ dependencies:
|
|
110
97
|
- !ruby/object:Gem::Dependency
|
111
98
|
name: paperclip
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
100
|
requirements:
|
115
101
|
- - ! '>='
|
116
102
|
- !ruby/object:Gem::Version
|
@@ -118,7 +104,6 @@ dependencies:
|
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
107
|
requirements:
|
123
108
|
- - ! '>='
|
124
109
|
- !ruby/object:Gem::Version
|
@@ -149,29 +134,25 @@ files:
|
|
149
134
|
homepage: http://github.com/RISCfuture/carousel
|
150
135
|
licenses:
|
151
136
|
- MIT
|
137
|
+
metadata: {}
|
152
138
|
post_install_message:
|
153
139
|
rdoc_options: []
|
154
140
|
require_paths:
|
155
141
|
- lib
|
156
142
|
required_ruby_version: !ruby/object:Gem::Requirement
|
157
|
-
none: false
|
158
143
|
requirements:
|
159
144
|
- - ! '>='
|
160
145
|
- !ruby/object:Gem::Version
|
161
146
|
version: '0'
|
162
|
-
segments:
|
163
|
-
- 0
|
164
|
-
hash: 2934254892831708062
|
165
147
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
166
|
-
none: false
|
167
148
|
requirements:
|
168
149
|
- - ! '>='
|
169
150
|
- !ruby/object:Gem::Version
|
170
151
|
version: '0'
|
171
152
|
requirements: []
|
172
153
|
rubyforge_project:
|
173
|
-
rubygems_version:
|
154
|
+
rubygems_version: 2.4.5
|
174
155
|
signing_key:
|
175
|
-
specification_version:
|
156
|
+
specification_version: 4
|
176
157
|
summary: Simple image carousels in your Rails apps.
|
177
158
|
test_files: []
|