thumbnail_hover_effect 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fbb201d59dc2fc20eacfce316ece236e08d8d170
|
4
|
+
data.tar.gz: f9ab96a0fb6a7a8c6312602acbe6aeecd7e99303
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d5e322bb92b63281b652e7d55c0640145d5be2c07703651b7a481b1f62b9f0a6ff1c7d44848844d7137a6a9a4c350c109a5d4a9664c66f46cf03ab9ee4e7b33
|
7
|
+
data.tar.gz: 03bf055ad210e827043dd81faa20cfb383335131eb1d606c65df2df7ccbd7de02dde9111f921e4c9e6acd7902bf5eb09df8ffd5db17630d6ddd9596b200a8a19
|
@@ -14,7 +14,7 @@
|
|
14
14
|
<orderEntry type="inheritedJdk" />
|
15
15
|
<orderEntry type="sourceFolder" forTests="false" />
|
16
16
|
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.3.5, RVM: ruby-2.0.0-p247) [gem]" level="application" />
|
17
|
-
<orderEntry type="library" scope="PROVIDED" name="rake (v10.
|
17
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v10.3.2, RVM: ruby-2.0.0-p247) [gem]" level="application" />
|
18
18
|
</component>
|
19
19
|
</module>
|
20
20
|
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# ThumbnailHoverEffect
|
2
2
|
|
3
|
-
Introduces simple
|
4
|
-
The idea is inspired by [this
|
3
|
+
Introduces simple thumbnail 3D image hover effects using CSS 3D transforms.
|
4
|
+
The idea is inspired by [this great codedrops article] (http://tympanus.net/codrops/2012/06/18/3d-thumbnail-hover-effects/).
|
5
5
|
|
6
6
|
|
7
7
|
## Installation
|
@@ -18,6 +18,30 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
$ gem install thumbnail_hover_effect
|
20
20
|
|
21
|
+
## Creating demonstration thumbnail hover effect
|
22
|
+
|
23
|
+
In order to get known with the thumbnail hover effect options you can create a demo thumbnail hover effect following the steps below:
|
24
|
+
|
25
|
+
__Creating thumbnail files__
|
26
|
+
|
27
|
+
Executing the following line in your rails application console:
|
28
|
+
|
29
|
+
rails generate thumbnail demo
|
30
|
+
|
31
|
+
Add the following lines in your *application.css* file:
|
32
|
+
|
33
|
+
*= require thumbnails/fontello.css
|
34
|
+
*= require thumbnails/demo/demo.css.sass
|
35
|
+
|
36
|
+
__Rendering images with thumbnail hover effect__
|
37
|
+
|
38
|
+
Create a instances of the generated thumbnail class and call their *render* functions like this:
|
39
|
+
|
40
|
+
<%= Demo.new.render({effect_number:1}) %>
|
41
|
+
<%= Demo.new.render({effect_number:2}) %>
|
42
|
+
<%= Demo.new.render({effect_number:3}) %>
|
43
|
+
<%= Demo.new.render({effect_number:4}) %>
|
44
|
+
|
21
45
|
## Usage
|
22
46
|
|
23
47
|
### Basic Usage
|
@@ -26,7 +50,7 @@ In order to implement the thumbnail 3D image hover effects in your rails applica
|
|
26
50
|
|
27
51
|
__Creating thumbnail files__
|
28
52
|
|
29
|
-
Executing the following line in your rails application
|
53
|
+
Executing the following line in your rails application console:
|
30
54
|
|
31
55
|
rails generate thumbnail class_name
|
32
56
|
|
@@ -49,7 +73,7 @@ Add the following lines in your *application.css* file:
|
|
49
73
|
|
50
74
|
__Rendering images with thumbnail hover effect__
|
51
75
|
|
52
|
-
Create a instance
|
76
|
+
Create a instance of the generated thumbnail class and call its *render* function like this:
|
53
77
|
|
54
78
|
ClassName.new(
|
55
79
|
{
|
@@ -68,7 +92,7 @@ Note:
|
|
68
92
|
|
69
93
|
####Using the right settings#####
|
70
94
|
|
71
|
-
The gem generator is creating 3D hover effects using CSS 3D transforms. Because of this, you are not able to use the generated *CSS*
|
95
|
+
The gem generator is creating 3D image hover effects using CSS 3D transforms. Because of this, you are not able to use the generated *CSS* rules
|
72
96
|
for images with different width and height.
|
73
97
|
|
74
98
|
The generator uses default width and height if they are not supplied, but in most cases you will need to specify them:
|
@@ -82,7 +106,7 @@ or
|
|
82
106
|
|
83
107
|
####Thumbnail Effects#####
|
84
108
|
|
85
|
-
There are four built-in thumbnail effects. By default, the generator is generating *CSS* for all of them.
|
109
|
+
There are four built-in thumbnail effects. By default, the generator is generating *CSS* rules for all of them.
|
86
110
|
|
87
111
|
1. How to generate *CSS* for specific thumbnail effect only?
|
88
112
|
|
@@ -105,7 +129,7 @@ There are four built-in thumbnail effects. By default, the generator is generati
|
|
105
129
|
}
|
106
130
|
).render
|
107
131
|
|
108
|
-
|
132
|
+
If you need to specify an effect you can pass it as *render* function parameter:
|
109
133
|
|
110
134
|
ClassName.new(
|
111
135
|
{
|
@@ -116,8 +140,8 @@ There are four built-in thumbnail effects. By default, the generator is generati
|
|
116
140
|
|
117
141
|
####Thumbnail Template#####
|
118
142
|
|
119
|
-
Creating a thumbnail *HTML* template is the key part of the thumbnail image 3D
|
120
|
-
which is shown on image hover and it can be customized to meet the developer needs.
|
143
|
+
Creating a thumbnail *HTML* template is the key part of the thumbnail image hover 3D effect. Basically, this is the *HTML*,
|
144
|
+
which is shown on image hover event and it can be customized to meet the developer needs.
|
121
145
|
|
122
146
|
1. How to create *HTML* thumbnail template?
|
123
147
|
|
@@ -137,7 +161,6 @@ which is shown on image hover and it can be customized to meet the developer nee
|
|
137
161
|
</div>
|
138
162
|
"
|
139
163
|
end
|
140
|
-
|
141
164
|
|
142
165
|
2. How to pass arguments to thumbnail template?
|
143
166
|
|
@@ -145,8 +168,8 @@ which is shown on image hover and it can be customized to meet the developer nee
|
|
145
168
|
|
146
169
|
ClassName.new(
|
147
170
|
{
|
148
|
-
url:image.image_url,
|
149
|
-
attributes:{likes:'12', dislikes: '2'}
|
171
|
+
url: image.image_url,
|
172
|
+
attributes: {likes:'12', dislikes: '2'}
|
150
173
|
}
|
151
174
|
).render
|
152
175
|
|
@@ -9,7 +9,7 @@ class ThumbnailGenerator < Rails::Generators::Base
|
|
9
9
|
class_option :width, type: 'numeric', default: 300, aliases: '-w',
|
10
10
|
desc: 'specifies image width'
|
11
11
|
|
12
|
-
class_option :height, type: 'numeric', default:
|
12
|
+
class_option :height, type: 'numeric', default: 200, aliases: '-h',
|
13
13
|
desc: 'specifies image height'
|
14
14
|
|
15
15
|
class_option :effects, type: 'string', default: '1,2,3,4', aliases: '-e',
|
@@ -3,7 +3,8 @@ module ThumbnailHoverEffect
|
|
3
3
|
class Image
|
4
4
|
|
5
5
|
# image use if such is not specified
|
6
|
-
IMAGE_NOT_FOUND = '/
|
6
|
+
IMAGE_NOT_FOUND = '/assets/no-image-found.jpg'
|
7
|
+
IMAGE_DEMO = '/assets/demo/demo.jpg'
|
7
8
|
|
8
9
|
# class attributes
|
9
10
|
attr_accessor :url, # image source url
|
@@ -11,11 +12,20 @@ module ThumbnailHoverEffect
|
|
11
12
|
|
12
13
|
# validating input parameters and using defaults if necessary
|
13
14
|
def initialize(parameters = {})
|
15
|
+
# demo mode
|
16
|
+
if parameters.empty?
|
17
|
+
parameters = {
|
18
|
+
url: IMAGE_DEMO,
|
19
|
+
attributes:{likes:'224', dislikes: '2', url:'#'}
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
14
23
|
@url = parameters.fetch(:url, IMAGE_NOT_FOUND)
|
15
24
|
@attributes = parameters.fetch(:attributes, {})
|
16
25
|
|
17
26
|
@url = IMAGE_NOT_FOUND unless File.extname(@url) =~/^(.png|.gif|.jpg|.jpeg|.bmp)$/
|
18
27
|
@attributes = {} unless @attributes.is_a?(Hash)
|
28
|
+
|
19
29
|
end
|
20
30
|
|
21
31
|
# rendering image without thumbnail effect
|
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thumbnail_hover_effect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- gotqn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -72,6 +72,7 @@ files:
|
|
72
72
|
- lib/thumbnail_hover_effect/image.rb
|
73
73
|
- lib/thumbnail_hover_effect/version.rb
|
74
74
|
- thumbnail_hover_effect.gemspec
|
75
|
+
- vendor/assets/images/demo/demo.jpg
|
75
76
|
- vendor/assets/images/no-image-found.jpg
|
76
77
|
homepage: https://github.com/gotqn/thumbnail_hover_effect
|
77
78
|
licenses:
|
@@ -93,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
94
|
version: '0'
|
94
95
|
requirements: []
|
95
96
|
rubyforge_project:
|
96
|
-
rubygems_version: 2.0
|
97
|
+
rubygems_version: 2.3.0
|
97
98
|
signing_key:
|
98
99
|
specification_version: 4
|
99
100
|
summary: Introduces simple image thumbnail 3D image hover effects using CSS 3D transforms.
|