jqmobile_helpers 0.0.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.
- data/Gemfile +13 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +6 -0
- data/Rakefile +29 -0
- data/lib/jqmobile_helpers.rb +1 -0
- data/lib/jqmobile_helpers/action_view_extensions/form_helper.rb +54 -0
- data/lib/jqmobile_helpers/buttons_helper.rb +639 -0
- data/lib/jqmobile_helpers/form_builder.rb +301 -0
- data/lib/jqmobile_helpers/list_views_helper.rb +326 -0
- data/lib/jqmobile_helpers/railtie.rb +23 -0
- data/lib/jqmobile_helpers/toolbars_helper.rb +115 -0
- data/rdoc/JqmobileHelpers.html +185 -0
- data/rdoc/JqmobileHelpers/ActionViewExtensions.html +160 -0
- data/rdoc/JqmobileHelpers/ActionViewExtensions/FormHelper.html +231 -0
- data/rdoc/JqmobileHelpers/ButtonsHelper.html +1502 -0
- data/rdoc/JqmobileHelpers/FormBuilder.html +816 -0
- data/rdoc/JqmobileHelpers/ListViewsHelper.html +952 -0
- data/rdoc/JqmobileHelpers/Railtie.html +177 -0
- data/rdoc/JqmobileHelpers/ToolbarsHelper.html +416 -0
- data/rdoc/README_rdoc.html +109 -0
- data/rdoc/created.rid +9 -0
- data/rdoc/index.html +180 -0
- data/rdoc/js/darkfish.js +116 -0
- data/rdoc/js/jquery.js +32 -0
- data/rdoc/js/quicksearch.js +114 -0
- data/rdoc/js/thickbox-compressed.js +10 -0
- data/rdoc/lib/jqmobile_helpers/action_view_extensions/form_helper_rb.html +52 -0
- data/rdoc/lib/jqmobile_helpers/buttons_helper_rb.html +52 -0
- data/rdoc/lib/jqmobile_helpers/form_builder_rb.html +52 -0
- data/rdoc/lib/jqmobile_helpers/list_views_helper_rb.html +52 -0
- data/rdoc/lib/jqmobile_helpers/railtie_rb.html +62 -0
- data/rdoc/lib/jqmobile_helpers/toolbars_helper_rb.html +52 -0
- data/rdoc/lib/jqmobile_helpers_rb.html +54 -0
- data/rdoc/rdoc.css +706 -0
- data/test/buttons_helper_test.rb +112 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/controllers/buttons_controller.rb +9 -0
- data/test/dummy/app/controllers/forms_controller.rb +71 -0
- data/test/dummy/app/controllers/posts_controller.rb +83 -0
- data/test/dummy/app/controllers/toolbars_controller.rb +16 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/helpers/posts_helper.rb +2 -0
- data/test/dummy/app/helpers/toolbars_helper.rb +2 -0
- data/test/dummy/app/models/post.rb +2 -0
- data/test/dummy/app/models/toolbar.rb +2 -0
- data/test/dummy/app/views/buttons/index.html.erb +168 -0
- data/test/dummy/app/views/forms/_form.html.erb +20 -0
- data/test/dummy/app/views/forms/edit.html.erb +6 -0
- data/test/dummy/app/views/forms/index.html.erb +7 -0
- data/test/dummy/app/views/forms/new.html.erb +5 -0
- data/test/dummy/app/views/forms/show.html.erb +24 -0
- data/test/dummy/app/views/layouts/application.html.erb +49 -0
- data/test/dummy/app/views/posts/_form.html.erb +29 -0
- data/test/dummy/app/views/posts/edit.html.erb +6 -0
- data/test/dummy/app/views/posts/index.html.erb +128 -0
- data/test/dummy/app/views/posts/new.html.erb +5 -0
- data/test/dummy/app/views/posts/show.html.erb +24 -0
- data/test/dummy/app/views/toolbars/index.html.erb +25 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +45 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +22 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +26 -0
- data/test/dummy/config/environments/production.rb +49 -0
- data/test/dummy/config/environments/test.rb +35 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +10 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +69 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20110218095442_create_posts.rb +15 -0
- data/test/dummy/db/migrate/20110223031713_create_toolbars.rb +12 -0
- data/test/dummy/db/schema.rb +29 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +7446 -0
- data/test/dummy/log/production.log +0 -0
- data/test/dummy/log/server.log +0 -0
- data/test/dummy/log/test.log +2278 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +26 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/public/images/ajax-loader.png +0 -0
- data/test/dummy/public/images/form-check-off.png +0 -0
- data/test/dummy/public/images/form-check-on.png +0 -0
- data/test/dummy/public/images/form-radio-off.png +0 -0
- data/test/dummy/public/images/form-radio-on.png +0 -0
- data/test/dummy/public/images/icon-search-black.png +0 -0
- data/test/dummy/public/images/icons-18-black.png +0 -0
- data/test/dummy/public/images/icons-18-white.png +0 -0
- data/test/dummy/public/images/icons-36-black.png +0 -0
- data/test/dummy/public/images/icons-36-white.png +0 -0
- data/test/dummy/public/javascripts/application.js +2 -0
- data/test/dummy/public/javascripts/jquery-1.5.min.js +8176 -0
- data/test/dummy/public/javascripts/jquery-ui-1.8.9.custom.min.js +781 -0
- data/test/dummy/public/javascripts/jquery.mobile-1.0a3.min.js +121 -0
- data/test/dummy/public/javascripts/rails.js +175 -0
- data/test/dummy/public/stylesheets/images/ajax-loader.png +0 -0
- data/test/dummy/public/stylesheets/images/form-check-off.png +0 -0
- data/test/dummy/public/stylesheets/images/form-check-on.png +0 -0
- data/test/dummy/public/stylesheets/images/form-radio-off.png +0 -0
- data/test/dummy/public/stylesheets/images/form-radio-on.png +0 -0
- data/test/dummy/public/stylesheets/images/icon-search-black.png +0 -0
- data/test/dummy/public/stylesheets/images/icons-18-black.png +0 -0
- data/test/dummy/public/stylesheets/images/icons-18-white.png +0 -0
- data/test/dummy/public/stylesheets/images/icons-36-black.png +0 -0
- data/test/dummy/public/stylesheets/images/icons-36-white.png +0 -0
- data/test/dummy/public/stylesheets/jquery-ui-1.8.9.custom.css +573 -0
- data/test/dummy/public/stylesheets/jquery.mobile-1.0a3.min.css +16 -0
- data/test/dummy/public/stylesheets/scaffold.css +56 -0
- data/test/dummy/script/rails +6 -0
- data/test/dummy/tmp/pids/server.pid +1 -0
- data/test/form_helper_test.rb +13 -0
- data/test/integration/navigation_test.rb +7 -0
- data/test/list_views_helper_test.rb +65 -0
- data/test/support/integration_case.rb +5 -0
- data/test/support/misc_helpers.rb +18 -0
- data/test/support/mock_controller.rb +15 -0
- data/test/support/mock_response.rb +14 -0
- data/test/support/models.rb +135 -0
- data/test/test_helper.rb +92 -0
- data/test/toolbars_helper_test.rb +21 -0
- metadata +182 -0
|
@@ -0,0 +1,816 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
5
|
+
<head>
|
|
6
|
+
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
|
|
7
|
+
|
|
8
|
+
<title>Class: JqmobileHelpers::FormBuilder</title>
|
|
9
|
+
|
|
10
|
+
<link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
|
|
11
|
+
|
|
12
|
+
<script src="../js/jquery.js" type="text/javascript"
|
|
13
|
+
charset="utf-8"></script>
|
|
14
|
+
<script src="../js/thickbox-compressed.js" type="text/javascript"
|
|
15
|
+
charset="utf-8"></script>
|
|
16
|
+
<script src="../js/quicksearch.js" type="text/javascript"
|
|
17
|
+
charset="utf-8"></script>
|
|
18
|
+
<script src="../js/darkfish.js" type="text/javascript"
|
|
19
|
+
charset="utf-8"></script>
|
|
20
|
+
|
|
21
|
+
</head>
|
|
22
|
+
<body class="class">
|
|
23
|
+
|
|
24
|
+
<div id="metadata">
|
|
25
|
+
<div id="home-metadata">
|
|
26
|
+
<div id="home-section" class="section">
|
|
27
|
+
<h3 class="section-header">
|
|
28
|
+
<a href="../index.html">Home</a>
|
|
29
|
+
<a href="../index.html#classes">Classes</a>
|
|
30
|
+
<a href="../index.html#methods">Methods</a>
|
|
31
|
+
</h3>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<div id="file-metadata">
|
|
36
|
+
<div id="file-list-section" class="section">
|
|
37
|
+
<h3 class="section-header">In Files</h3>
|
|
38
|
+
<div class="section-body">
|
|
39
|
+
<ul>
|
|
40
|
+
|
|
41
|
+
<li><a href="../lib/jqmobile_helpers/form_builder_rb.html?TB_iframe=true&height=550&width=785"
|
|
42
|
+
class="thickbox" title="lib/jqmobile_helpers/form_builder.rb">lib/jqmobile_helpers/form_builder.rb</a></li>
|
|
43
|
+
|
|
44
|
+
</ul>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
<div id="class-metadata">
|
|
52
|
+
|
|
53
|
+
<!-- Parent Class -->
|
|
54
|
+
|
|
55
|
+
<div id="parent-class-section" class="section">
|
|
56
|
+
<h3 class="section-header">Parent</h3>
|
|
57
|
+
|
|
58
|
+
<p class="link">ActionView::Helpers::FormBuilder</p>
|
|
59
|
+
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
<!-- Namespace Contents -->
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
<!-- Method Quickref -->
|
|
67
|
+
|
|
68
|
+
<div id="method-list-section" class="section">
|
|
69
|
+
<h3 class="section-header">Methods</h3>
|
|
70
|
+
<ul class="link-list">
|
|
71
|
+
|
|
72
|
+
<li><a href="#method-i-check_box_field_template">#check_box_field_template</a></li>
|
|
73
|
+
|
|
74
|
+
<li><a href="#method-i-date_select">#date_select</a></li>
|
|
75
|
+
|
|
76
|
+
<li><a href="#method-i-default_field_template">#default_field_template</a></li>
|
|
77
|
+
|
|
78
|
+
<li><a href="#method-i-field_set">#field_set</a></li>
|
|
79
|
+
|
|
80
|
+
<li><a href="#method-i-habtm_check_boxes_field_template">#habtm_check_boxes_field_template</a></li>
|
|
81
|
+
|
|
82
|
+
<li><a href="#method-i-integer_select">#integer_select</a></li>
|
|
83
|
+
|
|
84
|
+
<li><a href="#method-i-label">#label</a></li>
|
|
85
|
+
|
|
86
|
+
<li><a href="#method-i-multipart_date_select">#multipart_date_select</a></li>
|
|
87
|
+
|
|
88
|
+
<li><a href="#method-i-radio_button_choice_template">#radio_button_choice_template</a></li>
|
|
89
|
+
|
|
90
|
+
<li><a href="#method-i-radio_buttons">#radio_buttons</a></li>
|
|
91
|
+
|
|
92
|
+
<li><a href="#method-i-radio_buttons_field_template">#radio_buttons_field_template</a></li>
|
|
93
|
+
|
|
94
|
+
<li><a href="#method-i-submit">#submit</a></li>
|
|
95
|
+
|
|
96
|
+
<li><a href="#method-i-submit_button_template">#submit_button_template</a></li>
|
|
97
|
+
|
|
98
|
+
<li><a href="#method-i-year_select">#year_select</a></li>
|
|
99
|
+
|
|
100
|
+
</ul>
|
|
101
|
+
</div>
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
<!-- Included Modules -->
|
|
105
|
+
|
|
106
|
+
</div>
|
|
107
|
+
|
|
108
|
+
<div id="project-metadata">
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
<div id="fileindex-section" class="section project-section">
|
|
112
|
+
<h3 class="section-header">Files</h3>
|
|
113
|
+
<ul>
|
|
114
|
+
|
|
115
|
+
<li class="file"><a href="../README_rdoc.html">README.rdoc</a></li>
|
|
116
|
+
|
|
117
|
+
</ul>
|
|
118
|
+
</div>
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
<div id="classindex-section" class="section project-section">
|
|
122
|
+
<h3 class="section-header">Class Index
|
|
123
|
+
<span class="search-toggle"><img src="../images/find.png"
|
|
124
|
+
height="16" width="16" alt="[+]"
|
|
125
|
+
title="show/hide quicksearch" /></span></h3>
|
|
126
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
|
127
|
+
<fieldset>
|
|
128
|
+
<legend>Quicksearch</legend>
|
|
129
|
+
<input type="text" name="quicksearch" value=""
|
|
130
|
+
class="quicksearch-field" />
|
|
131
|
+
</fieldset>
|
|
132
|
+
</form>
|
|
133
|
+
|
|
134
|
+
<ul class="link-list">
|
|
135
|
+
|
|
136
|
+
<li><a href="../JqmobileHelpers.html">JqmobileHelpers</a></li>
|
|
137
|
+
|
|
138
|
+
<li><a href="../JqmobileHelpers/ActionViewExtensions.html">JqmobileHelpers::ActionViewExtensions</a></li>
|
|
139
|
+
|
|
140
|
+
<li><a href="../JqmobileHelpers/ActionViewExtensions/FormHelper.html">JqmobileHelpers::ActionViewExtensions::FormHelper</a></li>
|
|
141
|
+
|
|
142
|
+
<li><a href="../JqmobileHelpers/ButtonsHelper.html">JqmobileHelpers::ButtonsHelper</a></li>
|
|
143
|
+
|
|
144
|
+
<li><a href="../JqmobileHelpers/FormBuilder.html">JqmobileHelpers::FormBuilder</a></li>
|
|
145
|
+
|
|
146
|
+
<li><a href="../JqmobileHelpers/ListViewsHelper.html">JqmobileHelpers::ListViewsHelper</a></li>
|
|
147
|
+
|
|
148
|
+
<li><a href="../JqmobileHelpers/Railtie.html">JqmobileHelpers::Railtie</a></li>
|
|
149
|
+
|
|
150
|
+
<li><a href="../JqmobileHelpers/ToolbarsHelper.html">JqmobileHelpers::ToolbarsHelper</a></li>
|
|
151
|
+
|
|
152
|
+
</ul>
|
|
153
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
|
154
|
+
</div>
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
159
|
+
|
|
160
|
+
<div id="documentation">
|
|
161
|
+
<h1 class="class">JqmobileHelpers::FormBuilder</h1>
|
|
162
|
+
|
|
163
|
+
<div id="description">
|
|
164
|
+
<h1><a href="../JqmobileHelpers.html">JqmobileHelpers</a> Form Helper</h1>
|
|
165
|
+
<p>
|
|
166
|
+
Credits to <a
|
|
167
|
+
href="https://github.com/alexreisner">github.com/alexreisner</a> for his
|
|
168
|
+
Informant formbuilder
|
|
169
|
+
</p>
|
|
170
|
+
<p>
|
|
171
|
+
Provides a set of helper methods for jquery-mobile form elements
|
|
172
|
+
</p>
|
|
173
|
+
<p>
|
|
174
|
+
Displays rails helpers fields within a div tag, label on one line, field
|
|
175
|
+
below it. Simplify your form code by encapsulating all aspects of a field
|
|
176
|
+
(label, description, etc) in a single method call.
|
|
177
|
+
</p>
|
|
178
|
+
<p>
|
|
179
|
+
All field methods accept an options hash like the standard Rails <a
|
|
180
|
+
href="FormBuilder.html">FormBuilder</a> methods
|
|
181
|
+
</p>
|
|
182
|
+
|
|
183
|
+
</div>
|
|
184
|
+
|
|
185
|
+
<!-- Constants -->
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
<!-- Attributes -->
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
<!-- Methods -->
|
|
192
|
+
|
|
193
|
+
<div id="public-instance-method-details" class="method-section section">
|
|
194
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
<div id="date-select-method" class="method-detail ">
|
|
198
|
+
<a name="method-i-date_select"></a>
|
|
199
|
+
|
|
200
|
+
<div class="method-heading">
|
|
201
|
+
|
|
202
|
+
<span class="method-name">date_select</span><span
|
|
203
|
+
class="method-args">(method, options = {})</span>
|
|
204
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
205
|
+
|
|
206
|
+
</div>
|
|
207
|
+
|
|
208
|
+
<div class="method-description">
|
|
209
|
+
|
|
210
|
+
<p>
|
|
211
|
+
Standard Rails date selector.
|
|
212
|
+
</p>
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
<div class="method-source-code"
|
|
217
|
+
id="date-select-source">
|
|
218
|
+
<pre>
|
|
219
|
+
<span class="ruby-comment cmt"># File lib/jqmobile_helpers/form_builder.rb, line 101</span>
|
|
220
|
+
101: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">date_select</span>(<span class="ruby-identifier">method</span>, <span class="ruby-identifier">options</span> = {})
|
|
221
|
+
102: <span class="ruby-identifier">options</span>[<span class="ruby-value">:include_blank</span>] <span class="ruby-operator">||=</span> <span class="ruby-keyword kw">false</span>
|
|
222
|
+
103: <span class="ruby-identifier">options</span>[<span class="ruby-value">:start_year</span>] <span class="ruby-operator">||=</span> <span class="ruby-value">1801</span>
|
|
223
|
+
104: <span class="ruby-identifier">options</span>[<span class="ruby-value">:end_year</span>] <span class="ruby-operator">||=</span> <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>.<span class="ruby-identifier">year</span>
|
|
224
|
+
105: <span class="ruby-identifier">options</span>[<span class="ruby-value">:label_for</span>] = <span class="ruby-node">"#{object_name}_#{method}_1i"</span>
|
|
225
|
+
106: <span class="ruby-identifier">build_shell</span>(<span class="ruby-identifier">method</span>, <span class="ruby-identifier">options</span>) { <span class="ruby-keyword kw">super</span> }
|
|
226
|
+
107: <span class="ruby-keyword kw">end</span></pre>
|
|
227
|
+
</div>
|
|
228
|
+
|
|
229
|
+
</div>
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
</div>
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
<div id="field-set-method" class="method-detail ">
|
|
238
|
+
<a name="method-i-field_set"></a>
|
|
239
|
+
|
|
240
|
+
<div class="method-heading">
|
|
241
|
+
|
|
242
|
+
<span class="method-name">field_set</span><span
|
|
243
|
+
class="method-args">(legend = nil, options = nil, &block)</span>
|
|
244
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
245
|
+
|
|
246
|
+
</div>
|
|
247
|
+
|
|
248
|
+
<div class="method-description">
|
|
249
|
+
|
|
250
|
+
<p>
|
|
251
|
+
Render a field set (HTML fieldset tag). Takes the legend (optional), an
|
|
252
|
+
options hash, and a block in which fields are rendered.
|
|
253
|
+
</p>
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
<div class="method-source-code"
|
|
258
|
+
id="field-set-source">
|
|
259
|
+
<pre>
|
|
260
|
+
<span class="ruby-comment cmt"># File lib/jqmobile_helpers/form_builder.rb, line 183</span>
|
|
261
|
+
183: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">field_set</span>(<span class="ruby-identifier">legend</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">options</span> = <span class="ruby-keyword kw">nil</span>, &<span class="ruby-identifier">block</span>)
|
|
262
|
+
184: <span class="ruby-ivar">@template</span>.<span class="ruby-identifier">content_tag</span>(<span class="ruby-value">:fieldset</span>, <span class="ruby-identifier">options</span>) <span class="ruby-keyword kw">do</span>
|
|
263
|
+
185: (<span class="ruby-identifier">legend</span>.<span class="ruby-identifier">blank?</span><span class="ruby-operator">?</span> <span class="ruby-value str">""</span> <span class="ruby-operator">:</span> <span class="ruby-ivar">@template</span>.<span class="ruby-identifier">content_tag</span>(<span class="ruby-value">:legend</span>, <span class="ruby-identifier">legend</span>)) <span class="ruby-operator">+</span>
|
|
264
|
+
186: <span class="ruby-ivar">@template</span>.<span class="ruby-identifier">capture</span>(&<span class="ruby-identifier">block</span>)
|
|
265
|
+
187: <span class="ruby-keyword kw">end</span>
|
|
266
|
+
188: <span class="ruby-keyword kw">end</span></pre>
|
|
267
|
+
</div>
|
|
268
|
+
|
|
269
|
+
</div>
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
</div>
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
<div id="integer-select-method" class="method-detail ">
|
|
278
|
+
<a name="method-i-integer_select"></a>
|
|
279
|
+
|
|
280
|
+
<div class="method-heading">
|
|
281
|
+
|
|
282
|
+
<span class="method-name">integer_select</span><span
|
|
283
|
+
class="method-args">(method, options = {})</span>
|
|
284
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
285
|
+
|
|
286
|
+
</div>
|
|
287
|
+
|
|
288
|
+
<div class="method-description">
|
|
289
|
+
|
|
290
|
+
<p>
|
|
291
|
+
Integer select field. Takes options <tt>:first</tt>, <tt>:last</tt>, and
|
|
292
|
+
<tt>:step</tt>.
|
|
293
|
+
</p>
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
<div class="method-source-code"
|
|
298
|
+
id="integer-select-source">
|
|
299
|
+
<pre>
|
|
300
|
+
<span class="ruby-comment cmt"># File lib/jqmobile_helpers/form_builder.rb, line 144</span>
|
|
301
|
+
144: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">integer_select</span>(<span class="ruby-identifier">method</span>, <span class="ruby-identifier">options</span> = {})
|
|
302
|
+
145: <span class="ruby-identifier">options</span>[<span class="ruby-value">:step</span>] <span class="ruby-operator">||=</span> <span class="ruby-value">1</span>
|
|
303
|
+
146: <span class="ruby-identifier">choices</span> = []; <span class="ruby-identifier">i</span> = <span class="ruby-value">0</span>
|
|
304
|
+
147: (<span class="ruby-identifier">options</span>[<span class="ruby-value">:first</span>]<span class="ruby-operator">..</span><span class="ruby-identifier">options</span>[<span class="ruby-value">:last</span>]).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">n</span><span class="ruby-operator">|</span>
|
|
305
|
+
148: <span class="ruby-identifier">choices</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">n</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:step</span>] <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
|
|
306
|
+
149: <span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
|
307
|
+
150: <span class="ruby-keyword kw">end</span>
|
|
308
|
+
151: <span class="ruby-identifier">select</span> <span class="ruby-identifier">method</span>, <span class="ruby-identifier">choices</span>, <span class="ruby-identifier">options</span>
|
|
309
|
+
152: <span class="ruby-keyword kw">end</span></pre>
|
|
310
|
+
</div>
|
|
311
|
+
|
|
312
|
+
</div>
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
</div>
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
<div id="label-method" class="method-detail ">
|
|
321
|
+
<a name="method-i-label"></a>
|
|
322
|
+
|
|
323
|
+
<div class="method-heading">
|
|
324
|
+
|
|
325
|
+
<span class="method-name">label</span><span
|
|
326
|
+
class="method-args">(method, text = nil, options = {})</span>
|
|
327
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
328
|
+
|
|
329
|
+
</div>
|
|
330
|
+
|
|
331
|
+
<div class="method-description">
|
|
332
|
+
|
|
333
|
+
<p>
|
|
334
|
+
Render a field label.
|
|
335
|
+
</p>
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
<div class="method-source-code"
|
|
340
|
+
id="label-source">
|
|
341
|
+
<pre>
|
|
342
|
+
<span class="ruby-comment cmt"># File lib/jqmobile_helpers/form_builder.rb, line 164</span>
|
|
343
|
+
164: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">label</span>(<span class="ruby-identifier">method</span>, <span class="ruby-identifier">text</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">options</span> = {})
|
|
344
|
+
165: <span class="ruby-identifier">colon</span> = <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:colon</span>].<span class="ruby-identifier">nil?</span>
|
|
345
|
+
166: <span class="ruby-identifier">options</span>[<span class="ruby-value">:for</span>] = <span class="ruby-identifier">options</span>[<span class="ruby-value">:label_for</span>]
|
|
346
|
+
167: <span class="ruby-identifier">required</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:required</span>]
|
|
347
|
+
168:
|
|
348
|
+
169: <span class="ruby-comment cmt"># remove special options</span>
|
|
349
|
+
170: <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span> <span class="ruby-value">:colon</span>
|
|
350
|
+
171: <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span> <span class="ruby-value">:label_for</span>
|
|
351
|
+
172: <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span> <span class="ruby-value">:required</span>
|
|
352
|
+
173:
|
|
353
|
+
174: <span class="ruby-identifier">text</span> = <span class="ruby-ivar">@template</span>.<span class="ruby-identifier">send</span>(<span class="ruby-value">:h</span>, <span class="ruby-identifier">text</span>.<span class="ruby-identifier">blank?</span><span class="ruby-operator">?</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">humanize</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">text</span>.<span class="ruby-identifier">to_s</span>)
|
|
354
|
+
175: <span class="ruby-identifier">text</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">':'</span>.<span class="ruby-identifier">html_safe</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">colon</span>
|
|
355
|
+
176: <span class="ruby-identifier">text</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@template</span>.<span class="ruby-identifier">content_tag</span>(<span class="ruby-value">:span</span>, <span class="ruby-value str">"*"</span>, <span class="ruby-value">:class</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"required"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">required</span>
|
|
356
|
+
177: <span class="ruby-keyword kw">super</span>
|
|
357
|
+
178: <span class="ruby-keyword kw">end</span></pre>
|
|
358
|
+
</div>
|
|
359
|
+
|
|
360
|
+
</div>
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
</div>
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
<div id="multipart-date-select-method" class="method-detail ">
|
|
369
|
+
<a name="method-i-multipart_date_select"></a>
|
|
370
|
+
|
|
371
|
+
<div class="method-heading">
|
|
372
|
+
|
|
373
|
+
<span class="method-name">multipart_date_select</span><span
|
|
374
|
+
class="method-args">(method, options = {})</span>
|
|
375
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
376
|
+
|
|
377
|
+
</div>
|
|
378
|
+
|
|
379
|
+
<div class="method-description">
|
|
380
|
+
|
|
381
|
+
<p>
|
|
382
|
+
This differs from the Rails-default <a
|
|
383
|
+
href="FormBuilder.html#method-i-date_select">date_select</a> in that it
|
|
384
|
+
submits three distinct fields for storage in three separate attributes.
|
|
385
|
+
This allows for partial dates (eg, “1984” or “October
|
|
386
|
+
1984”). See <a
|
|
387
|
+
href="http://github.com/alexreisner/flex_date">FlexDate</a> for storing and
|
|
388
|
+
manipulating partial dates.
|
|
389
|
+
</p>
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
<div class="method-source-code"
|
|
394
|
+
id="multipart-date-select-source">
|
|
395
|
+
<pre>
|
|
396
|
+
<span class="ruby-comment cmt"># File lib/jqmobile_helpers/form_builder.rb, line 116</span>
|
|
397
|
+
116: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">multipart_date_select</span>(<span class="ruby-identifier">method</span>, <span class="ruby-identifier">options</span> = {})
|
|
398
|
+
117: <span class="ruby-identifier">options</span>[<span class="ruby-value">:include_blank</span>] <span class="ruby-operator">||=</span> <span class="ruby-keyword kw">false</span>
|
|
399
|
+
118: <span class="ruby-identifier">options</span>[<span class="ruby-value">:start_year</span>] <span class="ruby-operator">||=</span> <span class="ruby-value">1801</span>
|
|
400
|
+
119: <span class="ruby-identifier">options</span>[<span class="ruby-value">:end_year</span>] <span class="ruby-operator">||=</span> <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>.<span class="ruby-identifier">year</span>
|
|
401
|
+
120: <span class="ruby-identifier">options</span>[<span class="ruby-value">:prefix</span>] = <span class="ruby-identifier">object_name</span> <span class="ruby-comment cmt"># for date helpers</span>
|
|
402
|
+
121: <span class="ruby-identifier">options</span>[<span class="ruby-value">:label_for</span>] = <span class="ruby-node">"#{object_name}_#{method}_y"</span>
|
|
403
|
+
122: <span class="ruby-identifier">build_shell</span>(<span class="ruby-identifier">method</span>, <span class="ruby-identifier">options</span>) <span class="ruby-keyword kw">do</span>
|
|
404
|
+
123: [[<span class="ruby-value str">'y'</span>, <span class="ruby-value str">'year'</span>], [<span class="ruby-value str">'m'</span>, <span class="ruby-value str">'month'</span>], [<span class="ruby-value str">'d'</span>, <span class="ruby-value str">'day'</span>]].<span class="ruby-identifier">map</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span>
|
|
405
|
+
124: <span class="ruby-identifier">i</span>,<span class="ruby-identifier">j</span> = <span class="ruby-identifier">p</span>
|
|
406
|
+
125: <span class="ruby-identifier">value</span> = <span class="ruby-ivar">@object</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">method</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'_'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">i</span>)
|
|
407
|
+
126: <span class="ruby-identifier">options</span>[<span class="ruby-value">:field_name</span>] = <span class="ruby-identifier">method</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'_'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">i</span>
|
|
408
|
+
127: <span class="ruby-identifier">eval</span>(<span class="ruby-node">"@template.select_#{j}(#{value.inspect}, options)"</span>)
|
|
409
|
+
128: }.<span class="ruby-identifier">join</span>(<span class="ruby-value str">' '</span>)
|
|
410
|
+
129: <span class="ruby-keyword kw">end</span>
|
|
411
|
+
130: <span class="ruby-keyword kw">end</span></pre>
|
|
412
|
+
</div>
|
|
413
|
+
|
|
414
|
+
</div>
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
</div>
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
<div id="radio-buttons-method" class="method-detail ">
|
|
423
|
+
<a name="method-i-radio_buttons"></a>
|
|
424
|
+
|
|
425
|
+
<div class="method-heading">
|
|
426
|
+
|
|
427
|
+
<span class="method-name">radio_buttons</span><span
|
|
428
|
+
class="method-args">(method, choices, options = {})</span>
|
|
429
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
430
|
+
|
|
431
|
+
</div>
|
|
432
|
+
|
|
433
|
+
<div class="method-description">
|
|
434
|
+
|
|
435
|
+
<p>
|
|
436
|
+
Render a set of radio buttons. Takes a method name, an array of choices
|
|
437
|
+
(just like a <tt>select</tt> field), and an options hash.
|
|
438
|
+
</p>
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
<div class="method-source-code"
|
|
443
|
+
id="radio-buttons-source">
|
|
444
|
+
<pre>
|
|
445
|
+
<span class="ruby-comment cmt"># File lib/jqmobile_helpers/form_builder.rb, line 45</span>
|
|
446
|
+
45: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">radio_buttons</span>(<span class="ruby-identifier">method</span>, <span class="ruby-identifier">choices</span>, <span class="ruby-identifier">options</span> = {})
|
|
447
|
+
46: <span class="ruby-identifier">choices</span>.<span class="ruby-identifier">map!</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">i</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">:</span> [<span class="ruby-identifier">i</span>] }
|
|
448
|
+
47: <span class="ruby-identifier">build_shell</span>(<span class="ruby-identifier">method</span>, <span class="ruby-identifier">options</span>, <span class="ruby-value str">"radio_buttons_field"</span>) <span class="ruby-keyword kw">do</span>
|
|
449
|
+
48: <span class="ruby-identifier">choices</span>.<span class="ruby-identifier">map</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-identifier">radio_button</span> <span class="ruby-identifier">method</span>, <span class="ruby-identifier">c</span>[<span class="ruby-value">1</span>], <span class="ruby-value">:label</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">c</span>[<span class="ruby-value">0</span>],
|
|
450
|
+
49: <span class="ruby-value">:label_for</span> =<span class="ruby-operator">></span> [<span class="ruby-identifier">object_name</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">c</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">downcase</span>].<span class="ruby-identifier">join</span>(<span class="ruby-value str">'_'</span>) }
|
|
451
|
+
50: <span class="ruby-keyword kw">end</span>
|
|
452
|
+
51: <span class="ruby-keyword kw">end</span></pre>
|
|
453
|
+
</div>
|
|
454
|
+
|
|
455
|
+
</div>
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
</div>
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
<div id="submit-method" class="method-detail ">
|
|
464
|
+
<a name="method-i-submit"></a>
|
|
465
|
+
|
|
466
|
+
<div class="method-heading">
|
|
467
|
+
|
|
468
|
+
<span class="method-name">submit</span><span
|
|
469
|
+
class="method-args">(value = nil, options = {})</span>
|
|
470
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
471
|
+
|
|
472
|
+
</div>
|
|
473
|
+
|
|
474
|
+
<div class="method-description">
|
|
475
|
+
|
|
476
|
+
<p>
|
|
477
|
+
Submit button with smart default text (if <tt>value</tt> is nil uses
|
|
478
|
+
“Create” for new record or “Update” for old
|
|
479
|
+
record).
|
|
480
|
+
</p>
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
<div class="method-source-code"
|
|
485
|
+
id="submit-source">
|
|
486
|
+
<pre>
|
|
487
|
+
<span class="ruby-comment cmt"># File lib/jqmobile_helpers/form_builder.rb, line 157</span>
|
|
488
|
+
157: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">submit</span>(<span class="ruby-identifier">value</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">options</span> = {})
|
|
489
|
+
158: <span class="ruby-identifier">value</span> = (<span class="ruby-ivar">@object</span>.<span class="ruby-identifier">new_record?</span><span class="ruby-operator">?</span> <span class="ruby-value str">"Create"</span> <span class="ruby-operator">:</span> <span class="ruby-value str">"Update"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">nil?</span>
|
|
490
|
+
159: <span class="ruby-identifier">build_shell</span>(<span class="ruby-identifier">value</span>, <span class="ruby-identifier">options</span>, <span class="ruby-value str">'submit_button'</span>) { <span class="ruby-keyword kw">super</span> }
|
|
491
|
+
160: <span class="ruby-keyword kw">end</span></pre>
|
|
492
|
+
</div>
|
|
493
|
+
|
|
494
|
+
</div>
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
|
|
498
|
+
|
|
499
|
+
</div>
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
<div id="year-select-method" class="method-detail ">
|
|
503
|
+
<a name="method-i-year_select"></a>
|
|
504
|
+
|
|
505
|
+
<div class="method-heading">
|
|
506
|
+
|
|
507
|
+
<span class="method-name">year_select</span><span
|
|
508
|
+
class="method-args">(method, options = {})</span>
|
|
509
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
510
|
+
|
|
511
|
+
</div>
|
|
512
|
+
|
|
513
|
+
<div class="method-description">
|
|
514
|
+
|
|
515
|
+
<p>
|
|
516
|
+
Year select field. Takes options <tt>:start_year</tt> and
|
|
517
|
+
<tt>:end_year</tt>, and <tt>:step</tt>.
|
|
518
|
+
</p>
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
<div class="method-source-code"
|
|
523
|
+
id="year-select-source">
|
|
524
|
+
<pre>
|
|
525
|
+
<span class="ruby-comment cmt"># File lib/jqmobile_helpers/form_builder.rb, line 135</span>
|
|
526
|
+
135: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">year_select</span>(<span class="ruby-identifier">method</span>, <span class="ruby-identifier">options</span> = {})
|
|
527
|
+
136: <span class="ruby-identifier">options</span>[<span class="ruby-value">:first</span>] = <span class="ruby-identifier">options</span>[<span class="ruby-value">:start_year</span>] <span class="ruby-operator">||</span> <span class="ruby-value">1801</span>
|
|
528
|
+
137: <span class="ruby-identifier">options</span>[<span class="ruby-value">:last</span>] = <span class="ruby-identifier">options</span>[<span class="ruby-value">:end_year</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">Date</span>.<span class="ruby-identifier">today</span>.<span class="ruby-identifier">year</span>
|
|
529
|
+
138: <span class="ruby-identifier">integer_select</span>(<span class="ruby-identifier">method</span>, <span class="ruby-identifier">options</span>)
|
|
530
|
+
139: <span class="ruby-keyword kw">end</span></pre>
|
|
531
|
+
</div>
|
|
532
|
+
|
|
533
|
+
</div>
|
|
534
|
+
|
|
535
|
+
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
</div>
|
|
539
|
+
|
|
540
|
+
|
|
541
|
+
</div>
|
|
542
|
+
|
|
543
|
+
<div id="private-instance-method-details" class="method-section section">
|
|
544
|
+
<h3 class="section-header">Private Instance Methods</h3>
|
|
545
|
+
|
|
546
|
+
|
|
547
|
+
<div id="check-box-field-template-method" class="method-detail ">
|
|
548
|
+
<a name="method-i-check_box_field_template"></a>
|
|
549
|
+
|
|
550
|
+
<div class="method-heading">
|
|
551
|
+
|
|
552
|
+
<span class="method-name">check_box_field_template</span><span
|
|
553
|
+
class="method-args">(l = {})</span>
|
|
554
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
555
|
+
|
|
556
|
+
</div>
|
|
557
|
+
|
|
558
|
+
<div class="method-description">
|
|
559
|
+
|
|
560
|
+
<p>
|
|
561
|
+
Render check box field template.
|
|
562
|
+
</p>
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
|
|
566
|
+
<div class="method-source-code"
|
|
567
|
+
id="check-box-field-template-source">
|
|
568
|
+
<pre>
|
|
569
|
+
<span class="ruby-comment cmt"># File lib/jqmobile_helpers/form_builder.rb, line 255</span>
|
|
570
|
+
255: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">check_box_field_template</span>(<span class="ruby-identifier">l</span> = {})
|
|
571
|
+
256: <span class="ruby-value str"> <div data-role="fieldcontain" id="#{l[:div_id]}" class="field"> #{l[:element]} #{l[:label]} #{l[:decoration]}<br /> #{"<p class=\"field_description\">#{l[:description]}</p>" unless l[:description].blank?} </div></span>
|
|
572
|
+
257: <span class="ruby-keyword kw">end</span></pre>
|
|
573
|
+
</div>
|
|
574
|
+
|
|
575
|
+
</div>
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
|
|
579
|
+
|
|
580
|
+
</div>
|
|
581
|
+
|
|
582
|
+
|
|
583
|
+
<div id="default-field-template-method" class="method-detail ">
|
|
584
|
+
<a name="method-i-default_field_template"></a>
|
|
585
|
+
|
|
586
|
+
<div class="method-heading">
|
|
587
|
+
|
|
588
|
+
<span class="method-name">default_field_template</span><span
|
|
589
|
+
class="method-args">(l = {})</span>
|
|
590
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
591
|
+
|
|
592
|
+
</div>
|
|
593
|
+
|
|
594
|
+
<div class="method-description">
|
|
595
|
+
|
|
596
|
+
<p>
|
|
597
|
+
Render default field template for all the following field methods:
|
|
598
|
+
“fields_for“, “label”, “text_field“,
|
|
599
|
+
“password_field“, “hidden_field“,
|
|
600
|
+
“file_field“, “text_area“,
|
|
601
|
+
“search_field“, “telephone_field“,
|
|
602
|
+
“phone_field“, “url_field“,
|
|
603
|
+
“email_field“, “number_field“,
|
|
604
|
+
“range_field“
|
|
605
|
+
</p>
|
|
606
|
+
<h4>Examples</h4>
|
|
607
|
+
<pre>
|
|
608
|
+
<%= jq_form_for(@post) do |f| %>
|
|
609
|
+
<%= f.text_field :name %>
|
|
610
|
+
<% end %>
|
|
611
|
+
|
|
612
|
+
# =>(Ommiting form_for results)
|
|
613
|
+
<div data-role="fieldcontain" id="post_name_field" class="field">
|
|
614
|
+
label for="post_name">Name</label><br />
|
|
615
|
+
<input id="post_name" name="post[name]" size="30" type="text" />
|
|
616
|
+
</div>
|
|
617
|
+
|
|
618
|
+
</pre>
|
|
619
|
+
<p>
|
|
620
|
+
You can pass a few other options for your input fields.
|
|
621
|
+
</p>
|
|
622
|
+
<h4>Examples</h4>
|
|
623
|
+
<pre>
|
|
624
|
+
<%= f.text_field :name, :description => "Fill in your name", :required => true,
|
|
625
|
+
:label => "Your Name", :decoration => 'basically a field' %>
|
|
626
|
+
# => <div data-role="fieldcontain" id="post_name_field" class="field">
|
|
627
|
+
label for="post_name">Your Name<span class="required">*</span></label><br />
|
|
628
|
+
<input id="post_name" name="post[name]" size="30" type="text" />basically a field
|
|
629
|
+
</div></pre>
|
|
630
|
+
|
|
631
|
+
|
|
632
|
+
|
|
633
|
+
<div class="method-source-code"
|
|
634
|
+
id="default-field-template-source">
|
|
635
|
+
<pre>
|
|
636
|
+
<span class="ruby-comment cmt"># File lib/jqmobile_helpers/form_builder.rb, line 243</span>
|
|
637
|
+
243: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">default_field_template</span>(<span class="ruby-identifier">l</span> = {})
|
|
638
|
+
244: <span class="ruby-value str"> <div data-role="fieldcontain" id="#{l[:div_id]}" class="field"> #{l[:label]}<br /> #{l[:element]}#{l[:decoration]} #{"<p class=\"field_description\">#{l[:description]}</p>" unless l[:description].blank?} </div></span>
|
|
639
|
+
245: <span class="ruby-keyword kw">end</span></pre>
|
|
640
|
+
</div>
|
|
641
|
+
|
|
642
|
+
</div>
|
|
643
|
+
|
|
644
|
+
|
|
645
|
+
|
|
646
|
+
|
|
647
|
+
</div>
|
|
648
|
+
|
|
649
|
+
|
|
650
|
+
<div id="habtm-check-boxes-field-template-method" class="method-detail ">
|
|
651
|
+
<a name="method-i-habtm_check_boxes_field_template"></a>
|
|
652
|
+
|
|
653
|
+
<div class="method-heading">
|
|
654
|
+
|
|
655
|
+
<span class="method-name">habtm_check_boxes_field_template</span><span
|
|
656
|
+
class="method-args">(l = {})</span>
|
|
657
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
658
|
+
|
|
659
|
+
</div>
|
|
660
|
+
|
|
661
|
+
<div class="method-description">
|
|
662
|
+
|
|
663
|
+
<p>
|
|
664
|
+
Render a group of HABTM check boxes.
|
|
665
|
+
</p>
|
|
666
|
+
|
|
667
|
+
|
|
668
|
+
|
|
669
|
+
<div class="method-source-code"
|
|
670
|
+
id="habtm-check-boxes-field-template-source">
|
|
671
|
+
<pre>
|
|
672
|
+
<span class="ruby-comment cmt"># File lib/jqmobile_helpers/form_builder.rb, line 282</span>
|
|
673
|
+
282: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">habtm_check_boxes_field_template</span>(<span class="ruby-identifier">l</span> = {})
|
|
674
|
+
283: <span class="ruby-value str"> <div data-role="fieldcontain" id="#{l[:div_id]}" class="field"> #{l[:label]}<br /> <div class="habtm_check_boxes">#{l[:element]}</div>#{l[:decoration]} #{"<p class=\"field_description\">#{l[:description]}</p>" unless l[:description].blank?} </div></span>
|
|
675
|
+
284: <span class="ruby-keyword kw">end</span></pre>
|
|
676
|
+
</div>
|
|
677
|
+
|
|
678
|
+
</div>
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
|
|
683
|
+
</div>
|
|
684
|
+
|
|
685
|
+
|
|
686
|
+
<div id="radio-button-choice-template-method" class="method-detail ">
|
|
687
|
+
<a name="method-i-radio_button_choice_template"></a>
|
|
688
|
+
|
|
689
|
+
<div class="method-heading">
|
|
690
|
+
|
|
691
|
+
<span class="method-name">radio_button_choice_template</span><span
|
|
692
|
+
class="method-args">(l = {})</span>
|
|
693
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
694
|
+
|
|
695
|
+
</div>
|
|
696
|
+
|
|
697
|
+
<div class="method-description">
|
|
698
|
+
|
|
699
|
+
<p>
|
|
700
|
+
Render single radio button. Note that this is the only field template
|
|
701
|
+
without an enclosing <tt><div class="field"></tt> because
|
|
702
|
+
it is intended for use only within the radio_buttons_template (plural).
|
|
703
|
+
</p>
|
|
704
|
+
|
|
705
|
+
|
|
706
|
+
|
|
707
|
+
<div class="method-source-code"
|
|
708
|
+
id="radio-button-choice-template-source">
|
|
709
|
+
<pre>
|
|
710
|
+
<span class="ruby-comment cmt"># File lib/jqmobile_helpers/form_builder.rb, line 268</span>
|
|
711
|
+
268: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">radio_button_choice_template</span>(<span class="ruby-identifier">l</span> = {})
|
|
712
|
+
269: <span class="ruby-value str"> #{l[:element]} #{l[:label]}</span>
|
|
713
|
+
270: <span class="ruby-keyword kw">end</span></pre>
|
|
714
|
+
</div>
|
|
715
|
+
|
|
716
|
+
</div>
|
|
717
|
+
|
|
718
|
+
|
|
719
|
+
|
|
720
|
+
|
|
721
|
+
</div>
|
|
722
|
+
|
|
723
|
+
|
|
724
|
+
<div id="radio-buttons-field-template-method" class="method-detail ">
|
|
725
|
+
<a name="method-i-radio_buttons_field_template"></a>
|
|
726
|
+
|
|
727
|
+
<div class="method-heading">
|
|
728
|
+
|
|
729
|
+
<span class="method-name">radio_buttons_field_template</span><span
|
|
730
|
+
class="method-args">(l = {})</span>
|
|
731
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
732
|
+
|
|
733
|
+
</div>
|
|
734
|
+
|
|
735
|
+
<div class="method-description">
|
|
736
|
+
|
|
737
|
+
<p>
|
|
738
|
+
Render a group of radio buttons.
|
|
739
|
+
</p>
|
|
740
|
+
|
|
741
|
+
|
|
742
|
+
|
|
743
|
+
<div class="method-source-code"
|
|
744
|
+
id="radio-buttons-field-template-source">
|
|
745
|
+
<pre>
|
|
746
|
+
<span class="ruby-comment cmt"># File lib/jqmobile_helpers/form_builder.rb, line 276</span>
|
|
747
|
+
276: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">radio_buttons_field_template</span>(<span class="ruby-identifier">l</span> = {})
|
|
748
|
+
277: <span class="ruby-identifier">default_field_template</span>(<span class="ruby-identifier">l</span>)
|
|
749
|
+
278: <span class="ruby-keyword kw">end</span></pre>
|
|
750
|
+
</div>
|
|
751
|
+
|
|
752
|
+
</div>
|
|
753
|
+
|
|
754
|
+
|
|
755
|
+
|
|
756
|
+
|
|
757
|
+
</div>
|
|
758
|
+
|
|
759
|
+
|
|
760
|
+
<div id="submit-button-template-method" class="method-detail ">
|
|
761
|
+
<a name="method-i-submit_button_template"></a>
|
|
762
|
+
|
|
763
|
+
<div class="method-heading">
|
|
764
|
+
|
|
765
|
+
<span class="method-name">submit_button_template</span><span
|
|
766
|
+
class="method-args">(l = {})</span>
|
|
767
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
768
|
+
|
|
769
|
+
</div>
|
|
770
|
+
|
|
771
|
+
<div class="method-description">
|
|
772
|
+
|
|
773
|
+
<p>
|
|
774
|
+
Render submit button template.
|
|
775
|
+
</p>
|
|
776
|
+
|
|
777
|
+
|
|
778
|
+
|
|
779
|
+
<div class="method-source-code"
|
|
780
|
+
id="submit-button-template-source">
|
|
781
|
+
<pre>
|
|
782
|
+
<span class="ruby-comment cmt"># File lib/jqmobile_helpers/form_builder.rb, line 294</span>
|
|
783
|
+
294: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">submit_button_template</span>(<span class="ruby-identifier">l</span> = {})
|
|
784
|
+
295: <span class="ruby-value str"> <div class="button">#{l[:element]}</div></span>
|
|
785
|
+
296: <span class="ruby-keyword kw">end</span></pre>
|
|
786
|
+
</div>
|
|
787
|
+
|
|
788
|
+
</div>
|
|
789
|
+
|
|
790
|
+
|
|
791
|
+
|
|
792
|
+
|
|
793
|
+
</div>
|
|
794
|
+
|
|
795
|
+
|
|
796
|
+
</div>
|
|
797
|
+
|
|
798
|
+
|
|
799
|
+
</div>
|
|
800
|
+
|
|
801
|
+
|
|
802
|
+
<div id="rdoc-debugging-section-dump" class="debugging-section">
|
|
803
|
+
|
|
804
|
+
<p>Disabled; run with --debug to generate this.</p>
|
|
805
|
+
|
|
806
|
+
</div>
|
|
807
|
+
|
|
808
|
+
<div id="validator-badges">
|
|
809
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
810
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
|
811
|
+
Rdoc Generator</a> 1.1.6</small>.</p>
|
|
812
|
+
</div>
|
|
813
|
+
|
|
814
|
+
</body>
|
|
815
|
+
</html>
|
|
816
|
+
|