effective_bootstrap 0.3.7 → 0.3.8

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: 3347c35569c67c69da8675ac9cb0c5e27bb6e819
4
- data.tar.gz: c8e8b10ea9bcd6dc7ebbed4222efce44fad14e20
3
+ metadata.gz: dcb194f0ad7472f5bc556fd0f10095988d1d6ab5
4
+ data.tar.gz: cdf6ac07e6ce4eeb1801ebe45c00b120af56aed3
5
5
  SHA512:
6
- metadata.gz: 693e87a79b8e10b1d188ac29fcdeeb162dc15577a8e99ac877f5d246e3fb11f29164d6ba98213582817dec4303abdbbd2cb71a95da09187d8e4649e3f63abb16
7
- data.tar.gz: b7ba84a6226edb07a7ebb1c5f8ae2cfc82f3fab8f89644fab37f4c715d4e82eb6e5af542e2587f9c936a84db708621e58b564b8525af007f410cc9808b760ebe
6
+ metadata.gz: cd90c5c8ab62050127e08844afd9ef1fa436391e6c53057faa56c38a41ffef3f57de4b8f8f6acad048d3744ec6f1ffb1bc153309d2e0c7a898347af4bc722c6c
7
+ data.tar.gz: e12578590249cbb944194d159290d30874e165cb3894f06ce013798809d62c1fc7ed2256acb4a0e30e158e7168fa9c2e6dc98e598fa98f5b7cf7e73def0ebf7e
@@ -19,13 +19,15 @@ module Effective
19
19
  @text_options = { placeholder: 'Enter freeform', required: false }
20
20
  .merge(options[:text] || options[:text_field] || options.presence || {})
21
21
 
22
+ @email_field = options.fetch(:email, name_text.to_s.include?('email'))
23
+
22
24
  super
23
25
  end
24
26
 
25
27
  def to_html(&block)
26
28
  content_tag(:div, class: 'effective-select-or-text') do
27
29
  @builder.select(name, select_collection, select_options) +
28
- @builder.text_field(name_text, text_options) +
30
+ @builder.send(email_field? ? :email_field : text_field, name_text, text_options) +
29
31
  link_to(icon('rotate-ccw'), '#', class: 'effective-select-or-text-switch', title: 'Switch between choice and freeform', 'data-effective-select-or-text': true)
30
32
  end
31
33
  end
@@ -43,6 +45,10 @@ module Effective
43
45
  object.send(name_text).present? || object.errors[name_text].present?
44
46
  end
45
47
 
48
+ def email_field?
49
+ @email_field
50
+ end
51
+
46
52
  def select_options
47
53
  @select_options.merge(select? ? VISIBLE : HIDDEN)
48
54
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveBootstrap
2
- VERSION = '0.3.7'.freeze
2
+ VERSION = '0.3.8'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_bootstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.3.8
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: 2019-01-08 00:00:00.000000000 Z
11
+ date: 2019-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails