foundation-formbuilder-rails 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +52 -13
- data/lib/foundation/form_builder/rails.rb +2 -1
- data/lib/foundation/form_builder/rails/generators/install_generator.rb +17 -0
- data/lib/foundation/form_builder/rails/templates/global_formbuilder.rb +3 -0
- data/lib/foundation/form_builder/rails/version.rb +1 -1
- metadata +119 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d43eeb91f25647575889ad3fb4a85337fdf23ee
|
4
|
+
data.tar.gz: 07a1537e5c9fe3b194c5ff4d1352ca2184285aed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 697513b1a40fd7ed11708be683a16eef4ba861a80206903e84c91d96937069aabafa38ce7e6b290bed79122876fc5e957fe16a1cba85bbb960797c05105f0b97
|
7
|
+
data.tar.gz: f833896949f50bde3d069adb0bcef88ea02197dcdbbc2a1798151a79d81b2c0bae3424d79b0a893c1171e75635f267ecfcbbdfdc172bbfd2d9474c8789c4f13e
|
data/README.md
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
# foundation-formbuilder-rails v0.2.
|
1
|
+
# foundation-formbuilder-rails v0.2.3
|
2
2
|
|
3
3
|
This is a custom FormBuilder used to display form elements generated
|
4
|
-
by the form_for helpers in the correct style for
|
4
|
+
by the `form_for` helpers in the correct style for
|
5
5
|
the [*Foundation 5 Framework*](http://foundation.zurb.com/).
|
6
6
|
|
7
7
|
|
8
8
|
See the Foundation [docs](http://foundation.zurb.com/docs/components/forms.html)
|
9
9
|
for form specifics.
|
10
10
|
|
11
|
-
|
11
|
+
## Getting Started
|
12
12
|
|
13
|
-
1. Add the foundation-formbuilder-rails Gem to your project's `Gemfile`:
|
13
|
+
1. Add the `foundation-formbuilder-rails` Gem to your project's `Gemfile`:
|
14
14
|
|
15
|
-
gem 'foundation-formbuilder-rails'
|
15
|
+
gem 'foundation-formbuilder-rails'
|
16
16
|
|
17
17
|
2. Ensure you are using the FormBuilder in your form:
|
18
18
|
|
@@ -20,15 +20,41 @@ for form specifics.
|
|
20
20
|
...
|
21
21
|
end
|
22
22
|
|
23
|
-
3.
|
23
|
+
3. Alternatively, you can set the FormBuilder globally in an initializer,
|
24
|
+
`ActionView::Base.default_form_builder = Foundation::FormBuilder::Rails::FormBuilder`.
|
24
25
|
|
25
|
-
|
26
|
+
4. This can be achieved by running:
|
27
|
+
|
28
|
+
rails generate foundation:form_builder:install
|
29
|
+
|
30
|
+
5. Be sure to restart your application once this has been done. Then you only need:
|
31
|
+
|
32
|
+
form_for @test do |f|
|
33
|
+
|
34
|
+
6. For usage, see comments in the [source code](https://github.com/ashleybye/foundation-formbuilder-rails/blob/master/lib/foundation/form_builder/rails/form_builder.rb). I will get around to adding proper use examples to the README in the future. However, as a quick reference, the original Rails methods will
|
35
|
+
still return the standard content but prefix with `zurb_` and it will return the content formatted
|
36
|
+
for Foundation:
|
37
|
+
|
38
|
+
form_for @test do |f|
|
39
|
+
f.zurb_text_field :name
|
40
|
+
end
|
41
|
+
# => <form accept-charset="UTF-8" action="/test" class="new_test" id="new_test" method="post">
|
42
|
+
<div style="display:none">
|
43
|
+
<input name="utf8" type="hidden" value="✓" />
|
44
|
+
<input name="authenticity_token" type="hidden" value="ofJbUSioJ9w+c6EkPy993jtBskYMK/97gp667ACWZDI=" />
|
45
|
+
</div>
|
46
|
+
<label for="test">Name
|
47
|
+
<input id="message_name" name="test[name]" type="text" />
|
48
|
+
</label>
|
49
|
+
</form>
|
50
|
+
|
51
|
+
## Complete
|
26
52
|
|
27
53
|
I have completed the builder for all of the Rails FormBuilder and FormOptionsHelper
|
28
54
|
methods. I have also included some Foundation specific methods, but I may remove these
|
29
55
|
before the final release.
|
30
56
|
|
31
|
-
|
57
|
+
### FormHelper
|
32
58
|
|
33
59
|
`check_box`
|
34
60
|
`color_field`
|
@@ -51,7 +77,7 @@ before the final release.
|
|
51
77
|
`url_field`
|
52
78
|
`week_field`
|
53
79
|
|
54
|
-
|
80
|
+
### FormOptionsHelper
|
55
81
|
|
56
82
|
`collection_check_boxes`
|
57
83
|
`collection_radio_buttons`
|
@@ -60,16 +86,29 @@ before the final release.
|
|
60
86
|
`select`
|
61
87
|
`time_zone_select`
|
62
88
|
|
63
|
-
|
89
|
+
### Foundation Specific
|
64
90
|
|
65
|
-
(May be removed at a later stage)
|
66
91
|
`check_box_group`
|
67
92
|
`radio_button_group`
|
68
93
|
|
69
|
-
|
94
|
+
(May be removed at a later stage)
|
95
|
+
|
96
|
+
## Development
|
97
|
+
|
98
|
+
This project is still under development, although the main functionality works. I am still deciding
|
99
|
+
whether to keep the `zurb_` prefix plus the ability to produce field tags that are not wrapped in a
|
100
|
+
label.
|
101
|
+
|
102
|
+
If you wish to contribute please contact me.
|
103
|
+
|
104
|
+
### Possibilities
|
70
105
|
|
71
106
|
I am still deciding whether it is worth writing builder methods to provide the following:
|
72
107
|
|
73
108
|
`Pre/Postfix labels (Foundation)`
|
74
109
|
`Switches (Foundation)`
|
75
|
-
`Abide Validation (Foundaation)`
|
110
|
+
`Abide Validation (Foundaation)`
|
111
|
+
|
112
|
+
## Issues
|
113
|
+
|
114
|
+
If you notice any problems with this Gem please file an [issue](https://github.com/ashleybye/foundation-formbuilder-rails/issues).
|
@@ -1,3 +1,4 @@
|
|
1
1
|
require 'foundation/form_builder/rails/engine'
|
2
2
|
require 'foundation/form_builder/rails/version'
|
3
|
-
require 'foundation/form_builder/rails/form_builder'
|
3
|
+
require 'foundation/form_builder/rails/form_builder'
|
4
|
+
require 'foundation/form_builder/rails/generators/install_generator'
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Foundation
|
2
|
+
module FormBuilder
|
3
|
+
# module Rails
|
4
|
+
module Generators
|
5
|
+
class InstallGenerator < ::Rails::Generators::Base
|
6
|
+
source_root File.join(File.dirname(__FILE__), '..', 'templates')
|
7
|
+
|
8
|
+
def add_initialiser
|
9
|
+
# Adds an initialiser for global use of the FormBuilder
|
10
|
+
settings_file = File.join(File.dirname(__FILE__),"..", "templates", "global_formbuilder.rb")
|
11
|
+
create_file "config/initializers/global_formbuilder.rb", File.read(settings_file)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
# end
|
16
|
+
end
|
17
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foundation-formbuilder-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ashley Bye
|
@@ -24,27 +24,121 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.6'
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
27
|
+
description: |-
|
28
|
+
# foundation-formbuilder-rails v0.2.3
|
29
|
+
|
30
|
+
This is a custom FormBuilder used to display form elements generated
|
31
|
+
by the `form_for` helpers in the correct style for
|
32
|
+
the [*Foundation 5 Framework*](http://foundation.zurb.com/).
|
33
|
+
|
34
|
+
|
35
|
+
See the Foundation [docs](http://foundation.zurb.com/docs/components/forms.html)
|
36
|
+
for form specifics.
|
37
|
+
|
38
|
+
## Getting Started
|
39
|
+
|
40
|
+
1. Add the `foundation-formbuilder-rails` Gem to your project's `Gemfile`:
|
41
|
+
|
42
|
+
gem 'foundation-formbuilder-rails'
|
43
|
+
|
44
|
+
2. Ensure you are using the FormBuilder in your form:
|
45
|
+
|
46
|
+
form_for @test, builder: Foundation::FormBuilder::Rails::FormBuilder do |f|
|
47
|
+
...
|
48
|
+
end
|
49
|
+
|
50
|
+
3. Alternatively, you can set the FormBuilder globally in an initializer,
|
51
|
+
`ActionView::Base.default_form_builder = Foundation::FormBuilder::Rails::FormBuilder`.
|
52
|
+
|
53
|
+
4. This can be achieved by running:
|
54
|
+
|
55
|
+
rails generate foundation:form_builder:install
|
56
|
+
|
57
|
+
5. Be sure to restart your application once this has been done. Then you only need:
|
58
|
+
|
59
|
+
form_for @test do |f|
|
60
|
+
|
61
|
+
6. For usage, see comments in the [source code](https://github.com/ashleybye/foundation-formbuilder-rails/blob/master/lib/foundation/form_builder/rails/form_builder.rb). I will get around to adding proper use examples to the README in the future. However, as a quick reference, the original Rails methods will
|
62
|
+
still return the standard content but prefix with `zurb_` and it will return the content formatted
|
63
|
+
for Foundation:
|
64
|
+
|
65
|
+
form_for @test do |f|
|
66
|
+
f.zurb_text_field :name
|
67
|
+
end
|
68
|
+
# => <form accept-charset="UTF-8" action="/test" class="new_test" id="new_test" method="post">
|
69
|
+
<div style="display:none">
|
70
|
+
<input name="utf8" type="hidden" value="✓" />
|
71
|
+
<input name="authenticity_token" type="hidden" value="ofJbUSioJ9w+c6EkPy993jtBskYMK/97gp667ACWZDI=" />
|
72
|
+
</div>
|
73
|
+
<label for="test">Name
|
74
|
+
<input id="message_name" name="test[name]" type="text" />
|
75
|
+
</label>
|
76
|
+
</form>
|
77
|
+
|
78
|
+
## Complete
|
79
|
+
|
80
|
+
I have completed the builder for all of the Rails FormBuilder and FormOptionsHelper
|
81
|
+
methods. I have also included some Foundation specific methods, but I may remove these
|
82
|
+
before the final release.
|
83
|
+
|
84
|
+
### FormHelper
|
85
|
+
|
86
|
+
`check_box`
|
87
|
+
`color_field`
|
88
|
+
`date_field`
|
89
|
+
`datetime_field`
|
90
|
+
`datetime_local_field`
|
91
|
+
`email_field`
|
92
|
+
`file_field`
|
93
|
+
`month_field`
|
94
|
+
`number_field`
|
95
|
+
`password_field`
|
96
|
+
`phone_field`
|
97
|
+
`radio_button`
|
98
|
+
`range_field`
|
99
|
+
`search_field`
|
100
|
+
`telephone_field`
|
101
|
+
`time_field`
|
102
|
+
`text_field`
|
103
|
+
`text_area`
|
104
|
+
`url_field`
|
105
|
+
`week_field`
|
106
|
+
|
107
|
+
### FormOptionsHelper
|
108
|
+
|
109
|
+
`collection_check_boxes`
|
110
|
+
`collection_radio_buttons`
|
111
|
+
`collection_select`
|
112
|
+
`grouped_collection_select`
|
113
|
+
`select`
|
114
|
+
`time_zone_select`
|
115
|
+
|
116
|
+
### Foundation Specific
|
117
|
+
|
118
|
+
`check_box_group`
|
119
|
+
`radio_button_group`
|
120
|
+
|
121
|
+
(May be removed at a later stage)
|
122
|
+
|
123
|
+
## Development
|
124
|
+
|
125
|
+
This project is still under development, although the main functionality works. I am still deciding
|
126
|
+
whether to keep the `zurb_` prefix plus the ability to produce field tags that are not wrapped in a
|
127
|
+
label.
|
128
|
+
|
129
|
+
If you wish to contribute please contact me.
|
130
|
+
|
131
|
+
### Possibilities
|
132
|
+
|
133
|
+
I am still deciding whether it is worth writing builder methods to provide the following:
|
134
|
+
|
135
|
+
`Pre/Postfix labels (Foundation)`
|
136
|
+
`Switches (Foundation)`
|
137
|
+
`Abide Validation (Foundaation)`
|
138
|
+
|
139
|
+
## Issues
|
140
|
+
|
141
|
+
If you notice any problems with this Gem please file an [issue](https://github.com/ashleybye/foundation-formbuilder-rails/issues).
|
48
142
|
email:
|
49
143
|
- ashley.bye85@gmail.com
|
50
144
|
executables: []
|
@@ -57,6 +151,8 @@ files:
|
|
57
151
|
- lib/foundation/form_builder/rails.rb
|
58
152
|
- lib/foundation/form_builder/rails/engine.rb
|
59
153
|
- lib/foundation/form_builder/rails/form_builder.rb
|
154
|
+
- lib/foundation/form_builder/rails/generators/install_generator.rb
|
155
|
+
- lib/foundation/form_builder/rails/templates/global_formbuilder.rb
|
60
156
|
- lib/foundation/form_builder/rails/version.rb
|
61
157
|
homepage: https://github.com/ashleybye/foundation-formbuilder-rails
|
62
158
|
licenses:
|
@@ -70,7 +166,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
70
166
|
requirements:
|
71
167
|
- - ">="
|
72
168
|
- !ruby/object:Gem::Version
|
73
|
-
version:
|
169
|
+
version: 2.1.2
|
74
170
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
171
|
requirements:
|
76
172
|
- - ">="
|