lazy_image_tag 0.0.1 → 0.0.2

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.
data/.DS_Store CHANGED
Binary file
data/README.md CHANGED
@@ -12,29 +12,43 @@ And then execute:
12
12
 
13
13
  $ bundle
14
14
 
15
+ Please dont forget to include js and css files into your manifest files
16
+
17
+ //= require lazy-image-tag/lazy-image-tag.js
18
+
19
+ *= require lazy-image-tag/lazy-image-tag.css
20
+
15
21
  Or install it yourself as:
16
22
 
17
23
  $ gem install lazy_image_tag
18
24
 
19
25
  ## Usage
20
26
  with "config.lazy_image_tag.use_default = true" configuration your all existing image_tag's will be loaded lazyly
21
- with "config.lazy_image_tag.use_default = false" configuration you can use lazy loading with lazy_image_tag helper
27
+
28
+ image_tag("image src", :alt => "image alt", :width => "img width", :height => "img heigth")
29
+
30
+
31
+ with "config.lazy_image_tag.use_default = false" configuration you can use lazy loading with lazy_image_tag helper an you can still use rails's existing image_tag helper to render images normally
32
+
33
+ lazy_image_tag("image src", :alt => "image alt", :width => "img width", :height => "img heigth")
22
34
 
23
35
  ## Configuration
24
36
  In your application.rb file or environment(s) initializer file you can set configurations easly like the above
25
37
 
26
- config.lazy_image_tag.use_default = true # with this configuration image_tag helper becomes lazy_image_tag helper
27
-
28
- .
29
- .
30
- .
38
+ # with this configuration image_tag helper becomes lazy_image_tag helper
39
+ config.lazy_image_tag.use_default = true
31
40
 
32
- config.lazy_image_tag.js_disabled = :noscript # with this configuration users will see normal image tag if their browser does not support javascript or disabled manually
41
+ # with this configuration users will see normal image tag if their browser does not support javascript
42
+ config.lazy_image_tag.js_disabled = :noscript
43
+
44
+ # with this configuration you can change loading animation easly
45
+ config.lazy_image_tag.loading_img = "loading.gif"
33
46
 
34
47
  ## Valid Config Options
35
48
 
36
49
  :use_default => [false, true]
37
50
  :js_disabled => [:none, :link, :noscript]
51
+ :loading_img => "valid_image_path"
38
52
 
39
53
  ## Contributing
40
54
 
@@ -7,6 +7,7 @@ module LazyImageTag
7
7
  initializer "initialize config variables" do
8
8
  valid_configs[:use_default].include?(config.lazy_image_tag.use_default) || config.lazy_image_tag.use_default = false
9
9
  valid_configs[:js_disabled].include?(config.lazy_image_tag.js_disabled) || config.lazy_image_tag.js_disabled = :none
10
+ config.lazy_image_tag.loading_img ||= "lazy-image-tag/loader.gif"
10
11
  end
11
12
 
12
13
  initializer "injects helper method into ActionView::Base" do
@@ -26,7 +26,7 @@ module LazyImageTag
26
26
  custom_opts[:data] ||= {}
27
27
  custom_opts[:data][:original] = source = path_to_image(source)
28
28
  custom_opts[:class].blank? ? custom_opts[:class] = "lazy" : custom_opts[:class] << " lazy"
29
- custom_source = path_to_image("blank.png")
29
+ custom_source = path_to_image("lazy-image-tag/blank.png")
30
30
  content = image_tag(custom_source, custom_opts)
31
31
  content << content_tag(:noscript, image_tag(source, options)) if Rails.application.config.lazy_image_tag.js_disabled == :noscript
32
32
  content_tag(:div, content, container_options(options))
@@ -1,3 +1,3 @@
1
1
  module LazyImageTag
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/vendor/.DS_Store CHANGED
Binary file
Binary file
@@ -1,4 +1,4 @@
1
- //= require jquery.lazyload.min.js
1
+ //= require lazy-image-tag/jquery.lazyload.min.js
2
2
 
