rails_picture 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/lib/rails_picture/rails_picture_helper.rb +4 -4
- data/lib/rails_picture/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28574426228d63c2304d47b30fed29314d5215e5a1a0f383179205fd5c5185c5
|
4
|
+
data.tar.gz: ddd1854b8e4548fc6cf7f10fb54533003c5a36ba9c6af74aa0748f80715a277c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9cb47838919e94a48cb9dbb4c7c50a2597b8f6431585b9888308743f272fa62c827e629def29e2b168d9b8f2382d98152f7dd2964ffbf588a0e113bb15179eab
|
7
|
+
data.tar.gz: acc96233d5e7db84475eb0164554ef573160baadf9af1615ddfc7b7934aa3f73e2d6357d56e70b64c4a92f0cf5e41865ee4009b94c6a4458c2c86bd327abb4b4
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -71,7 +71,7 @@ Add this line to your application's Gemfile:
|
|
71
71
|
|
72
72
|
```ruby
|
73
73
|
|
74
|
-
gem
|
74
|
+
gem 'rails_picture'
|
75
75
|
|
76
76
|
```
|
77
77
|
|
@@ -85,7 +85,7 @@ bundle install
|
|
85
85
|
|
86
86
|
## Usage
|
87
87
|
|
88
|
-
1. Put multiple same-named images with different file formats into `app/assets/`
|
88
|
+
1. Put multiple same-named images with different file formats into `app/assets/images/`
|
89
89
|
|
90
90
|
2. Place following code into any Rails view. It takes the same options as Rails built in `image_tag` :
|
91
91
|
|
@@ -10,20 +10,20 @@ module RailsPicture
|
|
10
10
|
def picture_tag(filename, **options)
|
11
11
|
html = []
|
12
12
|
|
13
|
-
SOURCE_FORMATS.each { |f| html <<
|
13
|
+
SOURCE_FORMATS.each { |f| html << build_source_tag(filename, f) }
|
14
14
|
|
15
|
-
html <<
|
15
|
+
html << build_image_tag(filename, **options)
|
16
16
|
|
17
17
|
tag.picture { safe_join html }
|
18
18
|
end
|
19
19
|
|
20
20
|
private
|
21
21
|
|
22
|
-
def
|
22
|
+
def build_source_tag(filename, format)
|
23
23
|
tag.source(srcset: asset_path(filename, format), type: "image/#{format}")
|
24
24
|
end
|
25
25
|
|
26
|
-
def
|
26
|
+
def build_image_tag(filename, **options)
|
27
27
|
tag.img(src: find_img_format(filename), alt: filename.humanize, **options)
|
28
28
|
end
|
29
29
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_picture
|
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
|
- Oskars Ezerins
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|