picture_tag 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d48ecebb20b31b6c68c89a8773d492f779897026
4
- data.tar.gz: fdf83388d8347f676543ce06d239af3ab39c1306
3
+ metadata.gz: 3a9af7d361c938a418718cc7eb01503e378734f7
4
+ data.tar.gz: 189af94eb3fa54652f65950b554ae4822682ec80
5
5
  SHA512:
6
- metadata.gz: 4811204c7ce8fa711252429ee0926623fb7c5dbc1795e2dc0ef8d4014d6ec57031e30368587db977b387bd88d8001d1dbc9b9193c1dce19fa024cc70816661aa
7
- data.tar.gz: af3a4e0d62733cda4548288fa4ccf1bfce5c706c88f3ba9a0728adbc844619c809418e2be142a9472d2918f735f4f964e1ff6918e70dc717e9d3bef7da0da502
6
+ metadata.gz: 08d434f8df3f70b241672bbd9e55e4c6ba573e1a8cd88a2fa75813989952e3e8a3a856172bcd2449dd5c0c11bc12087e548047539456d40c485ceb1aaf2c473b
7
+ data.tar.gz: 8135b4c2e80c87775e625ae1f47b3b660161bf8b13015a10abfa39fe1c839e9dc588e76a35b65a1cf0232f8e49fe9991801e461a4ae2f2f56165662c09018690
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # PictureTag
2
2
 