3
3
  $(document).ready(function(){
4
4
  var image_id = 0;
@@ -8,7 +8,7 @@ $(document).ready(function(){
8
8
  var data_width = $(this).attr('data-width');
9
9
  var data_id = $(this).attr('data-id');
10
10
  var id = "lazy-image" + image_id;
11
- $(this).replaceWith('<img src="<%= asset_path("blank.png") %>" alt="' + $(this).html() + '" data-original="' + $(this).attr('href') + '" class="lazy ' + $(this).attr('class') + '" id="' + id + '"/>')
11
+ $(this).replaceWith('<img src="<%= asset_path("lazy-image-tag/blank.png") %>" alt="' + $(this).html() + '" data-original="' + $(this).attr('href') + '" class="lazy ' + $(this).attr('class') + '" id="' + id + '"/>')
12
12
  if(data_height != null)
13
13
  $('#' + id).attr('height', data_height);
14
14
  if(data_width != null)
@@ -0,0 +1,3 @@
1
+ .lazy-image-container{
2
+ background: url(<%= asset_path(Rails.application.config.lazy_image_tag.loading_img) %>) no-repeat center center;
3
+ }
metadata CHANGED
@@ -1,64 +1,71 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: lazy_image_tag
3
- version: !ruby/object:Gem::Version
4
- version: 0.0.1
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 2
9
+ version: 0.0.2
5
10
  platform: ruby
6
- authors:
7
- - Mehmet Emin İNAÇ
11
+ authors:
12
+ - "Mehmet Emin \xC4\xB0NA\xC3\x87"
8
13
  autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
- date: 2014-03-20 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
16
+
17
+ date: 2014-03-31 00:00:00 +03:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
14
21
  name: rails
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - '>='
18
- - !ruby/object:Gem::Version
19
- version: 3.1.0
20
- type: :runtime
21
22
  prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - '>='
25
- - !ruby/object:Gem::Version
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 3
29
+ - 1
30
+ - 0
26
31
  version: 3.1.0
27
- - !ruby/object:Gem::Dependency
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
28
35
  name: bundler
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ~>
32
- - !ruby/object:Gem::Version
33
- version: '1.3'
34
- type: :development
35
36
  prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ requirements:
38
39
  - - ~>
39
- - !ruby/object:Gem::Version
40
- version: '1.3'
41
- - !ruby/object:Gem::Dependency
42
- name: rake
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - '>='
46
- - !ruby/object:Gem::Version
47
- version: '0'
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 1
43
+ - 3
44
+ version: "1.3"
48
45
  type: :development
46
+ version_requirements: *id002
47
+ - !ruby/object:Gem::Dependency
48
+ name: rake
49
49
  prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - '>='
53
- - !ruby/object:Gem::Version
54
- version: '0'
50
+ requirement: &id003 !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ segments:
55
+ - 0
56
+ version: "0"
57
+ type: :development
58
+ version_requirements: *id003
55
59
  description: This gem gives you to render lazy image ability
56
- email:
60
+ email:
57
61
  - mehmetemininac@gmail.com
58
62
  executables: []
63
+
59
64
  extensions: []
65
+
60
66
  extra_rdoc_files: []
61
- files:
67
+
68
+ files:
62
69
  - .DS_Store
63
70
  - .gitignore
64
71
  - Gemfile
@@ -73,33 +80,40 @@ files:
73
80
  - lib/lazy_image_tag/version.rb
74
81
  - vendor/.DS_Store
75
82
  - vendor/assets/.DS_Store
76
- - vendor/assets/images/blank.png
77
- - vendor/assets/images/loader.gif
78
- - vendor/assets/javascripts/jquery.lazyload.min.js
79
- - vendor/assets/javascripts/lazy-image-tag.js.erb
80
- - vendor/assets/stylesheets/lazy-image-tag.css.erb
83
+ - vendor/assets/images/lazy-image-tag/blank.png
84
+ - vendor/assets/images/lazy-image-tag/loader.gif
85
+ - vendor/assets/javascripts/lazy-image-tag/jquery.lazyload.min.js
86
+ - vendor/assets/javascripts/lazy-image-tag/lazy-image-tag.js.erb
87
+ - vendor/assets/stylesheets/lazy-image-tag/lazy-image-tag.css.erb
88
+ has_rdoc: true
81
89
  homepage: http://github.com/meinac/lazy_image_tag
82
- licenses:
90
+ licenses:
83
91
  - MIT
84
- metadata: {}
85
92
  post_install_message:
86
93
  rdoc_options: []
87
- require_paths:
94
+
95
+ require_paths:
88
96
  - lib
89
- required_ruby_version: !ruby/object:Gem::Requirement
90
- requirements:
91
- - - '>='
92
- - !ruby/object:Gem::Version
93
- version: '0'
94
- required_rubygems_version: !ruby/object:Gem::Requirement
95
- requirements:
96
- - - '>='
97
- - !ruby/object:Gem::Version
98
- version: '0'
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ segments:
102
+ - 0
103
+ version: "0"
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ segments:
109
+ - 0
110
+ version: "0"
99
111
  requirements: []
112
+
100
113
  rubyforge_project:
101
- rubygems_version: 2.0.3
114
+ rubygems_version: 1.3.6
102
115
  signing_key:
103
- specification_version: 4
116
+ specification_version: 3
104
117
  summary: Creates new helper method which name is lazy_image_tag
105
118
  test_files: []
119
+
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 9750f1a64993cb21944a1034ff3bb1c67b8fe07c
4
- data.tar.gz: 65af748c1ec842e620754489688fad75bc70eefb
5
- SHA512:
6
- metadata.gz: 7f7e12a6f8db2c07305957b2fde682413abd6ecf90ae39bfbc8d187b77863ab6a247c0d0d37af26549012ee4c239cc39ba42d1260988b6a40ff084a23b83d7da
7
- data.tar.gz: 5f1a6c5fe1e26bbbec2e12946461d92dc3710a67a3e0b213b0c677b676739ec9e6cb0d12b07aa8d1ba803d039a6a5cf6f49a742ac0a395b4102f27e5a4ac7ae9
@@ -1,3 +0,0 @@
1
- .lazy-image-container{
2
- background: url(<%= asset_path("loader.gif") %>) no-repeat center center;
3
- }