effective_form_inputs 0.3.0 → 0.3.1

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: 45de529453a2d243bc97c0c713cd6d28fc09c215
4
- data.tar.gz: 126577b42a8e3e88b089728fc75e0c978ecf3887
3
+ metadata.gz: 375f1f134953913fed15dd35f4d955efd89e7ae5
4
+ data.tar.gz: 3ade7ebdc2b7d71eb3542942f5eaff19b291e00c
5
5
  SHA512:
6
- metadata.gz: 5d6dbba9aa393814033c299bd4c24538050707651ae6a63ba5d33cc43a04982e2b5c385851980494611645268ffa52db783c8df050e237a9d27c98c55167c101
7
- data.tar.gz: f4e9316b76c6a80283da284a6deed20c16463bc75d87235cb79d99365ef0584bbcad7a3896f22630c5173402079a804d728840212b5ff92f91e76384e846718c
6
+ metadata.gz: c7d17d0ebe6e759bcb8e57184eb9e1480660b1f850b445fa0857e0b38bb0d4e2de8b5b11517160b602b0b13eefc94a91ea7c5bdc5f83dc18132b4970c26b128e
7
+ data.tar.gz: 988b7000d3fba5e5ef36fb2238ccf22fa1dd3f078d7eb9a17b9031ffdb4015164e1ee730f2d1a10e80d73747998469ebabaddce11e9d20f8152cd51ff299bec4
@@ -10,11 +10,11 @@ module Effective
10
10
  end
11
11
 
12
12
  def field_name
13
- @object_name + "[#{@method}]"
13
+ "#{@object_name}[#{@method}]"
14
14
  end
15
15
 
16
16
  def value
17
- options[:value] || @object.send(@method)
17
+ options[:value] || (@object.send(@method) if @object.respond_to?(@method))
18
18
  end
19
19
 
20
20
  def default_input_js_options; {} end
@@ -24,10 +24,10 @@ module Effective
24
24
  @form_field_options ||= (
25
25
  (@opts || {}).tap do |options|
26
26
  options['data-input-js-options'] = {} unless options['data-input-js-options'].kind_of?(Hash)
27
+ merge_class_options!(options)
27
28
 
28
29
  yield(options) if block_given?
29
30
 
30
- merge_class_options!(options)
31
31
  merge_input_js_options!(options)
32
32
  options.delete('data-input-js-options') if options['data-input-js-options'] == '{}'
33
33
  end
@@ -8,15 +8,16 @@ module Inputs
8
8
  end
9
9
 
10
10
  def to_html
11
- if options[:class].kind_of?(Array)
12
- options[:class].delete('form-control')
13
- elsif options[:class].kind_of?(String)
14
- options[:class].gsub!('form-control', '')
15
- end
16
-
17
11
  content_tag(:p, value, options)
18
12
  end
19
13
 
14
+ def options
15
+ super do |options|
16
+ options[:class].delete('form-control') if options[:class].kind_of?(Array)
17
+ options[:class].delete!('form-control') if options[:class].kind_of?(String)
18
+ end
19
+ end
20
+
20
21
  end
21
22
  end
22
23
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveFormInputs
2
- VERSION = '0.3.0'.freeze
2
+ VERSION = '0.3.1'.freeze
3
3
  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.3.0
4
+ version: 0.3.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-02-05 00:00:00.000000000 Z
11
+ date: 2015-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails