foundation_form_builder 1.0.1 → 1.1.0

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: 183f304b6211fa12cde89aae0e78b170d490b0df
4
- data.tar.gz: a2362672bfd036b6f9b3ac9bf3d1b26a54ca6a13
3
+ metadata.gz: d71254250869b42e00acb5e91dcf036814280f14
4
+ data.tar.gz: 67c656d50440452b0e3ed7692d24bc30b6eab518
5
5
  SHA512:
6
- metadata.gz: 650775362c18e92f35801166c790ebfa01a67f7a0adb502d77e29b41a7b4f744d4d6ab832fc306929bbbc28f03ce5a30d3d5a496b664222fc52e20e1f25dd7ff
7
- data.tar.gz: 58d0c7b56ed021e80f07f33c99acfc49003f852e2264051d723c5fbd1ef0e52671526a7681f512229c13aa284fd2db5c34a621ea5fa0db219a51dda65ce67c30
6
+ metadata.gz: d242be3d4146734969d4c701d8be3e7a0ef39293cca8163d1ca640341d7bcae785060e2996b99248bd7a786a5ac6830c6fc81968bb11497db68201e58a311c45
7
+ data.tar.gz: 989a9325ba9fde3b0475c1952887daf8a7646445f35b953b7b9a7ad36a422b8800faafd3f0504940b60ff98784d41865b0e6d0f624fb18c391342e054939967c
@@ -1,5 +1,11 @@
1
1
  # FoundationFormBuilder changelog
2
2
 
3
+ # 1.1.0
4
+
5
+ 4 Jun 2015
6
+
7
+ Support HTML numeric fields.
8
+
3
9
  # 1.0.1
4
10
 
5
11
  4 Jun 2015
data/README.md CHANGED
@@ -50,6 +50,7 @@ Note that `FoundationFormBuilder::Rails` uses the Rails form helper functions to
50
50
  | Field name is `email` | `email_field` |
51
51
  | Field name is `time_zone` | `time_zone_select` |
52
52
  | Field name contains the word `password` | `password_field` |
53
+ | Field maps to numeric column in DB | `number_field` |
53
54
  | Field maps to `date` column in DB | `date_field` |
54
55
  | Field maps to `text` column in DB | `text_area` |
55
56
  | Otherwise | `text_field` |
@@ -64,7 +65,7 @@ Since `FoundationFormBuilder::Rails` is a subclass of the standard Rails `Action
64
65
  | ------ | ------ |
65
66
  | `:field` | Hash of options to pass through to the underlying Rails form helper |
66
67
  | `:label` | Text for label |
67
- | `:type` | Explicit form helper type; overrides inferred types (see above). Significant values are `:date`, `:email`, `:password`, `:select`, `:textarea`, and `:time_zone`; `:text` or anything else will generate a text field. |
68
+ | `:type` | Explicit form helper type; overrides inferred types (see above). Significant values are `:date`, `:email`, `:numeric`, `:password`, `:select`, `:textarea`, and `:time_zone`; `:text` or anything else will generate a text field. |
68
69
  | `:values` | Values for `<option>` elements; only meaningful with `type: :select`. |
69
70
 
70
71
  The following example shows all of these options in use.
@@ -67,6 +67,7 @@ module FoundationFormBuilder
67
67
  method_mappings = {
68
68
  date: :date_field,
69
69
  email: :email_field,
70
+ numeric: :number_field,
70
71
  password: :password_field,
71
72
  textarea: :text_area,
72
73
  }
@@ -91,7 +92,14 @@ module FoundationFormBuilder
91
92
  type_mappings = {text: :textarea}
92
93
 
93
94
  db_type = @object.column_for_attribute(field_name).type
94
- type_mappings[db_type] || db_type
95
+ case db_type
96
+ when :text
97
+ :textarea
98
+ when :decimal, :integer, :float
99
+ :numeric
100
+ else
101
+ db_type
102
+ end
95
103
  end
96
104
  end
97
105
  end
@@ -1,3 +1,3 @@
1
1
  module FoundationFormBuilder
2
- VERSION = "1.0.1"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foundation_form_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marnen Laibow-Koser