effective_form_inputs 0.6.0 → 0.6.1
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: accc0fe7bd2c46e9ef6623d7c68683a77dc1f5f7
|
4
|
+
data.tar.gz: 029d82f57a52ec949f525d914fda00476fcc015e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 269ddf7bd1da80e1daeab5a6f2174b57f87c43c52d55d483dd40bcf894eeeb941358b80d489f035ec8dc38c163530befe630a16cc37b665bf488ceaac700083f
|
7
|
+
data.tar.gz: e29783d2fe62b7a9380683fd31478e664f12eb2a0f36699ead1337ae6d1540c2bd10676a577f48781e8d6426083856fdff1c0239b87539f6a385b2ad86a397d5
|
@@ -16,7 +16,14 @@ module Inputs
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def to_html
|
19
|
-
collection_select(@object_name, @method,
|
19
|
+
collection_select(@object_name, @method, collection, options[:value_method], options[:label_method], options, tag_options)
|
20
|
+
end
|
21
|
+
|
22
|
+
def collection
|
23
|
+
@collection ||= begin
|
24
|
+
collection = options.delete(:collection)
|
25
|
+
collection.respond_to?(:call) ? collection.call : collection.to_a
|
26
|
+
end
|
20
27
|
end
|
21
28
|
|
22
29
|
def options
|
@@ -7,7 +7,7 @@ module Inputs
|
|
7
7
|
DEFAULT_CELL_MASK = '(999) 999-9999'
|
8
8
|
|
9
9
|
def default_options
|
10
|
-
{cellphone: false}
|
10
|
+
{cellphone: false, fax: false}
|
11
11
|
end
|
12
12
|
|
13
13
|
def default_input_html
|
@@ -25,15 +25,35 @@ module Inputs
|
|
25
25
|
|
26
26
|
content_tag(:div, class: 'input-group') do
|
27
27
|
content_tag(:span, class: 'input-group-addon') do
|
28
|
-
content_tag(:i, '', class: "glyphicon glyphicon-#{
|
28
|
+
content_tag(:i, '', class: "glyphicon glyphicon-#{glyphicon}").html_safe
|
29
29
|
end +
|
30
30
|
text_field_tag(field_name, value, tag_options)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
+
def fax?
|
35
|
+
field_name.include?('fax') || options[:fax]
|
36
|
+
end
|
37
|
+
|
38
|
+
def cellphone?
|
39
|
+
field_name.include?('cell') || options[:cellphone]
|
40
|
+
end
|
41
|
+
|
42
|
+
def glyphicon
|
43
|
+
icon = 'earphone' # default
|
44
|
+
|
45
|
+
icon = 'phone' if field_name.include?('cell')
|
46
|
+
icon = 'phone-alt' if field_name.include?('fax')
|
47
|
+
|
48
|
+
icon = 'phone' if options[:cellphone]
|
49
|
+
icon = 'phone-alt' if options[:fax]
|
50
|
+
|
51
|
+
icon
|
52
|
+
end
|
53
|
+
|
34
54
|
def js_options
|
35
55
|
super.tap do |js_options|
|
36
|
-
if
|
56
|
+
if (fax? || cellphone?) && js_options[:mask] == DEFAULT_TEL_MASK
|
37
57
|
js_options[:mask] = DEFAULT_CELL_MASK
|
38
58
|
end
|
39
59
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_form_inputs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|