react-rails-img 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -1
- data/lib/react/rails/img/version.rb +1 -1
- data/vendor/assets/javascripts/react_rails_img.js.jsx.erb +5 -9
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92bbf43b988ae4241a44c672de0056376640608a
|
4
|
+
data.tar.gz: a873991113e97b07633fc36fd5cdd3b3f5c59d2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7226114309a51b81f40c45f8caed43f66a20176f992ab32398b198bb1b50dde9166d040162d3c1ff0364a72dd7ee47f4ea39824465355e4ae2d6cda8792efbb
|
7
|
+
data.tar.gz: e197d567926bc03fecaab7af1af528ff09cf1d92014984a0d1e8b2d521c5d0f0ec16806bc8276a8ca5fd95a20037f98559cbaf607548366963ceaa0b394073c3
|
data/README.md
CHANGED
@@ -44,7 +44,10 @@ just similar to rails helper `image_tag`
|
|
44
44
|
2. with props: e.g.: `imageTag('path/logo.png', {alt: 'logo', className: 'logo', id: 'logo', width: 100, height: 50})`
|
45
45
|
|
46
46
|
|
47
|
-
|
47
|
+
### helper for getting image path
|
48
|
+
|
49
|
+
e.g.: `Img.assetPath('placeholder/logo.png')`
|
50
|
+
|
48
51
|
## Acknowledgements
|
49
52
|
|
50
53
|
the image path will respect `Rails.env`, for development it will be sth like
|
@@ -4,15 +4,11 @@ prefix = Rails.application.config.assets.prefix
|
|
4
4
|
should_compute_assets_path = Rails.env.production? # for performance
|
5
5
|
if should_compute_assets_path
|
6
6
|
images_dir = Rails.root.join('app/assets/images/').to_s
|
7
|
-
assets.each_file
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
File.join('/', prefix, Rails.application.assets[file_name].digest_path)
|
13
|
-
else
|
14
|
-
File.join('/', prefix, file_name)
|
15
|
-
end
|
7
|
+
images_enumerator = defined?(assets) ? assets.each_file : Dir["#{images_dir}**/*.*"]
|
8
|
+
images_enumerator.each do |file_path|
|
9
|
+
if file_path.to_s.starts_with?(images_dir)
|
10
|
+
file_name = File.basename file_path
|
11
|
+
file_path = asset_path(file_name)
|
16
12
|
images[file_name] = file_path
|
17
13
|
end
|
18
14
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: react-rails-img
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- RainChen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
79
|
version: '0'
|
80
80
|
requirements: []
|
81
81
|
rubyforge_project:
|
82
|
-
rubygems_version: 2.
|
82
|
+
rubygems_version: 2.5.1
|
83
83
|
signing_key:
|
84
84
|
specification_version: 4
|
85
85
|
summary: simple image helpers for the rails project using react
|