flag-icons-rails 3.4.6 → 3.4.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -0
- data/lib/flag-icons-rails/rails/helpers.rb +13 -11
- data/lib/flag-icons-rails/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 001ee1037c690bde826af00bc52d720c8bc9e9b7a48bf30a53be4f7293054e24
|
4
|
+
data.tar.gz: d7a01bf076ad364284e10caa1e6b1534df5dc72cd34268ff0a4181102c546d41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f492ee59ab00e0f1e74705f19c2798a84de18b0b4e985e5bfcfb403f51e0ed60ccc024439aecf8609b9319cbbe27d66484e417796225712916d81af0294eba9e
|
7
|
+
data.tar.gz: 4c78926868077bcd0919a359e5841cc47d90515488c7d610d5db09ac845d5332b7f6fdc98765693ea91f030ff8c1dd0261857d0f3082142d510c4874fc43ee9c
|
data/README.md
CHANGED
@@ -63,6 +63,11 @@ flag_icon(:by)
|
|
63
63
|
# => <span class="flag-icon flag-icon-by"></span>
|
64
64
|
```
|
65
65
|
|
66
|
+
```ruby
|
67
|
+
flag_icon(:by, element: :div)
|
68
|
+
# => <div class="flag-icon flag-icon-by"></div>
|
69
|
+
```
|
70
|
+
|
66
71
|
```ruby
|
67
72
|
flag_icon(:by, squared: true)
|
68
73
|
# => <span class="flag-icon flag-icon-by flag-icon-squared"></span>
|
@@ -3,19 +3,21 @@
|
|
3
3
|
module FlagIconsRails
|
4
4
|
module Rails
|
5
5
|
module ViewHelpers
|
6
|
-
# Helper to render flag icon
|
6
|
+
# Helper to render flag icon as single HTML element
|
7
7
|
#
|
8
|
-
# @param [Symbol|String] country_code
|
9
|
-
#
|
10
|
-
# @param [true, false]
|
11
|
-
# of flag will be rendered, defaults to +false+
|
8
|
+
# @param [Symbol|String] country_code ISO 3166-1 alpha-2 country code, see:
|
9
|
+
# https://www.iso.org/obp/ui/#search
|
10
|
+
# @param [true, false] squared Optional. It is used to determine if square or rectangular
|
11
|
+
# version of flag will be rendered, defaults to +false+
|
12
|
+
# @param [Symbol|String] element Optional. HTML element to generate and apply classes to,
|
13
|
+
# defaults to +:span+
|
12
14
|
# @param [Hash] html_options Optional. HTML options applied to rendered span, defaults to +{}+
|
13
15
|
#
|
14
|
-
# @return [String] +
|
15
|
-
def flag_icon(country_code, squared: false, **html_options)
|
16
|
+
# @return [String] +element+ with requested HTML options to display country flag
|
17
|
+
def flag_icon(country_code, squared: false, element: :span, **html_options)
|
16
18
|
html_options[:class] = flag_icon_content_class(country_code, squared, html_options[:class])
|
17
19
|
|
18
|
-
content_tag(
|
20
|
+
content_tag(element, nil, html_options)
|
19
21
|
end
|
20
22
|
|
21
23
|
private
|
@@ -23,12 +25,12 @@ module FlagIconsRails
|
|
23
25
|
def flag_icon_content_class(country_code, squared, custom_css_class)
|
24
26
|
content_classes = [
|
25
27
|
'flag-icon',
|
26
|
-
"flag-icon-#{country_code}",
|
27
|
-
(squared
|
28
|
+
"flag-icon-#{country_code}".downcase,
|
29
|
+
(squared ? 'flag-icon-squared' : ''),
|
28
30
|
custom_css_class
|
29
31
|
]
|
30
32
|
|
31
|
-
content_classes.join(' ').
|
33
|
+
content_classes.join(' ').squish
|
32
34
|
end
|
33
35
|
end
|
34
36
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flag-icons-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.4.6
|
4
|
+
version: 3.4.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evgeny Garlukovich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sass-rails
|
@@ -694,7 +694,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
694
694
|
- !ruby/object:Gem::Version
|
695
695
|
version: '0'
|
696
696
|
requirements: []
|
697
|
-
rubygems_version: 3.0.
|
697
|
+
rubygems_version: 3.0.8
|
698
698
|
signing_key:
|
699
699
|
specification_version: 4
|
700
700
|
summary: Gem to use `flag-icon-css` library in your Rails projects
|