compony 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +25 -0
- data/Gemfile.lock +3 -3
- data/README.md +1397 -33
- data/Rakefile +6 -2
- data/TODO.md +1 -0
- data/VERSION +1 -0
- data/app/controllers/compony_controller.rb +3 -1
- data/compony.gemspec +7 -7
- data/config/locales/fr.yml +33 -0
- data/doc/ComponentGenerator.html +231 -0
- data/doc/Components.html +105 -0
- data/doc/ComponentsGenerator.html +203 -0
- data/doc/Compony/Component.html +2098 -0
- data/doc/Compony/ComponentMixins/Default/Labelling.html +406 -0
- data/doc/Compony/ComponentMixins/Default/Standalone/ResourcefulVerbDsl.html +539 -0
- data/doc/Compony/ComponentMixins/Default/Standalone/StandaloneDsl.html +588 -0
- data/doc/Compony/ComponentMixins/Default/Standalone/VerbDsl.html +577 -0
- data/doc/Compony/ComponentMixins/Default/Standalone.html +692 -0
- data/doc/Compony/ComponentMixins/Default.html +126 -0
- data/doc/Compony/ComponentMixins/Resourceful.html +1193 -0
- data/doc/Compony/ComponentMixins.html +126 -0
- data/doc/Compony/Components/Button.html +293 -0
- data/doc/Compony/Components/Destroy.html +384 -0
- data/doc/Compony/Components/Edit.html +462 -0
- data/doc/Compony/Components/Form.html +1112 -0
- data/doc/Compony/Components/New.html +462 -0
- data/doc/Compony/Components/WithForm.html +528 -0
- data/doc/Compony/Components.html +126 -0
- data/doc/Compony/ControllerMixin.html +136 -0
- data/doc/Compony/Engine.html +133 -0
- data/doc/Compony/MethodAccessibleHash.html +453 -0
- data/doc/Compony/ModelFields/Anchormodel.html +383 -0
- data/doc/Compony/ModelFields/Association.html +613 -0
- data/doc/Compony/ModelFields/Attachment.html +305 -0
- data/doc/Compony/ModelFields/Base.html +1066 -0
- data/doc/Compony/ModelFields/Boolean.html +232 -0
- data/doc/Compony/ModelFields/Color.html +299 -0
- data/doc/Compony/ModelFields/Currency.html +232 -0
- data/doc/Compony/ModelFields/Date.html +232 -0
- data/doc/Compony/ModelFields/Datetime.html +232 -0
- data/doc/Compony/ModelFields/Decimal.html +154 -0
- data/doc/Compony/ModelFields/Email.html +240 -0
- data/doc/Compony/ModelFields/Float.html +154 -0
- data/doc/Compony/ModelFields/Integer.html +154 -0
- data/doc/Compony/ModelFields/Percentage.html +232 -0
- data/doc/Compony/ModelFields/Phone.html +301 -0
- data/doc/Compony/ModelFields/RichText.html +232 -0
- data/doc/Compony/ModelFields/String.html +154 -0
- data/doc/Compony/ModelFields/Text.html +154 -0
- data/doc/Compony/ModelFields/Time.html +154 -0
- data/doc/Compony/ModelFields/Url.html +240 -0
- data/doc/Compony/ModelFields.html +126 -0
- data/doc/Compony/ModelMixin.html +524 -0
- data/doc/Compony/RequestContext.html +791 -0
- data/doc/Compony/Version.html +139 -0
- data/doc/Compony/ViewHelpers.html +443 -0
- data/doc/Compony.html +2156 -0
- data/doc/ComponyController.html +124 -0
- data/doc/_index.html +569 -0
- data/doc/class_list.html +51 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +497 -0
- data/doc/file.README.html +1565 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +17 -0
- data/doc/imgs/intro-example-destroy.png +0 -0
- data/doc/imgs/intro-example-edit.png +0 -0
- data/doc/imgs/intro-example-index.png +0 -0
- data/doc/imgs/intro-example-new.png +0 -0
- data/doc/imgs/intro-example-show.png +0 -0
- data/doc/index.html +1565 -0
- data/doc/js/app.js +314 -0
- data/doc/js/full_list.js +216 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +1435 -0
- data/doc/resourceful_lifecycle.png +0 -0
- data/doc/top-level-namespace.html +112 -0
- data/lib/compony/component.rb +2 -1
- data/lib/compony/component_mixins/default/standalone/resourceful_verb_dsl.rb +1 -1
- data/lib/compony/component_mixins/default/standalone/standalone_dsl.rb +14 -3
- data/lib/compony/component_mixins/default/standalone/verb_dsl.rb +14 -5
- data/lib/compony/component_mixins/default/standalone.rb +10 -3
- data/lib/compony/components/form.rb +6 -1
- data/lib/compony/components/with_form.rb +14 -1
- data/lib/compony/model_fields/anchormodel.rb +0 -22
- data/lib/compony/model_mixin.rb +12 -2
- data/lib/compony/version.rb +1 -7
- data/logo.svg +133 -0
- metadata +83 -6
@@ -0,0 +1,1112 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Class: Compony::Components::Form
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.34
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" />
|
16
|
+
|
17
|
+
<script type="text/javascript">
|
18
|
+
pathId = "Compony::Components::Form";
|
19
|
+
relpath = '../../';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="../../class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="../../_index.html">Index (F)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../../Compony.html" title="Compony (module)">Compony</a></span></span> » <span class='title'><span class='object_link'><a href="../Components.html" title="Compony::Components (module)">Components</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">Form</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="../../class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Class: Compony::Components::Form
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
72
|
+
<span class="inheritName"><span class='object_link'><a href="../Component.html" title="Compony::Component (class)">Compony::Component</a></span></span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li>Object</li>
|
76
|
+
|
77
|
+
<li class="next"><span class='object_link'><a href="../Component.html" title="Compony::Component (class)">Compony::Component</a></span></li>
|
78
|
+
|
79
|
+
<li class="next">Compony::Components::Form</li>
|
80
|
+
|
81
|
+
</ul>
|
82
|
+
<a href="#" class="inheritanceTree">show all</a>
|
83
|
+
|
84
|
+
</dd>
|
85
|
+
</dl>
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
<dl>
|
98
|
+
<dt>Defined in:</dt>
|
99
|
+
<dd>lib/compony/components/form.rb</dd>
|
100
|
+
</dl>
|
101
|
+
|
102
|
+
</div>
|
103
|
+
|
104
|
+
<h2>Overview</h2><div class="docstring">
|
105
|
+
<div class="discussion">
|
106
|
+
|
107
|
+
<p>This component is used for the _form partial in the Rails paradigm.</p>
|
108
|
+
|
109
|
+
|
110
|
+
</div>
|
111
|
+
</div>
|
112
|
+
<div class="tags">
|
113
|
+
|
114
|
+
|
115
|
+
</div>
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
<h2>Instance Attribute Summary</h2>
|
122
|
+
|
123
|
+
<h3 class="inherited">Attributes inherited from <span class='object_link'><a href="../Component.html" title="Compony::Component (class)">Compony::Component</a></span></h3>
|
124
|
+
<p class="inherited"><span class='object_link'><a href="../Component.html#comp_opts-instance_method" title="Compony::Component#comp_opts (method)">#comp_opts</a></span>, <span class='object_link'><a href="../Component.html#parent_comp-instance_method" title="Compony::Component#parent_comp (method)">#parent_comp</a></span></p>
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
<h2>
|
129
|
+
Instance Method Summary
|
130
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
131
|
+
</h2>
|
132
|
+
|
133
|
+
<ul class="summary">
|
134
|
+
|
135
|
+
<li class="public ">
|
136
|
+
<span class="summary_signature">
|
137
|
+
|
138
|
+
<a href="#collect-instance_method" title="#collect (instance method)">#<strong>collect</strong> ⇒ Object </a>
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
</span>
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
<span class="summary_desc"><div class='inline'>
|
153
|
+
<p>Quick access for wrapping collections in Rails compatible format.</p>
|
154
|
+
</div></span>
|
155
|
+
|
156
|
+
</li>
|
157
|
+
|
158
|
+
|
159
|
+
<li class="public ">
|
160
|
+
<span class="summary_signature">
|
161
|
+
|
162
|
+
<a href="#f-instance_method" title="#f (instance method)">#<strong>f</strong> ⇒ Object </a>
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
</span>
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
<span class="summary_desc"><div class='inline'>
|
177
|
+
<p>Called inside the form_fields block.</p>
|
178
|
+
</div></span>
|
179
|
+
|
180
|
+
</li>
|
181
|
+
|
182
|
+
|
183
|
+
<li class="public ">
|
184
|
+
<span class="summary_signature">
|
185
|
+
|
186
|
+
<a href="#field-instance_method" title="#field (instance method)">#<strong>field</strong>(name, **input_opts) ⇒ Object </a>
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
</span>
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
<span class="summary_desc"><div class='inline'>
|
201
|
+
<p>Called inside the form_fields block.</p>
|
202
|
+
</div></span>
|
203
|
+
|
204
|
+
</li>
|
205
|
+
|
206
|
+
|
207
|
+
<li class="public ">
|
208
|
+
<span class="summary_signature">
|
209
|
+
|
210
|
+
<a href="#form_fields-instance_method" title="#form_fields (instance method)">#<strong>form_fields</strong>(&block) ⇒ Object </a>
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
</span>
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
<span class="summary_desc"><div class='inline'>
|
225
|
+
<p>DSL method, use to set the form content.</p>
|
226
|
+
</div></span>
|
227
|
+
|
228
|
+
</li>
|
229
|
+
|
230
|
+
|
231
|
+
<li class="public ">
|
232
|
+
<span class="summary_signature">
|
233
|
+
|
234
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong> ⇒ Form </a>
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
</span>
|
239
|
+
|
240
|
+
|
241
|
+
<span class="note title constructor">constructor</span>
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
<span class="summary_desc"><div class='inline'>
|
251
|
+
<p>A new instance of Form.</p>
|
252
|
+
</div></span>
|
253
|
+
|
254
|
+
</li>
|
255
|
+
|
256
|
+
|
257
|
+
<li class="protected ">
|
258
|
+
<span class="summary_signature">
|
259
|
+
|
260
|
+
<a href="#schema-instance_method" title="#schema (instance method)">#<strong>schema</strong>(wrapper_key, &block) ⇒ Object </a>
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
</span>
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
<span class="note title protected">protected</span>
|
269
|
+
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
|
274
|
+
<span class="summary_desc"><div class='inline'>
|
275
|
+
<p>DSL method, use to replace the form’s schema and wrapper key for a completely manual schema.</p>
|
276
|
+
</div></span>
|
277
|
+
|
278
|
+
</li>
|
279
|
+
|
280
|
+
|
281
|
+
<li class="public ">
|
282
|
+
<span class="summary_signature">
|
283
|
+
|
284
|
+
<a href="#schema_block_for-instance_method" title="#schema_block_for (instance method)">#<strong>schema_block_for</strong>(data) ⇒ Object </a>
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
</span>
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
|
298
|
+
<span class="summary_desc"><div class='inline'>
|
299
|
+
<p>Attr reader for @schema_block with auto-calculated default.</p>
|
300
|
+
</div></span>
|
301
|
+
|
302
|
+
</li>
|
303
|
+
|
304
|
+
|
305
|
+
<li class="protected ">
|
306
|
+
<span class="summary_signature">
|
307
|
+
|
308
|
+
<a href="#schema_field-instance_method" title="#schema_field (instance method)">#<strong>schema_field</strong>(field_name) ⇒ Object </a>
|
309
|
+
|
310
|
+
|
311
|
+
|
312
|
+
</span>
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
<span class="note title protected">protected</span>
|
317
|
+
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
|
322
|
+
<span class="summary_desc"><div class='inline'>
|
323
|
+
<p>DSL method, adds a new field to the schema whitelisting a single field of data_class This auto-generates the correct schema line for the field.</p>
|
324
|
+
</div></span>
|
325
|
+
|
326
|
+
</li>
|
327
|
+
|
328
|
+
|
329
|
+
<li class="protected ">
|
330
|
+
<span class="summary_signature">
|
331
|
+
|
332
|
+
<a href="#schema_fields-instance_method" title="#schema_fields (instance method)">#<strong>schema_fields</strong>(*field_names) ⇒ Object </a>
|
333
|
+
|
334
|
+
|
335
|
+
|
336
|
+
</span>
|
337
|
+
|
338
|
+
|
339
|
+
|
340
|
+
<span class="note title protected">protected</span>
|
341
|
+
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
<span class="summary_desc"><div class='inline'>
|
347
|
+
<p>DSL method, mass-assigns schema fields.</p>
|
348
|
+
</div></span>
|
349
|
+
|
350
|
+
</li>
|
351
|
+
|
352
|
+
|
353
|
+
<li class="protected ">
|
354
|
+
<span class="summary_signature">
|
355
|
+
|
356
|
+
<a href="#schema_line-instance_method" title="#schema_line (instance method)">#<strong>schema_line</strong>(&block) ⇒ Object </a>
|
357
|
+
|
358
|
+
|
359
|
+
|
360
|
+
</span>
|
361
|
+
|
362
|
+
|
363
|
+
|
364
|
+
<span class="note title protected">protected</span>
|
365
|
+
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
|
370
|
+
<span class="summary_desc"><div class='inline'>
|
371
|
+
<p>DSL method, adds a new line to the schema whitelisting a single param inside the schema’s wrapper.</p>
|
372
|
+
</div></span>
|
373
|
+
|
374
|
+
</li>
|
375
|
+
|
376
|
+
|
377
|
+
<li class="public ">
|
378
|
+
<span class="summary_signature">
|
379
|
+
|
380
|
+
<a href="#schema_wrapper_key_for-instance_method" title="#schema_wrapper_key_for (instance method)">#<strong>schema_wrapper_key_for</strong>(data) ⇒ Object </a>
|
381
|
+
|
382
|
+
|
383
|
+
|
384
|
+
</span>
|
385
|
+
|
386
|
+
|
387
|
+
|
388
|
+
|
389
|
+
|
390
|
+
|
391
|
+
|
392
|
+
|
393
|
+
|
394
|
+
<span class="summary_desc"><div class='inline'>
|
395
|
+
<p>Attr reader for @schema_wrapper_key with auto-calculated default.</p>
|
396
|
+
</div></span>
|
397
|
+
|
398
|
+
</li>
|
399
|
+
|
400
|
+
|
401
|
+
<li class="protected ">
|
402
|
+
<span class="summary_signature">
|
403
|
+
|
404
|
+
<a href="#skip_autofocus-instance_method" title="#skip_autofocus (instance method)">#<strong>skip_autofocus</strong> ⇒ Object </a>
|
405
|
+
|
406
|
+
|
407
|
+
|
408
|
+
</span>
|
409
|
+
|
410
|
+
|
411
|
+
|
412
|
+
<span class="note title protected">protected</span>
|
413
|
+
|
414
|
+
|
415
|
+
|
416
|
+
|
417
|
+
|
418
|
+
<span class="summary_desc"><div class='inline'>
|
419
|
+
<p>DSL method, skips adding autofocus to the first field.</p>
|
420
|
+
</div></span>
|
421
|
+
|
422
|
+
</li>
|
423
|
+
|
424
|
+
|
425
|
+
<li class="public ">
|
426
|
+
<span class="summary_signature">
|
427
|
+
|
428
|
+
<a href="#with_simpleform-instance_method" title="#with_simpleform (instance method)">#<strong>with_simpleform</strong>(simpleform) ⇒ Object </a>
|
429
|
+
|
430
|
+
|
431
|
+
|
432
|
+
</span>
|
433
|
+
|
434
|
+
|
435
|
+
|
436
|
+
|
437
|
+
|
438
|
+
|
439
|
+
|
440
|
+
|
441
|
+
|
442
|
+
<span class="summary_desc"><div class='inline'>
|
443
|
+
<p>This method is used by render to store the simpleform instance inside the component such that we can call methods from inside <code>form_fields</code>.</p>
|
444
|
+
</div></span>
|
445
|
+
|
446
|
+
</li>
|
447
|
+
|
448
|
+
|
449
|
+
</ul>
|
450
|
+
|
451
|
+
|
452
|
+
|
453
|
+
|
454
|
+
|
455
|
+
|
456
|
+
|
457
|
+
|
458
|
+
|
459
|
+
|
460
|
+
|
461
|
+
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="../Component.html" title="Compony::Component (class)">Compony::Component</a></span></h3>
|
462
|
+
<p class="inherited"><span class='object_link'><a href="../Component.html#action-instance_method" title="Compony::Component#action (method)">#action</a></span>, <span class='object_link'><a href="../Component.html#add_content-instance_method" title="Compony::Component#add_content (method)">#add_content</a></span>, <span class='object_link'><a href="../Component.html#before_render-instance_method" title="Compony::Component#before_render (method)">#before_render</a></span>, <span class='object_link'><a href="../Component.html#comp_class_for-instance_method" title="Compony::Component#comp_class_for (method)">#comp_class_for</a></span>, <span class='object_link'><a href="../Component.html#comp_class_for!-instance_method" title="Compony::Component#comp_class_for! (method)">#comp_class_for!</a></span>, <span class='object_link'><a href="../Component.html#comp_cst-instance_method" title="Compony::Component#comp_cst (method)">#comp_cst</a></span>, <span class='object_link'><a href="../Component.html#comp_name-instance_method" title="Compony::Component#comp_name (method)">#comp_name</a></span>, <span class='object_link'><a href="../Component.html#content-instance_method" title="Compony::Component#content (method)">#content</a></span>, <span class='object_link'><a href="../Component.html#family_cst-instance_method" title="Compony::Component#family_cst (method)">#family_cst</a></span>, <span class='object_link'><a href="../Component.html#family_name-instance_method" title="Compony::Component#family_name (method)">#family_name</a></span>, <span class='object_link'><a href="../Component.html#id-instance_method" title="Compony::Component#id (method)">#id</a></span>, <span class='object_link'><a href="../Component.html#inspect-instance_method" title="Compony::Component#inspect (method)">#inspect</a></span>, <span class='object_link'><a href="../Component.html#param_name-instance_method" title="Compony::Component#param_name (method)">#param_name</a></span>, <span class='object_link'><a href="../Component.html#path-instance_method" title="Compony::Component#path (method)">#path</a></span>, <span class='object_link'><a href="../Component.html#path_hash-instance_method" title="Compony::Component#path_hash (method)">#path_hash</a></span>, <span class='object_link'><a href="../Component.html#render-instance_method" title="Compony::Component#render (method)">#render</a></span>, <span class='object_link'><a href="../Component.html#render_actions-instance_method" title="Compony::Component#render_actions (method)">#render_actions</a></span>, <span class='object_link'><a href="../Component.html#resourceful%3F-instance_method" title="Compony::Component#resourceful? (method)">#resourceful?</a></span>, <span class='object_link'><a href="../Component.html#root_comp-instance_method" title="Compony::Component#root_comp (method)">#root_comp</a></span>, <span class='object_link'><a href="../Component.html#root_comp%3F-instance_method" title="Compony::Component#root_comp? (method)">#root_comp?</a></span>, <span class='object_link'><a href="../Component.html#setup-class_method" title="Compony::Component.setup (method)">setup</a></span>, <span class='object_link'><a href="../Component.html#skip_action-instance_method" title="Compony::Component#skip_action (method)">#skip_action</a></span>, <span class='object_link'><a href="../Component.html#sub_comp-instance_method" title="Compony::Component#sub_comp (method)">#sub_comp</a></span></p>
|
463
|
+
<div id="constructor_details" class="method_details_list">
|
464
|
+
<h2>Constructor Details</h2>
|
465
|
+
|
466
|
+
<div class="method_details first">
|
467
|
+
<h3 class="signature first" id="initialize-instance_method">
|
468
|
+
|
469
|
+
#<strong>initialize</strong> ⇒ <tt><span class='object_link'><a href="" title="Compony::Components::Form (class)">Form</a></span></tt>
|
470
|
+
|
471
|
+
|
472
|
+
|
473
|
+
|
474
|
+
|
475
|
+
</h3><div class="docstring">
|
476
|
+
<div class="discussion">
|
477
|
+
|
478
|
+
<p>Returns a new instance of Form.</p>
|
479
|
+
|
480
|
+
|
481
|
+
</div>
|
482
|
+
</div>
|
483
|
+
<div class="tags">
|
484
|
+
|
485
|
+
|
486
|
+
</div><table class="source_code">
|
487
|
+
<tr>
|
488
|
+
<td>
|
489
|
+
<pre class="lines">
|
490
|
+
|
491
|
+
|
492
|
+
6
|
493
|
+
7
|
494
|
+
8
|
495
|
+
9</pre>
|
496
|
+
</td>
|
497
|
+
<td>
|
498
|
+
<pre class="code"><span class="info file"># File 'lib/compony/components/form.rb', line 6</span>
|
499
|
+
|
500
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='op'>...</span><span class='rparen'>)</span>
|
501
|
+
<span class='ivar'>@schema_lines_for_data</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span> <span class='comment'># Array of procs taking data returning a Schemacop proc
|
502
|
+
</span> <span class='kw'>super</span>
|
503
|
+
<span class='kw'>end</span></pre>
|
504
|
+
</td>
|
505
|
+
</tr>
|
506
|
+
</table>
|
507
|
+
</div>
|
508
|
+
|
509
|
+
</div>
|
510
|
+
|
511
|
+
|
512
|
+
<div id="instance_method_details" class="method_details_list">
|
513
|
+
<h2>Instance Method Details</h2>
|
514
|
+
|
515
|
+
|
516
|
+
<div class="method_details first">
|
517
|
+
<h3 class="signature first" id="collect-instance_method">
|
518
|
+
|
519
|
+
#<strong>collect</strong> ⇒ <tt>Object</tt>
|
520
|
+
|
521
|
+
|
522
|
+
|
523
|
+
|
524
|
+
|
525
|
+
</h3><div class="docstring">
|
526
|
+
<div class="discussion">
|
527
|
+
|
528
|
+
<p>Quick access for wrapping collections in Rails compatible format</p>
|
529
|
+
|
530
|
+
|
531
|
+
</div>
|
532
|
+
</div>
|
533
|
+
<div class="tags">
|
534
|
+
|
535
|
+
|
536
|
+
</div><table class="source_code">
|
537
|
+
<tr>
|
538
|
+
<td>
|
539
|
+
<pre class="lines">
|
540
|
+
|
541
|
+
|
542
|
+
105
|
543
|
+
106
|
544
|
+
107</pre>
|
545
|
+
</td>
|
546
|
+
<td>
|
547
|
+
<pre class="code"><span class="info file"># File 'lib/compony/components/form.rb', line 105</span>
|
548
|
+
|
549
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_collect'>collect</span><span class='lparen'>(</span><span class='op'>...</span><span class='rparen'>)</span>
|
550
|
+
<span class='const'><span class='object_link'><a href="../../Compony.html" title="Compony (module)">Compony</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../ModelFields.html" title="Compony::ModelFields (module)">ModelFields</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../ModelFields/Anchormodel.html" title="Compony::ModelFields::Anchormodel (class)">Anchormodel</a></span></span><span class='period'>.</span><span class='id identifier rubyid_collect'><span class='object_link'><a href="../ModelFields/Anchormodel.html#collect-class_method" title="Compony::ModelFields::Anchormodel.collect (method)">collect</a></span></span><span class='lparen'>(</span><span class='op'>...</span><span class='rparen'>)</span>
|
551
|
+
<span class='kw'>end</span></pre>
|
552
|
+
</td>
|
553
|
+
</tr>
|
554
|
+
</table>
|
555
|
+
</div>
|
556
|
+
|
557
|
+
<div class="method_details ">
|
558
|
+
<h3 class="signature " id="f-instance_method">
|
559
|
+
|
560
|
+
#<strong>f</strong> ⇒ <tt>Object</tt>
|
561
|
+
|
562
|
+
|
563
|
+
|
564
|
+
|
565
|
+
|
566
|
+
</h3><div class="docstring">
|
567
|
+
<div class="discussion">
|
568
|
+
|
569
|
+
<p>Called inside the form_fields block. This makes the method <code>f</code> available in the block. See also notes for <code>with_simpleform</code>.</p>
|
570
|
+
|
571
|
+
|
572
|
+
</div>
|
573
|
+
</div>
|
574
|
+
<div class="tags">
|
575
|
+
|
576
|
+
|
577
|
+
</div><table class="source_code">
|
578
|
+
<tr>
|
579
|
+
<td>
|
580
|
+
<pre class="lines">
|
581
|
+
|
582
|
+
|
583
|
+
99
|
584
|
+
100
|
585
|
+
101
|
586
|
+
102</pre>
|
587
|
+
</td>
|
588
|
+
<td>
|
589
|
+
<pre class="code"><span class="info file"># File 'lib/compony/components/form.rb', line 99</span>
|
590
|
+
|
591
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_f'>f</span>
|
592
|
+
<span class='id identifier rubyid_fail'>fail</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>The `f` method may only be called inside `form_fields` for </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'>.</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='ivar'>@simpleform</span>
|
593
|
+
<span class='kw'>return</span> <span class='ivar'>@simpleform</span>
|
594
|
+
<span class='kw'>end</span></pre>
|
595
|
+
</td>
|
596
|
+
</tr>
|
597
|
+
</table>
|
598
|
+
</div>
|
599
|
+
|
600
|
+
<div class="method_details ">
|
601
|
+
<h3 class="signature " id="field-instance_method">
|
602
|
+
|
603
|
+
#<strong>field</strong>(name, **input_opts) ⇒ <tt>Object</tt>
|
604
|
+
|
605
|
+
|
606
|
+
|
607
|
+
|
608
|
+
|
609
|
+
</h3><div class="docstring">
|
610
|
+
<div class="discussion">
|
611
|
+
|
612
|
+
<p>Called inside the form_fields block. This makes the method <code>field</code> available in the block. See also notes for <code>with_simpleform</code>.</p>
|
613
|
+
|
614
|
+
|
615
|
+
</div>
|
616
|
+
</div>
|
617
|
+
<div class="tags">
|
618
|
+
|
619
|
+
|
620
|
+
</div><table class="source_code">
|
621
|
+
<tr>
|
622
|
+
<td>
|
623
|
+
<pre class="lines">
|
624
|
+
|
625
|
+
|
626
|
+
79
|
627
|
+
80
|
628
|
+
81
|
629
|
+
82
|
630
|
+
83
|
631
|
+
84
|
632
|
+
85
|
633
|
+
86
|
634
|
+
87
|
635
|
+
88
|
636
|
+
89
|
637
|
+
90
|
638
|
+
91
|
639
|
+
92
|
640
|
+
93
|
641
|
+
94
|
642
|
+
95</pre>
|
643
|
+
</td>
|
644
|
+
<td>
|
645
|
+
<pre class="code"><span class="info file"># File 'lib/compony/components/form.rb', line 79</span>
|
646
|
+
|
647
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_field'>field</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_input_opts'>input_opts</span><span class='rparen'>)</span>
|
648
|
+
<span class='id identifier rubyid_fail'>fail</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>The `field` method may only be called inside `form_fields` for </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'>.</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='ivar'>@simpleform</span>
|
649
|
+
|
650
|
+
<span class='id identifier rubyid_hidden'>hidden</span> <span class='op'>=</span> <span class='id identifier rubyid_input_opts'>input_opts</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:hidden</span><span class='rparen'>)</span>
|
651
|
+
<span class='id identifier rubyid_model_field'>model_field</span> <span class='op'>=</span> <span class='ivar'>@simpleform</span><span class='period'>.</span><span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_fields'>fields</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span>
|
652
|
+
<span class='id identifier rubyid_fail'>fail</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Field </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'> is not defined on </span><span class='embexpr_beg'>#{</span><span class='ivar'>@simpleform</span><span class='period'>.</span><span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'> but was requested in </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'>.</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_model_field'>model_field</span>
|
653
|
+
|
654
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_hidden'>hidden</span>
|
655
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_model_field'>model_field</span><span class='period'>.</span><span class='id identifier rubyid_simpleform_input_hidden'>simpleform_input_hidden</span><span class='lparen'>(</span><span class='ivar'>@simpleform</span><span class='comma'>,</span> <span class='kw'>self</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_input_opts'>input_opts</span><span class='rparen'>)</span>
|
656
|
+
<span class='kw'>else</span>
|
657
|
+
<span class='kw'>unless</span> <span class='ivar'>@focus_given</span> <span class='op'>||</span> <span class='ivar'>@skip_autofocus</span>
|
658
|
+
<span class='id identifier rubyid_input_opts'>input_opts</span><span class='lbracket'>[</span><span class='symbol'>:autofocus</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>true</span> <span class='kw'>unless</span> <span class='id identifier rubyid_input_opts'>input_opts</span><span class='period'>.</span><span class='id identifier rubyid_key?'>key?</span> <span class='symbol'>:autofocus</span>
|
659
|
+
<span class='ivar'>@focus_given</span> <span class='op'>=</span> <span class='kw'>true</span>
|
660
|
+
<span class='kw'>end</span>
|
661
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_model_field'>model_field</span><span class='period'>.</span><span class='id identifier rubyid_simpleform_input'>simpleform_input</span><span class='lparen'>(</span><span class='ivar'>@simpleform</span><span class='comma'>,</span> <span class='kw'>self</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_input_opts'>input_opts</span><span class='rparen'>)</span>
|
662
|
+
<span class='kw'>end</span>
|
663
|
+
<span class='kw'>end</span></pre>
|
664
|
+
</td>
|
665
|
+
</tr>
|
666
|
+
</table>
|
667
|
+
</div>
|
668
|
+
|
669
|
+
<div class="method_details ">
|
670
|
+
<h3 class="signature " id="form_fields-instance_method">
|
671
|
+
|
672
|
+
#<strong>form_fields</strong>(&block) ⇒ <tt>Object</tt>
|
673
|
+
|
674
|
+
|
675
|
+
|
676
|
+
|
677
|
+
|
678
|
+
</h3><div class="docstring">
|
679
|
+
<div class="discussion">
|
680
|
+
|
681
|
+
<p>DSL method, use to set the form content</p>
|
682
|
+
|
683
|
+
|
684
|
+
</div>
|
685
|
+
</div>
|
686
|
+
<div class="tags">
|
687
|
+
|
688
|
+
|
689
|
+
</div><table class="source_code">
|
690
|
+
<tr>
|
691
|
+
<td>
|
692
|
+
<pre class="lines">
|
693
|
+
|
694
|
+
|
695
|
+
36
|
696
|
+
37
|
697
|
+
38
|
698
|
+
39</pre>
|
699
|
+
</td>
|
700
|
+
<td>
|
701
|
+
<pre class="code"><span class="info file"># File 'lib/compony/components/form.rb', line 36</span>
|
702
|
+
|
703
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_form_fields'>form_fields</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
704
|
+
<span class='kw'>return</span> <span class='ivar'>@form_fields</span> <span class='kw'>unless</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
|
705
|
+
<span class='ivar'>@form_fields</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span>
|
706
|
+
<span class='kw'>end</span></pre>
|
707
|
+
</td>
|
708
|
+
</tr>
|
709
|
+
</table>
|
710
|
+
</div>
|
711
|
+
|
712
|
+
<div class="method_details ">
|
713
|
+
<h3 class="signature " id="schema-instance_method">
|
714
|
+
|
715
|
+
#<strong>schema</strong>(wrapper_key, &block) ⇒ <tt>Object</tt> <span class="extras">(protected)</span>
|
716
|
+
|
717
|
+
|
718
|
+
|
719
|
+
|
720
|
+
|
721
|
+
</h3><div class="docstring">
|
722
|
+
<div class="discussion">
|
723
|
+
|
724
|
+
<p>DSL method, use to replace the form’s schema and wrapper key for a completely manual schema</p>
|
725
|
+
|
726
|
+
|
727
|
+
</div>
|
728
|
+
</div>
|
729
|
+
<div class="tags">
|
730
|
+
|
731
|
+
|
732
|
+
</div><table class="source_code">
|
733
|
+
<tr>
|
734
|
+
<td>
|
735
|
+
<pre class="lines">
|
736
|
+
|
737
|
+
|
738
|
+
131
|
739
|
+
132
|
740
|
+
133
|
741
|
+
134
|
742
|
+
135
|
743
|
+
136
|
744
|
+
137
|
745
|
+
138</pre>
|
746
|
+
</td>
|
747
|
+
<td>
|
748
|
+
<pre class="code"><span class="info file"># File 'lib/compony/components/form.rb', line 131</span>
|
749
|
+
|
750
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_schema'>schema</span><span class='lparen'>(</span><span class='id identifier rubyid_wrapper_key'>wrapper_key</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
751
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
|
752
|
+
<span class='ivar'>@schema_wrapper_key</span> <span class='op'>=</span> <span class='id identifier rubyid_wrapper_key'>wrapper_key</span>
|
753
|
+
<span class='ivar'>@schema_block</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span>
|
754
|
+
<span class='kw'>else</span>
|
755
|
+
<span class='id identifier rubyid_fail'>fail</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>schema requires a block to be given</span><span class='tstring_end'>'</span></span>
|
756
|
+
<span class='kw'>end</span>
|
757
|
+
<span class='kw'>end</span></pre>
|
758
|
+
</td>
|
759
|
+
</tr>
|
760
|
+
</table>
|
761
|
+
</div>
|
762
|
+
|
763
|
+
<div class="method_details ">
|
764
|
+
<h3 class="signature " id="schema_block_for-instance_method">
|
765
|
+
|
766
|
+
#<strong>schema_block_for</strong>(data) ⇒ <tt>Object</tt>
|
767
|
+
|
768
|
+
|
769
|
+
|
770
|
+
|
771
|
+
|
772
|
+
</h3><div class="docstring">
|
773
|
+
<div class="discussion">
|
774
|
+
|
775
|
+
<p>Attr reader for @schema_block with auto-calculated default</p>
|
776
|
+
|
777
|
+
|
778
|
+
</div>
|
779
|
+
</div>
|
780
|
+
<div class="tags">
|
781
|
+
|
782
|
+
|
783
|
+
</div><table class="source_code">
|
784
|
+
<tr>
|
785
|
+
<td>
|
786
|
+
<pre class="lines">
|
787
|
+
|
788
|
+
|
789
|
+
52
|
790
|
+
53
|
791
|
+
54
|
792
|
+
55
|
793
|
+
56
|
794
|
+
57
|
795
|
+
58
|
796
|
+
59
|
797
|
+
60
|
798
|
+
61
|
799
|
+
62
|
800
|
+
63
|
801
|
+
64</pre>
|
802
|
+
</td>
|
803
|
+
<td>
|
804
|
+
<pre class="code"><span class="info file"># File 'lib/compony/components/form.rb', line 52</span>
|
805
|
+
|
806
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_schema_block_for'>schema_block_for</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
|
807
|
+
<span class='kw'>if</span> <span class='ivar'>@schema_block</span>
|
808
|
+
<span class='kw'>return</span> <span class='ivar'>@schema_block</span>
|
809
|
+
<span class='kw'>else</span>
|
810
|
+
<span class='comment'># If schema was not called, auto-infer a default
|
811
|
+
</span> <span class='id identifier rubyid_local_schema_lines_for_data'>local_schema_lines_for_data</span> <span class='op'>=</span> <span class='ivar'>@schema_lines_for_data</span>
|
812
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_proc'>proc</span> <span class='kw'>do</span>
|
813
|
+
<span class='id identifier rubyid_local_schema_lines_for_data'>local_schema_lines_for_data</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_schema_line'>schema_line</span><span class='op'>|</span>
|
814
|
+
<span class='id identifier rubyid_instance_exec'>instance_exec</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_schema_line'>schema_line</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
815
|
+
<span class='kw'>end</span>
|
816
|
+
<span class='kw'>end</span>
|
817
|
+
<span class='kw'>end</span>
|
818
|
+
<span class='kw'>end</span></pre>
|
819
|
+
</td>
|
820
|
+
</tr>
|
821
|
+
</table>
|
822
|
+
</div>
|
823
|
+
|
824
|
+
<div class="method_details ">
|
825
|
+
<h3 class="signature " id="schema_field-instance_method">
|
826
|
+
|
827
|
+
#<strong>schema_field</strong>(field_name) ⇒ <tt>Object</tt> <span class="extras">(protected)</span>
|
828
|
+
|
829
|
+
|
830
|
+
|
831
|
+
|
832
|
+
|
833
|
+
</h3><div class="docstring">
|
834
|
+
<div class="discussion">
|
835
|
+
|
836
|
+
<p>DSL method, adds a new field to the schema whitelisting a single field of data_class This auto-generates the correct schema line for the field.</p>
|
837
|
+
|
838
|
+
|
839
|
+
</div>
|
840
|
+
</div>
|
841
|
+
<div class="tags">
|
842
|
+
|
843
|
+
|
844
|
+
</div><table class="source_code">
|
845
|
+
<tr>
|
846
|
+
<td>
|
847
|
+
<pre class="lines">
|
848
|
+
|
849
|
+
|
850
|
+
118
|
851
|
+
119
|
852
|
+
120
|
853
|
+
121
|
854
|
+
122
|
855
|
+
123</pre>
|
856
|
+
</td>
|
857
|
+
<td>
|
858
|
+
<pre class="code"><span class="info file"># File 'lib/compony/components/form.rb', line 118</span>
|
859
|
+
|
860
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_schema_field'>schema_field</span><span class='lparen'>(</span><span class='id identifier rubyid_field_name'>field_name</span><span class='rparen'>)</span>
|
861
|
+
<span class='ivar'>@schema_lines_for_data</span> <span class='op'><<</span> <span class='id identifier rubyid_proc'>proc</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_data'>data</span><span class='op'>|</span>
|
862
|
+
<span class='id identifier rubyid_field'>field</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_fields'>fields</span><span class='lbracket'>[</span><span class='id identifier rubyid_field_name'>field_name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='id identifier rubyid_fail'>fail</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>No field </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_field_name'>field_name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'> found for </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'> in </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'>.</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
863
|
+
<span class='kw'>next</span> <span class='id identifier rubyid_field'>field</span><span class='period'>.</span><span class='id identifier rubyid_schema_line'>schema_line</span>
|
864
|
+
<span class='kw'>end</span>
|
865
|
+
<span class='kw'>end</span></pre>
|
866
|
+
</td>
|
867
|
+
</tr>
|
868
|
+
</table>
|
869
|
+
</div>
|
870
|
+
|
871
|
+
<div class="method_details ">
|
872
|
+
<h3 class="signature " id="schema_fields-instance_method">
|
873
|
+
|
874
|
+
#<strong>schema_fields</strong>(*field_names) ⇒ <tt>Object</tt> <span class="extras">(protected)</span>
|
875
|
+
|
876
|
+
|
877
|
+
|
878
|
+
|
879
|
+
|
880
|
+
</h3><div class="docstring">
|
881
|
+
<div class="discussion">
|
882
|
+
|
883
|
+
<p>DSL method, mass-assigns schema fields</p>
|
884
|
+
|
885
|
+
|
886
|
+
</div>
|
887
|
+
</div>
|
888
|
+
<div class="tags">
|
889
|
+
|
890
|
+
|
891
|
+
</div><table class="source_code">
|
892
|
+
<tr>
|
893
|
+
<td>
|
894
|
+
<pre class="lines">
|
895
|
+
|
896
|
+
|
897
|
+
126
|
898
|
+
127
|
899
|
+
128</pre>
|
900
|
+
</td>
|
901
|
+
<td>
|
902
|
+
<pre class="code"><span class="info file"># File 'lib/compony/components/form.rb', line 126</span>
|
903
|
+
|
904
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_schema_fields'>schema_fields</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_field_names'>field_names</span><span class='rparen'>)</span>
|
905
|
+
<span class='id identifier rubyid_field_names'>field_names</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_field_name'>field_name</span><span class='op'>|</span> <span class='id identifier rubyid_schema_field'>schema_field</span><span class='lparen'>(</span><span class='id identifier rubyid_field_name'>field_name</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
906
|
+
<span class='kw'>end</span></pre>
|
907
|
+
</td>
|
908
|
+
</tr>
|
909
|
+
</table>
|
910
|
+
</div>
|
911
|
+
|
912
|
+
<div class="method_details ">
|
913
|
+
<h3 class="signature " id="schema_line-instance_method">
|
914
|
+
|
915
|
+
#<strong>schema_line</strong>(&block) ⇒ <tt>Object</tt> <span class="extras">(protected)</span>
|
916
|
+
|
917
|
+
|
918
|
+
|
919
|
+
|
920
|
+
|
921
|
+
</h3><div class="docstring">
|
922
|
+
<div class="discussion">
|
923
|
+
|
924
|
+
<p>DSL method, adds a new line to the schema whitelisting a single param inside the schema’s wrapper</p>
|
925
|
+
|
926
|
+
|
927
|
+
</div>
|
928
|
+
</div>
|
929
|
+
<div class="tags">
|
930
|
+
|
931
|
+
|
932
|
+
</div><table class="source_code">
|
933
|
+
<tr>
|
934
|
+
<td>
|
935
|
+
<pre class="lines">
|
936
|
+
|
937
|
+
|
938
|
+
112
|
939
|
+
113
|
940
|
+
114</pre>
|
941
|
+
</td>
|
942
|
+
<td>
|
943
|
+
<pre class="code"><span class="info file"># File 'lib/compony/components/form.rb', line 112</span>
|
944
|
+
|
945
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_schema_line'>schema_line</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
946
|
+
<span class='ivar'>@schema_lines_for_data</span> <span class='op'><<</span> <span class='id identifier rubyid_proc'>proc</span> <span class='lbrace'>{</span> <span class='id identifier rubyid_block'>block</span> <span class='rbrace'>}</span>
|
947
|
+
<span class='kw'>end</span></pre>
|
948
|
+
</td>
|
949
|
+
</tr>
|
950
|
+
</table>
|
951
|
+
</div>
|
952
|
+
|
953
|
+
<div class="method_details ">
|
954
|
+
<h3 class="signature " id="schema_wrapper_key_for-instance_method">
|
955
|
+
|
956
|
+
#<strong>schema_wrapper_key_for</strong>(data) ⇒ <tt>Object</tt>
|
957
|
+
|
958
|
+
|
959
|
+
|
960
|
+
|
961
|
+
|
962
|
+
</h3><div class="docstring">
|
963
|
+
<div class="discussion">
|
964
|
+
|
965
|
+
<p>Attr reader for @schema_wrapper_key with auto-calculated default</p>
|
966
|
+
|
967
|
+
|
968
|
+
</div>
|
969
|
+
</div>
|
970
|
+
<div class="tags">
|
971
|
+
|
972
|
+
|
973
|
+
</div><table class="source_code">
|
974
|
+
<tr>
|
975
|
+
<td>
|
976
|
+
<pre class="lines">
|
977
|
+
|
978
|
+
|
979
|
+
42
|
980
|
+
43
|
981
|
+
44
|
982
|
+
45
|
983
|
+
46
|
984
|
+
47
|
985
|
+
48
|
986
|
+
49</pre>
|
987
|
+
</td>
|
988
|
+
<td>
|
989
|
+
<pre class="code"><span class="info file"># File 'lib/compony/components/form.rb', line 42</span>
|
990
|
+
|
991
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_schema_wrapper_key_for'>schema_wrapper_key_for</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
|
992
|
+
<span class='kw'>if</span> <span class='ivar'>@schema_wrapper_key</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
|
993
|
+
<span class='kw'>return</span> <span class='ivar'>@schema_wrapper_key</span>
|
994
|
+
<span class='kw'>else</span>
|
995
|
+
<span class='comment'># If schema was not called, auto-infer a default
|
996
|
+
</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_model_name'>model_name</span><span class='period'>.</span><span class='id identifier rubyid_singular'>singular</span>
|
997
|
+
<span class='kw'>end</span>
|
998
|
+
<span class='kw'>end</span></pre>
|
999
|
+
</td>
|
1000
|
+
</tr>
|
1001
|
+
</table>
|
1002
|
+
</div>
|
1003
|
+
|
1004
|
+
<div class="method_details ">
|
1005
|
+
<h3 class="signature " id="skip_autofocus-instance_method">
|
1006
|
+
|
1007
|
+
#<strong>skip_autofocus</strong> ⇒ <tt>Object</tt> <span class="extras">(protected)</span>
|
1008
|
+
|
1009
|
+
|
1010
|
+
|
1011
|
+
|
1012
|
+
|
1013
|
+
</h3><div class="docstring">
|
1014
|
+
<div class="discussion">
|
1015
|
+
|
1016
|
+
<p>DSL method, skips adding autofocus to the first field</p>
|
1017
|
+
|
1018
|
+
|
1019
|
+
</div>
|
1020
|
+
</div>
|
1021
|
+
<div class="tags">
|
1022
|
+
|
1023
|
+
|
1024
|
+
</div><table class="source_code">
|
1025
|
+
<tr>
|
1026
|
+
<td>
|
1027
|
+
<pre class="lines">
|
1028
|
+
|
1029
|
+
|
1030
|
+
141
|
1031
|
+
142
|
1032
|
+
143</pre>
|
1033
|
+
</td>
|
1034
|
+
<td>
|
1035
|
+
<pre class="code"><span class="info file"># File 'lib/compony/components/form.rb', line 141</span>
|
1036
|
+
|
1037
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_skip_autofocus'>skip_autofocus</span>
|
1038
|
+
<span class='ivar'>@skip_autofocus</span> <span class='op'>=</span> <span class='kw'>true</span>
|
1039
|
+
<span class='kw'>end</span></pre>
|
1040
|
+
</td>
|
1041
|
+
</tr>
|
1042
|
+
</table>
|
1043
|
+
</div>
|
1044
|
+
|
1045
|
+
<div class="method_details ">
|
1046
|
+
<h3 class="signature " id="with_simpleform-instance_method">
|
1047
|
+
|
1048
|
+
#<strong>with_simpleform</strong>(simpleform) ⇒ <tt>Object</tt>
|
1049
|
+
|
1050
|
+
|
1051
|
+
|
1052
|
+
|
1053
|
+
|
1054
|
+
</h3><div class="docstring">
|
1055
|
+
<div class="discussion">
|
1056
|
+
|
1057
|
+
<div class="note todo">
|
1058
|
+
<strong>TODO:</strong>
|
1059
|
+
<div class='inline'>
|
1060
|
+
<p>Refactor? Could this be greatly simplified by having <code>form_field to |f|</code> ?</p>
|
1061
|
+
</div>
|
1062
|
+
</div>
|
1063
|
+
|
1064
|
+
|
1065
|
+
<p>This method is used by render to store the simpleform instance inside the component such that we can call methods from inside <code>form_fields</code>. This is a workaround required because the form does not exist when the RequestContext is being built, and we want the method <code>field</code> to be available inside the <code>form_fields</code> block.</p>
|
1066
|
+
|
1067
|
+
|
1068
|
+
</div>
|
1069
|
+
</div>
|
1070
|
+
<div class="tags">
|
1071
|
+
|
1072
|
+
|
1073
|
+
</div><table class="source_code">
|
1074
|
+
<tr>
|
1075
|
+
<td>
|
1076
|
+
<pre class="lines">
|
1077
|
+
|
1078
|
+
|
1079
|
+
70
|
1080
|
+
71
|
1081
|
+
72
|
1082
|
+
73
|
1083
|
+
74
|
1084
|
+
75</pre>
|
1085
|
+
</td>
|
1086
|
+
<td>
|
1087
|
+
<pre class="code"><span class="info file"># File 'lib/compony/components/form.rb', line 70</span>
|
1088
|
+
|
1089
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_with_simpleform'>with_simpleform</span><span class='lparen'>(</span><span class='id identifier rubyid_simpleform'>simpleform</span><span class='rparen'>)</span>
|
1090
|
+
<span class='ivar'>@simpleform</span> <span class='op'>=</span> <span class='id identifier rubyid_simpleform'>simpleform</span>
|
1091
|
+
<span class='ivar'>@focus_given</span> <span class='op'>=</span> <span class='kw'>false</span>
|
1092
|
+
<span class='kw'>yield</span>
|
1093
|
+
<span class='ivar'>@simpleform</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
1094
|
+
<span class='kw'>end</span></pre>
|
1095
|
+
</td>
|
1096
|
+
</tr>
|
1097
|
+
</table>
|
1098
|
+
</div>
|
1099
|
+
|
1100
|
+
</div>
|
1101
|
+
|
1102
|
+
</div>
|
1103
|
+
|
1104
|
+
<div id="footer">
|
1105
|
+
Generated on Wed Apr 24 17:14:06 2024 by
|
1106
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1107
|
+
0.9.34 (ruby-3.2.2).
|
1108
|
+
</div>
|
1109
|
+
|
1110
|
+
</div>
|
1111
|
+
</body>
|
1112
|
+
</html>
|