3
- [![Coverage Status](https://img.shields.io/coveralls/tomasc/picture_tag.svg)](https://coveralls.io/r/tomasc/picture_tag)
3
+ [![Build Status](https://travis-ci.org/tomasc/picture_tag.svg)](https://travis-ci.org/tomasc/picture_tag) [![Gem Version](https://badge.fury.io/rb/picture_tag.svg)](http://badge.fury.io/rb/picture_tag) [![Coverage Status](https://img.shields.io/coveralls/tomasc/picture_tag.svg)](https://coveralls.io/r/tomasc/picture_tag)
4
4
 
5
5
  Rails helper for `<picture>` tag integrated with [Picturefill](http://scottjehl.github.io/picturefill/).
6
6
 
@@ -26,18 +26,18 @@ To make it work you need to add this to your `application.js`:
26
26
 
27
27
  ```Slim
28
28
  = picture_tag '/images/fallback.jpg', alt: 'Your smart alt attribute' do
29
- = source_tag srcset: '/images/extralarge.jpg', media: '(min-width: 1000px)', size: '100vw'
30
- = source_tag srcset: '/images/large.jpg', media: '(min-width: 800px)', size: '100vw'
31
- = source_tag srcset: '/images/medium.jpg', size: '100vw'
29
+ = source_tag srcset: '/images/extralarge.jpg', media: '(min-width: 1000px)', sizes: '100vw'
30
+ = source_tag srcset: '/images/large.jpg', media: '(min-width: 800px)', sizes: '100vw'
31
+ = source_tag srcset: '/images/medium.jpg', sizes: '100vw'
32
32
  ```
33
33
 
34
34
  produces
35
35
 
36
36
  ```HTML
37
37
  <picture>
38
- <source srcset="/images/extralarge.jpg" media="(min-width: 1000px)" size="100vw">
39
- <source srcset="/images/large.jpg" media="(min-width: 800px)" size="100vw" >
40
- <source srcset="/images/medium.jpg" size="100vw">
38
+ <source srcset="/images/extralarge.jpg" media="(min-width: 1000px)" sizes="100vw">
39
+ <source srcset="/images/large.jpg" media="(min-width: 800px)" sizes="100vw" >
40
+ <source srcset="/images/medium.jpg" sizes="100vw">
41
41
  <img alt="Your smart alt attribute" src="/images/fallback.jpg">
42
42
  </picture>
43
43
  ```
@@ -51,7 +51,7 @@ Note that the mandatory `img` tag is automatically generated based on the argume
51
51
 
52
52
  ## Contributing
53
53
 
54
- 1. Fork it ( https://github.com/[my-github-username]/picture_tag/fork )
54
+ 1. Fork it ( https://github.com/tomasc/picture_tag/fork )
55
55
  2. Create your feature branch (`git checkout -b my-new-feature`)
56
56
  3. Commit your changes (`git commit -am 'Add some feature'`)
57
57
  4. Push to the branch (`git push origin my-new-feature`)
@@ -1,3 +1,3 @@
1
1
  module PictureTag
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -11,7 +11,9 @@ module PictureTag
11
11
 
12
12
  def picture_tag src, options={}, &block
13
13
  content_tag :picture do
14
+ "<!--[if IE 9]><video style='display: none;'><![endif]-->".html_safe +
14
15
  capture(&block) +
16
+ "<!--[if IE 9]></video><![endif]-->".html_safe +
15
17
  image_tag(src, options)
16
18
  end
17
19
  end
data/lib/picture_tag.rb CHANGED
@@ -2,4 +2,4 @@ require "picture_tag/railtie" if defined?(Rails)
2
2
  require "picture_tag/engine"
3
3
  require "picture_tag/version"
4
4
 
5
- require "rails-assets-picturefill"
5
+ require "rails-assets-picturefill"
data/picture_tag.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["tomas.celizna@gmail.com"]
11
11
  spec.summary = %q{Rails helper for <picture> tag integrated with Picturefill.}
12
12
  spec.description = %q{Rails helper for <picture> tag integrated with Picturefill.}
13
- spec.homepage = ""
13
+ spec.homepage = "https://github.com/tomasc/picture_tag"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "rails", ">= 4.1.0"
21
+ spec.add_dependency "rails", ">= 3.0"
22
22
  spec.add_dependency "rails-assets-picturefill", ">= 2.0.0"
23
23
 
24
24
  spec.add_development_dependency "bundler", "~> 1.6"
@@ -21,6 +21,8 @@ module PictureTag
21
21
  let(:src) { 'src' }
22
22
  let(:alt) { 'alt' }
23
23
  let(:content) { 'content' }
24
+ let(:ie9_start) { "<!--[if IE 9]><video style='display: none;'><![endif]-->" }
25
+ let(:ie9_end) { "<!--[if IE 9]></video><![endif]-->" }
24
26
 
25
27
  it 'returns picture tag' do
26
28
  picture_tag(src, alt: alt) { content }.must_match Regexp.new("\\A<picture>.*?</picture>\\z")
@@ -41,6 +43,14 @@ module PictureTag
41
43
  it 'passes options to the image tag' do
42
44
  picture_tag(src, alt: alt) { content }.must_match Regexp.new("<img.*?alt=\"#{alt}\".*?/>")
43
45
  end
46
+
47
+ it 'wraps content with the IE9 fix' do
48
+ index_of_content = picture_tag(src) { content }.index(content)
49
+ index_of_ie9_start_tag = picture_tag(src) { content }.index(ie9_start)
50
+ index_of_ie9_end_tag = picture_tag(src) { content }.index(ie9_end)
51
+ (index_of_ie9_start_tag < index_of_content).must_equal true
52
+ (index_of_ie9_end_tag > index_of_content).must_equal true
53
+ end
44
54
  end
45
55
 
46
56
  end
data/test/test_helper.rb CHANGED
@@ -6,6 +6,8 @@ require 'minitest/autorun'
6
6
  require 'minitest/spec'
7
7
  require 'picture_tag'
8
8
  require 'rubygems'
9
- require 'coveralls'
10
9
 
11
- Coveralls.wear!
10
+ if ENV["CI"]
11
+ require "coveralls"
12
+ Coveralls.wear!
13
+ end
metadata CHANGED
@@ -1,97 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: picture_tag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Celizna
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-15 00:00:00.000000000 Z
11
+ date: 2014-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 4.1.0
19
+ version: '3.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 4.1.0
26
+ version: '3.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rails-assets-picturefill
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: 2.0.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: 2.0.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.6'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.6'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: coveralls
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: minitest
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  description: Rails helper for <picture> tag integrated with Picturefill.
@@ -101,9 +101,9 @@ executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
- - .coveralls.yml
105
- - .gitignore
106
- - .travis.yml
104
+ - ".coveralls.yml"
105
+ - ".gitignore"
106
+ - ".travis.yml"
107
107
  - Gemfile
108
108
  - LICENSE
109
109
  - README.md
@@ -118,7 +118,7 @@ files:
118
118
  - picture_tag.gemspec
119
119
  - test/picture_tag/view_helpers_test.rb
120
120
  - test/test_helper.rb
121
- homepage: ''
121
+ homepage: https://github.com/tomasc/picture_tag
122
122
  licenses:
123
123
  - MIT
124
124
  metadata: {}
@@ -128,21 +128,20 @@ require_paths:
128
128
  - lib
129
129
  required_ruby_version: !ruby/object:Gem::Requirement
130
130
  requirements:
131
- - - '>='
131
+ - - ">="
132
132
  - !ruby/object:Gem::Version
133
133
  version: '0'
134
134
  required_rubygems_version: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - '>='
136
+ - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  requirements: []
140
140
  rubyforge_project:
141
- rubygems_version: 2.1.10
141
+ rubygems_version: 2.2.2
142
142
  signing_key:
143
143
  specification_version: 4
144
144
  summary: Rails helper for <picture> tag integrated with Picturefill.
145
145
  test_files:
146
146
  - test/picture_tag/view_helpers_test.rb
147
147
  - test/test_helper.rb
148
- has_rdoc: