image_zoomer 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/.gitignore +2 -0
- data/README.md +23 -3
- data/app/assets/javascripts/image_zoomer_initializer.js +3 -1
- data/image_zoomer.gemspec +3 -3
- data/lib/image_zoomer/configuration.rb +12 -0
- data/lib/image_zoomer/version.rb +1 -1
- data/lib/image_zoomer/zoom_image_helper.rb +1 -0
- metadata +3 -5
- data/LICENSE.txt +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1fa811da0829b6a088d6ffee24c4d3c882e6ee4b
|
4
|
+
data.tar.gz: d13db14bbe5f5cf10aefb2ee258ce7241eeddde6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d6fe47b7774e691e5071b63e02c79f84a25845bce6ac6a48e3982769d0aaba02a4335d81444146a15b326dce79a4035c4bc984879f730af2ab5dd35d79c9de0
|
7
|
+
data.tar.gz: d840df8809afbcbbfba5af81ea1577baae96cfefa05f1e1d6df677ccea0a50ba44111bae9ebef689240e4f5a0e363effd530f3993911d02c152489690855eef3
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# ImageZoomer
|
2
2
|
|
3
|
-
|
3
|
+
This is a Rails gem for my [image_zoomer](https://github.com/ilatif/image_zoomer) jQuery plugin. This gem provides an easy way to integrate `image_zoomer` jQuery plugin with your Rails apps.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -18,11 +18,31 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
To use this gem you can use standard `image_tag` helper that Rails provides. To have image zooming effect on your desired images you have to apply `image_zoomer` class on images. For example:
|
22
|
+
|
23
|
+
image_tag("/path/to/your/image.ext", :class => 'image_zoomer')
|
24
|
+
|
25
|
+
Recommended way is to use `zoom_image_tag` helper that this gem provides. By using `zoom_image_tag` helper you don't have to provide `image_zoomer` class.
|
26
|
+
|
27
|
+
zoom_image_tag("/path/to/your/image.ext", :id => "my_image")
|
28
|
+
|
29
|
+
`zoom_image_tag` is 100% identical to `image_tag`. You can use it in the same way and pass same options that you can pass to `image_tag`. You can also provide `:class => 'class1 class2'` option in `zoom_image_tag` and your provided classes will be applied.
|
30
|
+
|
31
|
+
By-default `width` and `height` of zoom lens are set to `90px` and `zoom_level` is set to `1.5`. To override these default settings you can create an initializer with `image_zoomer.rb` name under `config/initializers` directory and use following code:
|
32
|
+
|
33
|
+
Rails.application.config.image_zoomer.set_options do |options|
|
34
|
+
options.width = 30
|
35
|
+
options.height = 30
|
36
|
+
end
|
37
|
+
|
38
|
+
The above code will override `width` and `height` properties. As we haven't overridden `zoom_level` so it will remain at `1.5`. Restart your server to see these changes in action.
|
39
|
+
|
40
|
+
**Note: This gem prepares values dynamically for jQuery plugin when server starts. Due to asset pipeline issue if you make some change in code that overrides default image zooming settings then those changes don't take effect. To make sure that your changes always apply when you start / restart server this gem is deleting tmp/cache/assets directory in development mode. I hope your application is fine with this :-).**
|
41
|
+
|
22
42
|
|
23
43
|
## Contributing
|
24
44
|
|
25
|
-
1. Fork it
|
45
|
+
1. Fork it
|
26
46
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
47
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
48
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/image_zoomer.gemspec
CHANGED
@@ -9,11 +9,11 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Imran Latif"]
|
10
10
|
spec.email = ["ilatif.bwp@gmail.com"]
|
11
11
|
spec.summary = %q{Image Zoomer}
|
12
|
-
spec.description = %q{This
|
13
|
-
spec.homepage = "
|
12
|
+
spec.description = %q{This is a Rails gem for my image_zoomer jQuery plugin (https://github.com/ilatif/image_zoomer).}
|
13
|
+
spec.homepage = "https://github.com/ilatif/image_zoomer_rb"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
|
-
spec.files = `git ls-files
|
16
|
+
spec.files = `git ls-files`.split("\n")
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
@@ -1,5 +1,16 @@
|
|
1
|
+
# Configuration class to provide information to jQuery plugin to setup lens
|
1
2
|
module ImageZoomer
|
3
|
+
|
2
4
|
class Configuration
|
5
|
+
|
6
|
+
# == Parameters:
|
7
|
+
# width::
|
8
|
+
# Specifies width for zoom lens
|
9
|
+
# height::
|
10
|
+
# Specifies height for zoom lens
|
11
|
+
# zoom_level::
|
12
|
+
# Specifies zoom level for zoom lens
|
13
|
+
|
3
14
|
attr_accessor :width
|
4
15
|
attr_accessor :height
|
5
16
|
attr_accessor :zoom_level
|
@@ -10,6 +21,7 @@ module ImageZoomer
|
|
10
21
|
@zoom_level = 1.5
|
11
22
|
end
|
12
23
|
|
24
|
+
# Override default options with the provided ones in block
|
13
25
|
def set_options(&block)
|
14
26
|
block.yield(self)
|
15
27
|
end
|
data/lib/image_zoomer/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: image_zoomer
|
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
|
- Imran Latif
|
@@ -38,8 +38,7 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
description: This
|
42
|
-
plugin image_zoomer.
|
41
|
+
description: This is a Rails gem for my image_zoomer jQuery plugin (https://github.com/ilatif/image_zoomer).
|
43
42
|
email:
|
44
43
|
- ilatif.bwp@gmail.com
|
45
44
|
executables: []
|
@@ -50,7 +49,6 @@ files:
|
|
50
49
|
- Gemfile
|
51
50
|
- Gemfile.lock
|
52
51
|
- LICENSE
|
53
|
-
- LICENSE.txt
|
54
52
|
- README.md
|
55
53
|
- Rakefile
|
56
54
|
- app/assets/javascripts/image_zoomer.js
|
@@ -64,7 +62,7 @@ files:
|
|
64
62
|
- lib/image_zoomer/railtie.rb
|
65
63
|
- lib/image_zoomer/version.rb
|
66
64
|
- lib/image_zoomer/zoom_image_helper.rb
|
67
|
-
homepage:
|
65
|
+
homepage: https://github.com/ilatif/image_zoomer_rb
|
68
66
|
licenses:
|
69
67
|
- MIT
|
70
68
|
metadata: {}
|
data/LICENSE.txt
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2014 imranjs
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|