compony 0.2.0 → 0.2.2
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.
- 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,2098 @@
|
|
|
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::Component
|
|
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::Component";
|
|
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 (C)</a> »
|
|
40
|
+
<span class='title'><span class='object_link'><a href="../Compony.html" title="Compony (module)">Compony</a></span></span>
|
|
41
|
+
»
|
|
42
|
+
<span class="title">Component</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::Component
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
</h1>
|
|
67
|
+
<div class="box_info">
|
|
68
|
+
|
|
69
|
+
<dl>
|
|
70
|
+
<dt>Inherits:</dt>
|
|
71
|
+
<dd>
|
|
72
|
+
<span class="inheritName">Object</span>
|
|
73
|
+
|
|
74
|
+
<ul class="fullTree">
|
|
75
|
+
<li>Object</li>
|
|
76
|
+
|
|
77
|
+
<li class="next">Compony::Component</li>
|
|
78
|
+
|
|
79
|
+
</ul>
|
|
80
|
+
<a href="#" class="inheritanceTree">show all</a>
|
|
81
|
+
|
|
82
|
+
</dd>
|
|
83
|
+
</dl>
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
<dl>
|
|
96
|
+
<dt>Defined in:</dt>
|
|
97
|
+
<dd>lib/compony/component.rb</dd>
|
|
98
|
+
</dl>
|
|
99
|
+
|
|
100
|
+
</div>
|
|
101
|
+
|
|
102
|
+
<div class="docstring">
|
|
103
|
+
<div class="discussion">
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
<div class="tags">
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
</div><div id="subclasses">
|
|
112
|
+
<h2>Direct Known Subclasses</h2>
|
|
113
|
+
<p class="children"><span class='object_link'><a href="Components/Button.html" title="Compony::Components::Button (class)">Compony::Components::Button</a></span>, <span class='object_link'><a href="Components/Destroy.html" title="Compony::Components::Destroy (class)">Compony::Components::Destroy</a></span>, <span class='object_link'><a href="Components/Form.html" title="Compony::Components::Form (class)">Compony::Components::Form</a></span>, <span class='object_link'><a href="Components/WithForm.html" title="Compony::Components::WithForm (class)">Compony::Components::WithForm</a></span></p>
|
|
114
|
+
</div>
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
|
120
|
+
<ul class="summary">
|
|
121
|
+
|
|
122
|
+
<li class="public ">
|
|
123
|
+
<span class="summary_signature">
|
|
124
|
+
|
|
125
|
+
<a href="#comp_opts-instance_method" title="#comp_opts (instance method)">#<strong>comp_opts</strong> ⇒ Object </a>
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
</span>
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
<span class="note title readonly">readonly</span>
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
145
|
+
|
|
146
|
+
</li>
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
<li class="public ">
|
|
150
|
+
<span class="summary_signature">
|
|
151
|
+
|
|
152
|
+
<a href="#parent_comp-instance_method" title="#parent_comp (instance method)">#<strong>parent_comp</strong> ⇒ Object </a>
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
</span>
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
<span class="note title readonly">readonly</span>
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
172
|
+
|
|
173
|
+
</li>
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
</ul>
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
<h2>
|
|
183
|
+
Class Method Summary
|
|
184
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
|
185
|
+
</h2>
|
|
186
|
+
|
|
187
|
+
<ul class="summary">
|
|
188
|
+
|
|
189
|
+
<li class="public ">
|
|
190
|
+
<span class="summary_signature">
|
|
191
|
+
|
|
192
|
+
<a href="#setup-class_method" title="setup (class method)">.<strong>setup</strong>(&block) ⇒ Object </a>
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
</span>
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
<span class="summary_desc"><div class='inline'>
|
|
207
|
+
<p>DSL method.</p>
|
|
208
|
+
</div></span>
|
|
209
|
+
|
|
210
|
+
</li>
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
</ul>
|
|
214
|
+
|
|
215
|
+
<h2>
|
|
216
|
+
Instance Method Summary
|
|
217
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
|
218
|
+
</h2>
|
|
219
|
+
|
|
220
|
+
<ul class="summary">
|
|
221
|
+
|
|
222
|
+
<li class="public ">
|
|
223
|
+
<span class="summary_signature">
|
|
224
|
+
|
|
225
|
+
<a href="#action-instance_method" title="#action (instance method)">#<strong>action</strong>(action_name, before: nil, &block) ⇒ Object </a>
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
</span>
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
<span class="summary_desc"><div class='inline'>
|
|
240
|
+
<p>DSL method Adds or replaces an action (for action buttons) If before: is specified, will insert the action before the named action.</p>
|
|
241
|
+
</div></span>
|
|
242
|
+
|
|
243
|
+
</li>
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
<li class="public ">
|
|
247
|
+
<span class="summary_signature">
|
|
248
|
+
|
|
249
|
+
<a href="#add_content-instance_method" title="#add_content (instance method)">#<strong>add_content</strong>(index = -1,, &block) ⇒ Object </a>
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
</span>
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
<span class="summary_desc"><div class='inline'>
|
|
264
|
+
<p>DSL method Adds a content block that will be executed after all previous ones.</p>
|
|
265
|
+
</div></span>
|
|
266
|
+
|
|
267
|
+
</li>
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
<li class="public ">
|
|
271
|
+
<span class="summary_signature">
|
|
272
|
+
|
|
273
|
+
<a href="#before_render-instance_method" title="#before_render (instance method)">#<strong>before_render</strong>(&block) ⇒ Object </a>
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
</span>
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
<span class="summary_desc"><div class='inline'>
|
|
288
|
+
<p>DSL method.</p>
|
|
289
|
+
</div></span>
|
|
290
|
+
|
|
291
|
+
</li>
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
<li class="public ">
|
|
295
|
+
<span class="summary_signature">
|
|
296
|
+
|
|
297
|
+
<a href="#comp_class_for-instance_method" title="#comp_class_for (instance method)">#<strong>comp_class_for</strong> ⇒ Object </a>
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
</span>
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
312
|
+
|
|
313
|
+
</li>
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
<li class="public ">
|
|
317
|
+
<span class="summary_signature">
|
|
318
|
+
|
|
319
|
+
<a href="#comp_class_for!-instance_method" title="#comp_class_for! (instance method)">#<strong>comp_class_for!</strong> ⇒ Object </a>
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
</span>
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
334
|
+
|
|
335
|
+
</li>
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
<li class="public ">
|
|
339
|
+
<span class="summary_signature">
|
|
340
|
+
|
|
341
|
+
<a href="#comp_cst-instance_method" title="#comp_cst (instance method)">#<strong>comp_cst</strong> ⇒ Object </a>
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
</span>
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
<span class="summary_desc"><div class='inline'>
|
|
356
|
+
<p>Returns the name of the class constant of this component.</p>
|
|
357
|
+
</div></span>
|
|
358
|
+
|
|
359
|
+
</li>
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
<li class="public ">
|
|
363
|
+
<span class="summary_signature">
|
|
364
|
+
|
|
365
|
+
<a href="#comp_name-instance_method" title="#comp_name (instance method)">#<strong>comp_name</strong> ⇒ Object </a>
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
</span>
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
<span class="summary_desc"><div class='inline'>
|
|
380
|
+
<p>Returns the component name.</p>
|
|
381
|
+
</div></span>
|
|
382
|
+
|
|
383
|
+
</li>
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
<li class="public ">
|
|
387
|
+
<span class="summary_signature">
|
|
388
|
+
|
|
389
|
+
<a href="#content-instance_method" title="#content (instance method)">#<strong>content</strong>(&block) ⇒ Object </a>
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
</span>
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
<span class="summary_desc"><div class='inline'>
|
|
404
|
+
<p>DSL method Overrides previous content (also from superclasses).</p>
|
|
405
|
+
</div></span>
|
|
406
|
+
|
|
407
|
+
</li>
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
<li class="public ">
|
|
411
|
+
<span class="summary_signature">
|
|
412
|
+
|
|
413
|
+
<a href="#family_cst-instance_method" title="#family_cst (instance method)">#<strong>family_cst</strong> ⇒ Object </a>
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
</span>
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
<span class="summary_desc"><div class='inline'>
|
|
428
|
+
<p>Returns the name of the module constant (=family) of this component.</p>
|
|
429
|
+
</div></span>
|
|
430
|
+
|
|
431
|
+
</li>
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
<li class="public ">
|
|
435
|
+
<span class="summary_signature">
|
|
436
|
+
|
|
437
|
+
<a href="#family_name-instance_method" title="#family_name (instance method)">#<strong>family_name</strong> ⇒ Object </a>
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
</span>
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
<span class="summary_desc"><div class='inline'>
|
|
452
|
+
<p>Returns the family name.</p>
|
|
453
|
+
</div></span>
|
|
454
|
+
|
|
455
|
+
</li>
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
<li class="public ">
|
|
459
|
+
<span class="summary_signature">
|
|
460
|
+
|
|
461
|
+
<a href="#id-instance_method" title="#id (instance method)">#<strong>id</strong> ⇒ Object </a>
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
</span>
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
<span class="summary_desc"><div class='inline'>
|
|
476
|
+
<p>Returns an identifier describing this component.</p>
|
|
477
|
+
</div></span>
|
|
478
|
+
|
|
479
|
+
</li>
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
<li class="public ">
|
|
483
|
+
<span class="summary_signature">
|
|
484
|
+
|
|
485
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(parent_comp = nil, index: 0, **comp_opts) ⇒ Component </a>
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+
|
|
489
|
+
</span>
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+
<span class="note title constructor">constructor</span>
|
|
493
|
+
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+
<span class="summary_desc"><div class='inline'>
|
|
502
|
+
<p>A new instance of Component.</p>
|
|
503
|
+
</div></span>
|
|
504
|
+
|
|
505
|
+
</li>
|
|
506
|
+
|
|
507
|
+
|
|
508
|
+
<li class="public ">
|
|
509
|
+
<span class="summary_signature">
|
|
510
|
+
|
|
511
|
+
<a href="#inspect-instance_method" title="#inspect (instance method)">#<strong>inspect</strong> ⇒ Object </a>
|
|
512
|
+
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
</span>
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
|
|
523
|
+
|
|
524
|
+
|
|
525
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
526
|
+
|
|
527
|
+
</li>
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
<li class="public ">
|
|
531
|
+
<span class="summary_signature">
|
|
532
|
+
|
|
533
|
+
<a href="#param_name-instance_method" title="#param_name (instance method)">#<strong>param_name</strong>(unprefixed_param_name) ⇒ Object </a>
|
|
534
|
+
|
|
535
|
+
|
|
536
|
+
|
|
537
|
+
</span>
|
|
538
|
+
|
|
539
|
+
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
|
|
544
|
+
|
|
545
|
+
|
|
546
|
+
|
|
547
|
+
<span class="summary_desc"><div class='inline'>
|
|
548
|
+
<p>Given an unprefixed name of a param, adds the path hash Do not overwrite.</p>
|
|
549
|
+
</div></span>
|
|
550
|
+
|
|
551
|
+
</li>
|
|
552
|
+
|
|
553
|
+
|
|
554
|
+
<li class="public ">
|
|
555
|
+
<span class="summary_signature">
|
|
556
|
+
|
|
557
|
+
<a href="#path-instance_method" title="#path (instance method)">#<strong>path</strong> ⇒ Object </a>
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
</span>
|
|
562
|
+
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
|
|
566
|
+
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
<span class="summary_desc"><div class='inline'>
|
|
572
|
+
<p>Returns the id path from the root_comp.</p>
|
|
573
|
+
</div></span>
|
|
574
|
+
|
|
575
|
+
</li>
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
<li class="public ">
|
|
579
|
+
<span class="summary_signature">
|
|
580
|
+
|
|
581
|
+
<a href="#path_hash-instance_method" title="#path_hash (instance method)">#<strong>path_hash</strong> ⇒ Object </a>
|
|
582
|
+
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
</span>
|
|
586
|
+
|
|
587
|
+
|
|
588
|
+
|
|
589
|
+
|
|
590
|
+
|
|
591
|
+
|
|
592
|
+
|
|
593
|
+
|
|
594
|
+
|
|
595
|
+
<span class="summary_desc"><div class='inline'>
|
|
596
|
+
<p>Returns a hash for the path.</p>
|
|
597
|
+
</div></span>
|
|
598
|
+
|
|
599
|
+
</li>
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
<li class="public ">
|
|
603
|
+
<span class="summary_signature">
|
|
604
|
+
|
|
605
|
+
<a href="#render-instance_method" title="#render (instance method)">#<strong>render</strong>(controller, standalone: false, **locals) ⇒ Object </a>
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
|
|
609
|
+
</span>
|
|
610
|
+
|
|
611
|
+
|
|
612
|
+
|
|
613
|
+
|
|
614
|
+
|
|
615
|
+
|
|
616
|
+
|
|
617
|
+
|
|
618
|
+
|
|
619
|
+
<span class="summary_desc"><div class='inline'>
|
|
620
|
+
<p>Renders the component using the controller passsed to it and returns it as a string.</p>
|
|
621
|
+
</div></span>
|
|
622
|
+
|
|
623
|
+
</li>
|
|
624
|
+
|
|
625
|
+
|
|
626
|
+
<li class="public ">
|
|
627
|
+
<span class="summary_signature">
|
|
628
|
+
|
|
629
|
+
<a href="#render_actions-instance_method" title="#render_actions (instance method)">#<strong>render_actions</strong>(controller, wrapper_class: '', action_class: '') ⇒ Object </a>
|
|
630
|
+
|
|
631
|
+
|
|
632
|
+
|
|
633
|
+
</span>
|
|
634
|
+
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
|
|
641
|
+
|
|
642
|
+
|
|
643
|
+
<span class="summary_desc"><div class='inline'>
|
|
644
|
+
<p>Used to render all actions of this component, each button wrapped in a div with the specified class.</p>
|
|
645
|
+
</div></span>
|
|
646
|
+
|
|
647
|
+
</li>
|
|
648
|
+
|
|
649
|
+
|
|
650
|
+
<li class="public ">
|
|
651
|
+
<span class="summary_signature">
|
|
652
|
+
|
|
653
|
+
<a href="#resourceful%3F-instance_method" title="#resourceful? (instance method)">#<strong>resourceful?</strong> ⇒ Boolean </a>
|
|
654
|
+
|
|
655
|
+
|
|
656
|
+
|
|
657
|
+
</span>
|
|
658
|
+
|
|
659
|
+
|
|
660
|
+
|
|
661
|
+
|
|
662
|
+
|
|
663
|
+
|
|
664
|
+
|
|
665
|
+
|
|
666
|
+
|
|
667
|
+
<span class="summary_desc"><div class='inline'>
|
|
668
|
+
<p>Is true for resourceful components.</p>
|
|
669
|
+
</div></span>
|
|
670
|
+
|
|
671
|
+
</li>
|
|
672
|
+
|
|
673
|
+
|
|
674
|
+
<li class="public ">
|
|
675
|
+
<span class="summary_signature">
|
|
676
|
+
|
|
677
|
+
<a href="#root_comp-instance_method" title="#root_comp (instance method)">#<strong>root_comp</strong> ⇒ Object </a>
|
|
678
|
+
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
</span>
|
|
682
|
+
|
|
683
|
+
|
|
684
|
+
|
|
685
|
+
|
|
686
|
+
|
|
687
|
+
|
|
688
|
+
|
|
689
|
+
|
|
690
|
+
|
|
691
|
+
<span class="summary_desc"><div class='inline'>
|
|
692
|
+
<p>Returns the current root comp.</p>
|
|
693
|
+
</div></span>
|
|
694
|
+
|
|
695
|
+
</li>
|
|
696
|
+
|
|
697
|
+
|
|
698
|
+
<li class="public ">
|
|
699
|
+
<span class="summary_signature">
|
|
700
|
+
|
|
701
|
+
<a href="#root_comp%3F-instance_method" title="#root_comp? (instance method)">#<strong>root_comp?</strong> ⇒ Boolean </a>
|
|
702
|
+
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
</span>
|
|
706
|
+
|
|
707
|
+
|
|
708
|
+
|
|
709
|
+
|
|
710
|
+
|
|
711
|
+
|
|
712
|
+
|
|
713
|
+
|
|
714
|
+
|
|
715
|
+
<span class="summary_desc"><div class='inline'>
|
|
716
|
+
<p>Returns whether or not this is the root comp.</p>
|
|
717
|
+
</div></span>
|
|
718
|
+
|
|
719
|
+
</li>
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
<li class="public ">
|
|
723
|
+
<span class="summary_signature">
|
|
724
|
+
|
|
725
|
+
<a href="#skip_action-instance_method" title="#skip_action (instance method)">#<strong>skip_action</strong>(action_name) ⇒ Object </a>
|
|
726
|
+
|
|
727
|
+
|
|
728
|
+
|
|
729
|
+
</span>
|
|
730
|
+
|
|
731
|
+
|
|
732
|
+
|
|
733
|
+
|
|
734
|
+
|
|
735
|
+
|
|
736
|
+
|
|
737
|
+
|
|
738
|
+
|
|
739
|
+
<span class="summary_desc"><div class='inline'>
|
|
740
|
+
<p>DSL method Marks an action for skip.</p>
|
|
741
|
+
</div></span>
|
|
742
|
+
|
|
743
|
+
</li>
|
|
744
|
+
|
|
745
|
+
|
|
746
|
+
<li class="public ">
|
|
747
|
+
<span class="summary_signature">
|
|
748
|
+
|
|
749
|
+
<a href="#sub_comp-instance_method" title="#sub_comp (instance method)">#<strong>sub_comp</strong>(component_class, **comp_opts) ⇒ Object </a>
|
|
750
|
+
|
|
751
|
+
|
|
752
|
+
|
|
753
|
+
</span>
|
|
754
|
+
|
|
755
|
+
|
|
756
|
+
|
|
757
|
+
|
|
758
|
+
|
|
759
|
+
|
|
760
|
+
|
|
761
|
+
|
|
762
|
+
|
|
763
|
+
<span class="summary_desc"><div class='inline'>
|
|
764
|
+
<p>Instanciate a component with <code>self</code> as a parent.</p>
|
|
765
|
+
</div></span>
|
|
766
|
+
|
|
767
|
+
</li>
|
|
768
|
+
|
|
769
|
+
|
|
770
|
+
</ul>
|
|
771
|
+
|
|
772
|
+
|
|
773
|
+
<div id="constructor_details" class="method_details_list">
|
|
774
|
+
<h2>Constructor Details</h2>
|
|
775
|
+
|
|
776
|
+
<div class="method_details first">
|
|
777
|
+
<h3 class="signature first" id="initialize-instance_method">
|
|
778
|
+
|
|
779
|
+
#<strong>initialize</strong>(parent_comp = nil, index: 0, **comp_opts) ⇒ <tt><span class='object_link'><a href="" title="Compony::Component (class)">Component</a></span></tt>
|
|
780
|
+
|
|
781
|
+
|
|
782
|
+
|
|
783
|
+
|
|
784
|
+
|
|
785
|
+
</h3><div class="docstring">
|
|
786
|
+
<div class="discussion">
|
|
787
|
+
|
|
788
|
+
<p>Returns a new instance of Component.</p>
|
|
789
|
+
|
|
790
|
+
|
|
791
|
+
</div>
|
|
792
|
+
</div>
|
|
793
|
+
<div class="tags">
|
|
794
|
+
|
|
795
|
+
|
|
796
|
+
</div><table class="source_code">
|
|
797
|
+
<tr>
|
|
798
|
+
<td>
|
|
799
|
+
<pre class="lines">
|
|
800
|
+
|
|
801
|
+
|
|
802
|
+
22
|
|
803
|
+
23
|
|
804
|
+
24
|
|
805
|
+
25
|
|
806
|
+
26
|
|
807
|
+
27
|
|
808
|
+
28
|
|
809
|
+
29
|
|
810
|
+
30
|
|
811
|
+
31
|
|
812
|
+
32
|
|
813
|
+
33
|
|
814
|
+
34
|
|
815
|
+
35
|
|
816
|
+
36
|
|
817
|
+
37
|
|
818
|
+
38
|
|
819
|
+
39
|
|
820
|
+
40</pre>
|
|
821
|
+
</td>
|
|
822
|
+
<td>
|
|
823
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 22</span>
|
|
824
|
+
|
|
825
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_parent_comp'>parent_comp</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>index:</span> <span class='int'>0</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_comp_opts'>comp_opts</span><span class='rparen'>)</span>
|
|
826
|
+
<span class='ivar'>@parent_comp</span> <span class='op'>=</span> <span class='id identifier rubyid_parent_comp'>parent_comp</span>
|
|
827
|
+
<span class='ivar'>@sub_comps</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
|
828
|
+
<span class='ivar'>@index</span> <span class='op'>=</span> <span class='id identifier rubyid_index'>index</span>
|
|
829
|
+
<span class='ivar'>@comp_opts</span> <span class='op'>=</span> <span class='id identifier rubyid_comp_opts'>comp_opts</span>
|
|
830
|
+
<span class='ivar'>@before_render_block</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
|
831
|
+
<span class='ivar'>@content_blocks</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
|
832
|
+
<span class='ivar'>@actions</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
|
833
|
+
<span class='ivar'>@skipped_actions</span> <span class='op'>=</span> <span class='const'>Set</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
|
834
|
+
|
|
835
|
+
<span class='id identifier rubyid_init_standalone'>init_standalone</span>
|
|
836
|
+
<span class='id identifier rubyid_init_labelling'>init_labelling</span>
|
|
837
|
+
|
|
838
|
+
<span class='id identifier rubyid_fail'>fail</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'> is missing a call to `setup`.</span><span class='tstring_end'>"</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_setup_blocks'>setup_blocks</span><span class='op'>&.</span><span class='id identifier rubyid_any?'>any?</span>
|
|
839
|
+
|
|
840
|
+
<span class='id identifier rubyid_setup_blocks'>setup_blocks</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_setup_block'>setup_block</span><span class='op'>|</span>
|
|
841
|
+
<span class='id identifier rubyid_instance_exec'>instance_exec</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_setup_block'>setup_block</span><span class='rparen'>)</span>
|
|
842
|
+
<span class='kw'>end</span>
|
|
843
|
+
<span class='kw'>end</span></pre>
|
|
844
|
+
</td>
|
|
845
|
+
</tr>
|
|
846
|
+
</table>
|
|
847
|
+
</div>
|
|
848
|
+
|
|
849
|
+
</div>
|
|
850
|
+
|
|
851
|
+
<div id="instance_attr_details" class="attr_details">
|
|
852
|
+
<h2>Instance Attribute Details</h2>
|
|
853
|
+
|
|
854
|
+
|
|
855
|
+
<span id=""></span>
|
|
856
|
+
<div class="method_details first">
|
|
857
|
+
<h3 class="signature first" id="comp_opts-instance_method">
|
|
858
|
+
|
|
859
|
+
#<strong>comp_opts</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
|
860
|
+
|
|
861
|
+
|
|
862
|
+
|
|
863
|
+
|
|
864
|
+
|
|
865
|
+
</h3><div class="docstring">
|
|
866
|
+
<div class="discussion">
|
|
867
|
+
|
|
868
|
+
|
|
869
|
+
</div>
|
|
870
|
+
</div>
|
|
871
|
+
<div class="tags">
|
|
872
|
+
|
|
873
|
+
|
|
874
|
+
</div><table class="source_code">
|
|
875
|
+
<tr>
|
|
876
|
+
<td>
|
|
877
|
+
<pre class="lines">
|
|
878
|
+
|
|
879
|
+
|
|
880
|
+
9
|
|
881
|
+
10
|
|
882
|
+
11</pre>
|
|
883
|
+
</td>
|
|
884
|
+
<td>
|
|
885
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 9</span>
|
|
886
|
+
|
|
887
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_comp_opts'>comp_opts</span>
|
|
888
|
+
<span class='ivar'>@comp_opts</span>
|
|
889
|
+
<span class='kw'>end</span></pre>
|
|
890
|
+
</td>
|
|
891
|
+
</tr>
|
|
892
|
+
</table>
|
|
893
|
+
</div>
|
|
894
|
+
|
|
895
|
+
|
|
896
|
+
<span id=""></span>
|
|
897
|
+
<div class="method_details ">
|
|
898
|
+
<h3 class="signature " id="parent_comp-instance_method">
|
|
899
|
+
|
|
900
|
+
#<strong>parent_comp</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
|
901
|
+
|
|
902
|
+
|
|
903
|
+
|
|
904
|
+
|
|
905
|
+
|
|
906
|
+
</h3><div class="docstring">
|
|
907
|
+
<div class="discussion">
|
|
908
|
+
|
|
909
|
+
|
|
910
|
+
</div>
|
|
911
|
+
</div>
|
|
912
|
+
<div class="tags">
|
|
913
|
+
|
|
914
|
+
|
|
915
|
+
</div><table class="source_code">
|
|
916
|
+
<tr>
|
|
917
|
+
<td>
|
|
918
|
+
<pre class="lines">
|
|
919
|
+
|
|
920
|
+
|
|
921
|
+
8
|
|
922
|
+
9
|
|
923
|
+
10</pre>
|
|
924
|
+
</td>
|
|
925
|
+
<td>
|
|
926
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 8</span>
|
|
927
|
+
|
|
928
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_parent_comp'>parent_comp</span>
|
|
929
|
+
<span class='ivar'>@parent_comp</span>
|
|
930
|
+
<span class='kw'>end</span></pre>
|
|
931
|
+
</td>
|
|
932
|
+
</tr>
|
|
933
|
+
</table>
|
|
934
|
+
</div>
|
|
935
|
+
|
|
936
|
+
</div>
|
|
937
|
+
|
|
938
|
+
|
|
939
|
+
<div id="class_method_details" class="method_details_list">
|
|
940
|
+
<h2>Class Method Details</h2>
|
|
941
|
+
|
|
942
|
+
|
|
943
|
+
<div class="method_details first">
|
|
944
|
+
<h3 class="signature first" id="setup-class_method">
|
|
945
|
+
|
|
946
|
+
.<strong>setup</strong>(&block) ⇒ <tt>Object</tt>
|
|
947
|
+
|
|
948
|
+
|
|
949
|
+
|
|
950
|
+
|
|
951
|
+
|
|
952
|
+
</h3><div class="docstring">
|
|
953
|
+
<div class="discussion">
|
|
954
|
+
|
|
955
|
+
<p>DSL method</p>
|
|
956
|
+
|
|
957
|
+
|
|
958
|
+
</div>
|
|
959
|
+
</div>
|
|
960
|
+
<div class="tags">
|
|
961
|
+
|
|
962
|
+
|
|
963
|
+
</div><table class="source_code">
|
|
964
|
+
<tr>
|
|
965
|
+
<td>
|
|
966
|
+
<pre class="lines">
|
|
967
|
+
|
|
968
|
+
|
|
969
|
+
15
|
|
970
|
+
16
|
|
971
|
+
17
|
|
972
|
+
18
|
|
973
|
+
19
|
|
974
|
+
20</pre>
|
|
975
|
+
</td>
|
|
976
|
+
<td>
|
|
977
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 15</span>
|
|
978
|
+
|
|
979
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup'>setup</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
|
980
|
+
<span class='id identifier rubyid_fail'>fail</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>`setup` expects a block 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_block_given?'>block_given?</span>
|
|
981
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_blocks'>setup_blocks</span> <span class='op'>||=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
|
982
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_blocks'>setup_blocks</span> <span class='op'>=</span> <span class='id identifier rubyid_setup_blocks'>setup_blocks</span><span class='period'>.</span><span class='id identifier rubyid_dup'>dup</span> <span class='comment'># This is required to prevent the parent class to see children's setup blocks.
|
|
983
|
+
</span> <span class='id identifier rubyid_setup_blocks'>setup_blocks</span> <span class='op'><<</span> <span class='id identifier rubyid_block'>block</span>
|
|
984
|
+
<span class='kw'>end</span></pre>
|
|
985
|
+
</td>
|
|
986
|
+
</tr>
|
|
987
|
+
</table>
|
|
988
|
+
</div>
|
|
989
|
+
|
|
990
|
+
</div>
|
|
991
|
+
|
|
992
|
+
<div id="instance_method_details" class="method_details_list">
|
|
993
|
+
<h2>Instance Method Details</h2>
|
|
994
|
+
|
|
995
|
+
|
|
996
|
+
<div class="method_details first">
|
|
997
|
+
<h3 class="signature first" id="action-instance_method">
|
|
998
|
+
|
|
999
|
+
#<strong>action</strong>(action_name, before: nil, &block) ⇒ <tt>Object</tt>
|
|
1000
|
+
|
|
1001
|
+
|
|
1002
|
+
|
|
1003
|
+
|
|
1004
|
+
|
|
1005
|
+
</h3><div class="docstring">
|
|
1006
|
+
<div class="discussion">
|
|
1007
|
+
|
|
1008
|
+
<p>DSL method Adds or replaces an action (for action buttons) If before: is specified, will insert the action before the named action. When replacing, an element keeps its position unless before: is specified.</p>
|
|
1009
|
+
|
|
1010
|
+
|
|
1011
|
+
</div>
|
|
1012
|
+
</div>
|
|
1013
|
+
<div class="tags">
|
|
1014
|
+
|
|
1015
|
+
|
|
1016
|
+
</div><table class="source_code">
|
|
1017
|
+
<tr>
|
|
1018
|
+
<td>
|
|
1019
|
+
<pre class="lines">
|
|
1020
|
+
|
|
1021
|
+
|
|
1022
|
+
181
|
|
1023
|
+
182
|
|
1024
|
+
183
|
|
1025
|
+
184
|
|
1026
|
+
185
|
|
1027
|
+
186
|
|
1028
|
+
187
|
|
1029
|
+
188
|
|
1030
|
+
189
|
|
1031
|
+
190
|
|
1032
|
+
191
|
|
1033
|
+
192
|
|
1034
|
+
193
|
|
1035
|
+
194
|
|
1036
|
+
195
|
|
1037
|
+
196
|
|
1038
|
+
197
|
|
1039
|
+
198
|
|
1040
|
+
199
|
|
1041
|
+
200
|
|
1042
|
+
201</pre>
|
|
1043
|
+
</td>
|
|
1044
|
+
<td>
|
|
1045
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 181</span>
|
|
1046
|
+
|
|
1047
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_action'>action</span><span class='lparen'>(</span><span class='id identifier rubyid_action_name'>action_name</span><span class='comma'>,</span> <span class='label'>before:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
|
1048
|
+
<span class='id identifier rubyid_action_name'>action_name</span> <span class='op'>=</span> <span class='id identifier rubyid_action_name'>action_name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
|
|
1049
|
+
<span class='id identifier rubyid_before_name'>before_name</span> <span class='op'>=</span> <span class='id identifier rubyid_before'>before</span><span class='op'>&.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
|
|
1050
|
+
<span class='id identifier rubyid_action'>action</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="MethodAccessibleHash.html" title="Compony::MethodAccessibleHash (class)">MethodAccessibleHash</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="MethodAccessibleHash.html#initialize-instance_method" title="Compony::MethodAccessibleHash#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='label'>name:</span> <span class='id identifier rubyid_action_name'>action_name</span><span class='comma'>,</span> <span class='label'>block:</span><span class='rparen'>)</span>
|
|
1051
|
+
|
|
1052
|
+
<span class='id identifier rubyid_existing_index'>existing_index</span> <span class='op'>=</span> <span class='ivar'>@actions</span><span class='period'>.</span><span class='id identifier rubyid_find_index'>find_index</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_el'>el</span><span class='op'>|</span> <span class='id identifier rubyid_el'>el</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span> <span class='op'>==</span> <span class='id identifier rubyid_action_name'>action_name</span> <span class='rbrace'>}</span>
|
|
1053
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_existing_index'>existing_index</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&&</span> <span class='id identifier rubyid_before_name'>before_name</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
|
|
1054
|
+
<span class='ivar'>@actions</span><span class='period'>.</span><span class='id identifier rubyid_delete_at'>delete_at</span><span class='lparen'>(</span><span class='id identifier rubyid_existing_index'>existing_index</span><span class='rparen'>)</span> <span class='comment'># Replacing an existing element with a before: directive - must delete before calculating indices
|
|
1055
|
+
</span> <span class='kw'>end</span>
|
|
1056
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_before_name'>before_name</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
|
|
1057
|
+
<span class='id identifier rubyid_before_index'>before_index</span> <span class='op'>=</span> <span class='ivar'>@actions</span><span class='period'>.</span><span class='id identifier rubyid_find_index'>find_index</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_el'>el</span><span class='op'>|</span> <span class='id identifier rubyid_el'>el</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span> <span class='op'>==</span> <span class='id identifier rubyid_before_name'>before_name</span> <span class='rbrace'>}</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'>Action </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_before_name'>before_name</span><span class='embexpr_end'>}</span><span class='tstring_content'> for :before not found 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>
|
|
1058
|
+
<span class='kw'>end</span>
|
|
1059
|
+
|
|
1060
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_before_index'>before_index</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
|
|
1061
|
+
<span class='ivar'>@actions</span><span class='period'>.</span><span class='id identifier rubyid_insert'>insert</span><span class='lparen'>(</span><span class='id identifier rubyid_before_index'>before_index</span><span class='comma'>,</span> <span class='id identifier rubyid_action'>action</span><span class='rparen'>)</span>
|
|
1062
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_existing_index'>existing_index</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
|
|
1063
|
+
<span class='ivar'>@actions</span><span class='lbracket'>[</span><span class='id identifier rubyid_existing_index'>existing_index</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_action'>action</span>
|
|
1064
|
+
<span class='kw'>else</span>
|
|
1065
|
+
<span class='ivar'>@actions</span> <span class='op'><<</span> <span class='id identifier rubyid_action'>action</span>
|
|
1066
|
+
<span class='kw'>end</span>
|
|
1067
|
+
<span class='kw'>end</span></pre>
|
|
1068
|
+
</td>
|
|
1069
|
+
</tr>
|
|
1070
|
+
</table>
|
|
1071
|
+
</div>
|
|
1072
|
+
|
|
1073
|
+
<div class="method_details ">
|
|
1074
|
+
<h3 class="signature " id="add_content-instance_method">
|
|
1075
|
+
|
|
1076
|
+
#<strong>add_content</strong>(index = -1,, &block) ⇒ <tt>Object</tt>
|
|
1077
|
+
|
|
1078
|
+
|
|
1079
|
+
|
|
1080
|
+
|
|
1081
|
+
|
|
1082
|
+
</h3><div class="docstring">
|
|
1083
|
+
<div class="discussion">
|
|
1084
|
+
|
|
1085
|
+
<p>DSL method Adds a content block that will be executed after all previous ones. It is safe to use this method even if <code>content</code> has never been called You can use dyny here.</p>
|
|
1086
|
+
|
|
1087
|
+
|
|
1088
|
+
</div>
|
|
1089
|
+
</div>
|
|
1090
|
+
<div class="tags">
|
|
1091
|
+
|
|
1092
|
+
|
|
1093
|
+
</div><table class="source_code">
|
|
1094
|
+
<tr>
|
|
1095
|
+
<td>
|
|
1096
|
+
<pre class="lines">
|
|
1097
|
+
|
|
1098
|
+
|
|
1099
|
+
141
|
|
1100
|
+
142
|
|
1101
|
+
143
|
|
1102
|
+
144
|
|
1103
|
+
145</pre>
|
|
1104
|
+
</td>
|
|
1105
|
+
<td>
|
|
1106
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 141</span>
|
|
1107
|
+
|
|
1108
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_add_content'>add_content</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span> <span class='op'>=</span> <span class='op'>-</span><span class='int'>1</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
|
1109
|
+
<span class='id identifier rubyid_fail'>fail</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>`content` expects a block 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_block_given?'>block_given?</span>
|
|
1110
|
+
<span class='ivar'>@content_blocks</span> <span class='op'>||=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
|
1111
|
+
<span class='ivar'>@content_blocks</span><span class='period'>.</span><span class='id identifier rubyid_insert'>insert</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='comma'>,</span> <span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
|
1112
|
+
<span class='kw'>end</span></pre>
|
|
1113
|
+
</td>
|
|
1114
|
+
</tr>
|
|
1115
|
+
</table>
|
|
1116
|
+
</div>
|
|
1117
|
+
|
|
1118
|
+
<div class="method_details ">
|
|
1119
|
+
<h3 class="signature " id="before_render-instance_method">
|
|
1120
|
+
|
|
1121
|
+
#<strong>before_render</strong>(&block) ⇒ <tt>Object</tt>
|
|
1122
|
+
|
|
1123
|
+
|
|
1124
|
+
|
|
1125
|
+
|
|
1126
|
+
|
|
1127
|
+
</h3><div class="docstring">
|
|
1128
|
+
<div class="discussion">
|
|
1129
|
+
|
|
1130
|
+
<p>DSL method</p>
|
|
1131
|
+
|
|
1132
|
+
|
|
1133
|
+
</div>
|
|
1134
|
+
</div>
|
|
1135
|
+
<div class="tags">
|
|
1136
|
+
|
|
1137
|
+
|
|
1138
|
+
</div><table class="source_code">
|
|
1139
|
+
<tr>
|
|
1140
|
+
<td>
|
|
1141
|
+
<pre class="lines">
|
|
1142
|
+
|
|
1143
|
+
|
|
1144
|
+
125
|
|
1145
|
+
126
|
|
1146
|
+
127</pre>
|
|
1147
|
+
</td>
|
|
1148
|
+
<td>
|
|
1149
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 125</span>
|
|
1150
|
+
|
|
1151
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_before_render'>before_render</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
|
1152
|
+
<span class='ivar'>@before_render_block</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span>
|
|
1153
|
+
<span class='kw'>end</span></pre>
|
|
1154
|
+
</td>
|
|
1155
|
+
</tr>
|
|
1156
|
+
</table>
|
|
1157
|
+
</div>
|
|
1158
|
+
|
|
1159
|
+
<div class="method_details ">
|
|
1160
|
+
<h3 class="signature " id="comp_class_for-instance_method">
|
|
1161
|
+
|
|
1162
|
+
#<strong>comp_class_for</strong> ⇒ <tt>Object</tt>
|
|
1163
|
+
|
|
1164
|
+
|
|
1165
|
+
|
|
1166
|
+
|
|
1167
|
+
|
|
1168
|
+
</h3><div class="docstring">
|
|
1169
|
+
<div class="discussion">
|
|
1170
|
+
|
|
1171
|
+
<div class="note todo">
|
|
1172
|
+
<strong>TODO:</strong>
|
|
1173
|
+
<div class='inline'>
|
|
1174
|
+
<p>deprecate (check for usages beforehand)</p>
|
|
1175
|
+
</div>
|
|
1176
|
+
</div>
|
|
1177
|
+
|
|
1178
|
+
|
|
1179
|
+
|
|
1180
|
+
</div>
|
|
1181
|
+
</div>
|
|
1182
|
+
<div class="tags">
|
|
1183
|
+
|
|
1184
|
+
|
|
1185
|
+
</div><table class="source_code">
|
|
1186
|
+
<tr>
|
|
1187
|
+
<td>
|
|
1188
|
+
<pre class="lines">
|
|
1189
|
+
|
|
1190
|
+
|
|
1191
|
+
115
|
|
1192
|
+
116
|
|
1193
|
+
117</pre>
|
|
1194
|
+
</td>
|
|
1195
|
+
<td>
|
|
1196
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 115</span>
|
|
1197
|
+
|
|
1198
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_comp_class_for'>comp_class_for</span><span class='lparen'>(</span><span class='op'>...</span><span class='rparen'>)</span>
|
|
1199
|
+
<span class='const'><span class='object_link'><a href="../Compony.html" title="Compony (module)">Compony</a></span></span><span class='period'>.</span><span class='id identifier rubyid_comp_class_for'><span class='object_link'><a href="../Compony.html#comp_class_for-class_method" title="Compony.comp_class_for (method)">comp_class_for</a></span></span><span class='lparen'>(</span><span class='op'>...</span><span class='rparen'>)</span>
|
|
1200
|
+
<span class='kw'>end</span></pre>
|
|
1201
|
+
</td>
|
|
1202
|
+
</tr>
|
|
1203
|
+
</table>
|
|
1204
|
+
</div>
|
|
1205
|
+
|
|
1206
|
+
<div class="method_details ">
|
|
1207
|
+
<h3 class="signature " id="comp_class_for!-instance_method">
|
|
1208
|
+
|
|
1209
|
+
#<strong>comp_class_for!</strong> ⇒ <tt>Object</tt>
|
|
1210
|
+
|
|
1211
|
+
|
|
1212
|
+
|
|
1213
|
+
|
|
1214
|
+
|
|
1215
|
+
</h3><div class="docstring">
|
|
1216
|
+
<div class="discussion">
|
|
1217
|
+
|
|
1218
|
+
<div class="note todo">
|
|
1219
|
+
<strong>TODO:</strong>
|
|
1220
|
+
<div class='inline'>
|
|
1221
|
+
<p>deprecate (check for usages beforehand)</p>
|
|
1222
|
+
</div>
|
|
1223
|
+
</div>
|
|
1224
|
+
|
|
1225
|
+
|
|
1226
|
+
|
|
1227
|
+
</div>
|
|
1228
|
+
</div>
|
|
1229
|
+
<div class="tags">
|
|
1230
|
+
|
|
1231
|
+
|
|
1232
|
+
</div><table class="source_code">
|
|
1233
|
+
<tr>
|
|
1234
|
+
<td>
|
|
1235
|
+
<pre class="lines">
|
|
1236
|
+
|
|
1237
|
+
|
|
1238
|
+
120
|
|
1239
|
+
121
|
|
1240
|
+
122</pre>
|
|
1241
|
+
</td>
|
|
1242
|
+
<td>
|
|
1243
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 120</span>
|
|
1244
|
+
|
|
1245
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_comp_class_for!'>comp_class_for!</span><span class='lparen'>(</span><span class='op'>...</span><span class='rparen'>)</span>
|
|
1246
|
+
<span class='const'><span class='object_link'><a href="../Compony.html" title="Compony (module)">Compony</a></span></span><span class='period'>.</span><span class='id identifier rubyid_comp_class_for!'><span class='object_link'><a href="../Compony.html#comp_class_for!-class_method" title="Compony.comp_class_for! (method)">comp_class_for!</a></span></span><span class='lparen'>(</span><span class='op'>...</span><span class='rparen'>)</span>
|
|
1247
|
+
<span class='kw'>end</span></pre>
|
|
1248
|
+
</td>
|
|
1249
|
+
</tr>
|
|
1250
|
+
</table>
|
|
1251
|
+
</div>
|
|
1252
|
+
|
|
1253
|
+
<div class="method_details ">
|
|
1254
|
+
<h3 class="signature " id="comp_cst-instance_method">
|
|
1255
|
+
|
|
1256
|
+
#<strong>comp_cst</strong> ⇒ <tt>Object</tt>
|
|
1257
|
+
|
|
1258
|
+
|
|
1259
|
+
|
|
1260
|
+
|
|
1261
|
+
|
|
1262
|
+
</h3><div class="docstring">
|
|
1263
|
+
<div class="discussion">
|
|
1264
|
+
|
|
1265
|
+
<p>Returns the name of the class constant of this component. Do not override.</p>
|
|
1266
|
+
|
|
1267
|
+
|
|
1268
|
+
</div>
|
|
1269
|
+
</div>
|
|
1270
|
+
<div class="tags">
|
|
1271
|
+
|
|
1272
|
+
|
|
1273
|
+
</div><table class="source_code">
|
|
1274
|
+
<tr>
|
|
1275
|
+
<td>
|
|
1276
|
+
<pre class="lines">
|
|
1277
|
+
|
|
1278
|
+
|
|
1279
|
+
105
|
|
1280
|
+
106
|
|
1281
|
+
107</pre>
|
|
1282
|
+
</td>
|
|
1283
|
+
<td>
|
|
1284
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 105</span>
|
|
1285
|
+
|
|
1286
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_comp_cst'>comp_cst</span>
|
|
1287
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_demodulize'>demodulize</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
|
|
1288
|
+
<span class='kw'>end</span></pre>
|
|
1289
|
+
</td>
|
|
1290
|
+
</tr>
|
|
1291
|
+
</table>
|
|
1292
|
+
</div>
|
|
1293
|
+
|
|
1294
|
+
<div class="method_details ">
|
|
1295
|
+
<h3 class="signature " id="comp_name-instance_method">
|
|
1296
|
+
|
|
1297
|
+
#<strong>comp_name</strong> ⇒ <tt>Object</tt>
|
|
1298
|
+
|
|
1299
|
+
|
|
1300
|
+
|
|
1301
|
+
|
|
1302
|
+
|
|
1303
|
+
</h3><div class="docstring">
|
|
1304
|
+
<div class="discussion">
|
|
1305
|
+
|
|
1306
|
+
<p>Returns the component name</p>
|
|
1307
|
+
|
|
1308
|
+
|
|
1309
|
+
</div>
|
|
1310
|
+
</div>
|
|
1311
|
+
<div class="tags">
|
|
1312
|
+
|
|
1313
|
+
|
|
1314
|
+
</div><table class="source_code">
|
|
1315
|
+
<tr>
|
|
1316
|
+
<td>
|
|
1317
|
+
<pre class="lines">
|
|
1318
|
+
|
|
1319
|
+
|
|
1320
|
+
110
|
|
1321
|
+
111
|
|
1322
|
+
112</pre>
|
|
1323
|
+
</td>
|
|
1324
|
+
<td>
|
|
1325
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 110</span>
|
|
1326
|
+
|
|
1327
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_comp_name'>comp_name</span>
|
|
1328
|
+
<span class='id identifier rubyid_comp_cst'>comp_cst</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_underscore'>underscore</span>
|
|
1329
|
+
<span class='kw'>end</span></pre>
|
|
1330
|
+
</td>
|
|
1331
|
+
</tr>
|
|
1332
|
+
</table>
|
|
1333
|
+
</div>
|
|
1334
|
+
|
|
1335
|
+
<div class="method_details ">
|
|
1336
|
+
<h3 class="signature " id="content-instance_method">
|
|
1337
|
+
|
|
1338
|
+
#<strong>content</strong>(&block) ⇒ <tt>Object</tt>
|
|
1339
|
+
|
|
1340
|
+
|
|
1341
|
+
|
|
1342
|
+
|
|
1343
|
+
|
|
1344
|
+
</h3><div class="docstring">
|
|
1345
|
+
<div class="discussion">
|
|
1346
|
+
|
|
1347
|
+
<p>DSL method Overrides previous content (also from superclasses). Will be the first content block to run. You can use dyny here.</p>
|
|
1348
|
+
|
|
1349
|
+
|
|
1350
|
+
</div>
|
|
1351
|
+
</div>
|
|
1352
|
+
<div class="tags">
|
|
1353
|
+
|
|
1354
|
+
|
|
1355
|
+
</div><table class="source_code">
|
|
1356
|
+
<tr>
|
|
1357
|
+
<td>
|
|
1358
|
+
<pre class="lines">
|
|
1359
|
+
|
|
1360
|
+
|
|
1361
|
+
132
|
|
1362
|
+
133
|
|
1363
|
+
134
|
|
1364
|
+
135</pre>
|
|
1365
|
+
</td>
|
|
1366
|
+
<td>
|
|
1367
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 132</span>
|
|
1368
|
+
|
|
1369
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_content'>content</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
|
1370
|
+
<span class='id identifier rubyid_fail'>fail</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>`content` expects a block 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_block_given?'>block_given?</span>
|
|
1371
|
+
<span class='ivar'>@content_blocks</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_block'>block</span><span class='rbracket'>]</span>
|
|
1372
|
+
<span class='kw'>end</span></pre>
|
|
1373
|
+
</td>
|
|
1374
|
+
</tr>
|
|
1375
|
+
</table>
|
|
1376
|
+
</div>
|
|
1377
|
+
|
|
1378
|
+
<div class="method_details ">
|
|
1379
|
+
<h3 class="signature " id="family_cst-instance_method">
|
|
1380
|
+
|
|
1381
|
+
#<strong>family_cst</strong> ⇒ <tt>Object</tt>
|
|
1382
|
+
|
|
1383
|
+
|
|
1384
|
+
|
|
1385
|
+
|
|
1386
|
+
|
|
1387
|
+
</h3><div class="docstring">
|
|
1388
|
+
<div class="discussion">
|
|
1389
|
+
|
|
1390
|
+
<p>Returns the name of the module constant (=family) of this component. Do not override.</p>
|
|
1391
|
+
|
|
1392
|
+
|
|
1393
|
+
</div>
|
|
1394
|
+
</div>
|
|
1395
|
+
<div class="tags">
|
|
1396
|
+
|
|
1397
|
+
|
|
1398
|
+
</div><table class="source_code">
|
|
1399
|
+
<tr>
|
|
1400
|
+
<td>
|
|
1401
|
+
<pre class="lines">
|
|
1402
|
+
|
|
1403
|
+
|
|
1404
|
+
95
|
|
1405
|
+
96
|
|
1406
|
+
97</pre>
|
|
1407
|
+
</td>
|
|
1408
|
+
<td>
|
|
1409
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 95</span>
|
|
1410
|
+
|
|
1411
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_family_cst'>family_cst</span>
|
|
1412
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_module_parent'>module_parent</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_demodulize'>demodulize</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
|
|
1413
|
+
<span class='kw'>end</span></pre>
|
|
1414
|
+
</td>
|
|
1415
|
+
</tr>
|
|
1416
|
+
</table>
|
|
1417
|
+
</div>
|
|
1418
|
+
|
|
1419
|
+
<div class="method_details ">
|
|
1420
|
+
<h3 class="signature " id="family_name-instance_method">
|
|
1421
|
+
|
|
1422
|
+
#<strong>family_name</strong> ⇒ <tt>Object</tt>
|
|
1423
|
+
|
|
1424
|
+
|
|
1425
|
+
|
|
1426
|
+
|
|
1427
|
+
|
|
1428
|
+
</h3><div class="docstring">
|
|
1429
|
+
<div class="discussion">
|
|
1430
|
+
|
|
1431
|
+
<p>Returns the family name</p>
|
|
1432
|
+
|
|
1433
|
+
|
|
1434
|
+
</div>
|
|
1435
|
+
</div>
|
|
1436
|
+
<div class="tags">
|
|
1437
|
+
|
|
1438
|
+
|
|
1439
|
+
</div><table class="source_code">
|
|
1440
|
+
<tr>
|
|
1441
|
+
<td>
|
|
1442
|
+
<pre class="lines">
|
|
1443
|
+
|
|
1444
|
+
|
|
1445
|
+
100
|
|
1446
|
+
101
|
|
1447
|
+
102</pre>
|
|
1448
|
+
</td>
|
|
1449
|
+
<td>
|
|
1450
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 100</span>
|
|
1451
|
+
|
|
1452
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_family_name'>family_name</span>
|
|
1453
|
+
<span class='id identifier rubyid_family_cst'>family_cst</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_underscore'>underscore</span>
|
|
1454
|
+
<span class='kw'>end</span></pre>
|
|
1455
|
+
</td>
|
|
1456
|
+
</tr>
|
|
1457
|
+
</table>
|
|
1458
|
+
</div>
|
|
1459
|
+
|
|
1460
|
+
<div class="method_details ">
|
|
1461
|
+
<h3 class="signature " id="id-instance_method">
|
|
1462
|
+
|
|
1463
|
+
#<strong>id</strong> ⇒ <tt>Object</tt>
|
|
1464
|
+
|
|
1465
|
+
|
|
1466
|
+
|
|
1467
|
+
|
|
1468
|
+
|
|
1469
|
+
</h3><div class="docstring">
|
|
1470
|
+
<div class="discussion">
|
|
1471
|
+
|
|
1472
|
+
<p>Returns an identifier describing this component. Must be unique among simplings under the same parent_comp. Do not override.</p>
|
|
1473
|
+
|
|
1474
|
+
|
|
1475
|
+
</div>
|
|
1476
|
+
</div>
|
|
1477
|
+
<div class="tags">
|
|
1478
|
+
|
|
1479
|
+
|
|
1480
|
+
</div><table class="source_code">
|
|
1481
|
+
<tr>
|
|
1482
|
+
<td>
|
|
1483
|
+
<pre class="lines">
|
|
1484
|
+
|
|
1485
|
+
|
|
1486
|
+
61
|
|
1487
|
+
62
|
|
1488
|
+
63</pre>
|
|
1489
|
+
</td>
|
|
1490
|
+
<td>
|
|
1491
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 61</span>
|
|
1492
|
+
|
|
1493
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_id'>id</span>
|
|
1494
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_family_name'>family_name</span><span class='embexpr_end'>}</span><span class='tstring_content'>_</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_comp_name'>comp_name</span><span class='embexpr_end'>}</span><span class='tstring_content'>_</span><span class='embexpr_beg'>#{</span><span class='ivar'>@index</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
|
1495
|
+
<span class='kw'>end</span></pre>
|
|
1496
|
+
</td>
|
|
1497
|
+
</tr>
|
|
1498
|
+
</table>
|
|
1499
|
+
</div>
|
|
1500
|
+
|
|
1501
|
+
<div class="method_details ">
|
|
1502
|
+
<h3 class="signature " id="inspect-instance_method">
|
|
1503
|
+
|
|
1504
|
+
#<strong>inspect</strong> ⇒ <tt>Object</tt>
|
|
1505
|
+
|
|
1506
|
+
|
|
1507
|
+
|
|
1508
|
+
|
|
1509
|
+
|
|
1510
|
+
</h3><div class="docstring">
|
|
1511
|
+
<div class="discussion">
|
|
1512
|
+
|
|
1513
|
+
|
|
1514
|
+
</div>
|
|
1515
|
+
</div>
|
|
1516
|
+
<div class="tags">
|
|
1517
|
+
|
|
1518
|
+
|
|
1519
|
+
</div><table class="source_code">
|
|
1520
|
+
<tr>
|
|
1521
|
+
<td>
|
|
1522
|
+
<pre class="lines">
|
|
1523
|
+
|
|
1524
|
+
|
|
1525
|
+
42
|
|
1526
|
+
43
|
|
1527
|
+
44</pre>
|
|
1528
|
+
</td>
|
|
1529
|
+
<td>
|
|
1530
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 42</span>
|
|
1531
|
+
|
|
1532
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_inspect'>inspect</span>
|
|
1533
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>#<</span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_content'>:</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_hash'>hash</span><span class='embexpr_end'>}</span><span class='tstring_content'>></span><span class='tstring_end'>"</span></span>
|
|
1534
|
+
<span class='kw'>end</span></pre>
|
|
1535
|
+
</td>
|
|
1536
|
+
</tr>
|
|
1537
|
+
</table>
|
|
1538
|
+
</div>
|
|
1539
|
+
|
|
1540
|
+
<div class="method_details ">
|
|
1541
|
+
<h3 class="signature " id="param_name-instance_method">
|
|
1542
|
+
|
|
1543
|
+
#<strong>param_name</strong>(unprefixed_param_name) ⇒ <tt>Object</tt>
|
|
1544
|
+
|
|
1545
|
+
|
|
1546
|
+
|
|
1547
|
+
|
|
1548
|
+
|
|
1549
|
+
</h3><div class="docstring">
|
|
1550
|
+
<div class="discussion">
|
|
1551
|
+
|
|
1552
|
+
<p>Given an unprefixed name of a param, adds the path hash Do not overwrite.</p>
|
|
1553
|
+
|
|
1554
|
+
|
|
1555
|
+
</div>
|
|
1556
|
+
</div>
|
|
1557
|
+
<div class="tags">
|
|
1558
|
+
|
|
1559
|
+
|
|
1560
|
+
</div><table class="source_code">
|
|
1561
|
+
<tr>
|
|
1562
|
+
<td>
|
|
1563
|
+
<pre class="lines">
|
|
1564
|
+
|
|
1565
|
+
|
|
1566
|
+
83
|
|
1567
|
+
84
|
|
1568
|
+
85</pre>
|
|
1569
|
+
</td>
|
|
1570
|
+
<td>
|
|
1571
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 83</span>
|
|
1572
|
+
|
|
1573
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_param_name'>param_name</span><span class='lparen'>(</span><span class='id identifier rubyid_unprefixed_param_name'>unprefixed_param_name</span><span class='rparen'>)</span>
|
|
1574
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_path_hash'>path_hash</span><span class='embexpr_end'>}</span><span class='tstring_content'>_</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_unprefixed_param_name'>unprefixed_param_name</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
|
1575
|
+
<span class='kw'>end</span></pre>
|
|
1576
|
+
</td>
|
|
1577
|
+
</tr>
|
|
1578
|
+
</table>
|
|
1579
|
+
</div>
|
|
1580
|
+
|
|
1581
|
+
<div class="method_details ">
|
|
1582
|
+
<h3 class="signature " id="path-instance_method">
|
|
1583
|
+
|
|
1584
|
+
#<strong>path</strong> ⇒ <tt>Object</tt>
|
|
1585
|
+
|
|
1586
|
+
|
|
1587
|
+
|
|
1588
|
+
|
|
1589
|
+
|
|
1590
|
+
</h3><div class="docstring">
|
|
1591
|
+
<div class="discussion">
|
|
1592
|
+
|
|
1593
|
+
<p>Returns the id path from the root_comp. Do not overwrite.</p>
|
|
1594
|
+
|
|
1595
|
+
|
|
1596
|
+
</div>
|
|
1597
|
+
</div>
|
|
1598
|
+
<div class="tags">
|
|
1599
|
+
|
|
1600
|
+
|
|
1601
|
+
</div><table class="source_code">
|
|
1602
|
+
<tr>
|
|
1603
|
+
<td>
|
|
1604
|
+
<pre class="lines">
|
|
1605
|
+
|
|
1606
|
+
|
|
1607
|
+
67
|
|
1608
|
+
68
|
|
1609
|
+
69
|
|
1610
|
+
70
|
|
1611
|
+
71
|
|
1612
|
+
72
|
|
1613
|
+
73</pre>
|
|
1614
|
+
</td>
|
|
1615
|
+
<td>
|
|
1616
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 67</span>
|
|
1617
|
+
|
|
1618
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_path'>path</span>
|
|
1619
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_root_comp?'>root_comp?</span>
|
|
1620
|
+
<span class='id identifier rubyid_id'>id</span>
|
|
1621
|
+
<span class='kw'>else</span>
|
|
1622
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_parent_comp'>parent_comp</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span><span class='embexpr_end'>}</span><span class='tstring_content'>/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_id'>id</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
|
1623
|
+
<span class='kw'>end</span>
|
|
1624
|
+
<span class='kw'>end</span></pre>
|
|
1625
|
+
</td>
|
|
1626
|
+
</tr>
|
|
1627
|
+
</table>
|
|
1628
|
+
</div>
|
|
1629
|
+
|
|
1630
|
+
<div class="method_details ">
|
|
1631
|
+
<h3 class="signature " id="path_hash-instance_method">
|
|
1632
|
+
|
|
1633
|
+
#<strong>path_hash</strong> ⇒ <tt>Object</tt>
|
|
1634
|
+
|
|
1635
|
+
|
|
1636
|
+
|
|
1637
|
+
|
|
1638
|
+
|
|
1639
|
+
</h3><div class="docstring">
|
|
1640
|
+
<div class="discussion">
|
|
1641
|
+
|
|
1642
|
+
<p>Returns a hash for the path. Used for params prefixing. Do not overwrite.</p>
|
|
1643
|
+
|
|
1644
|
+
|
|
1645
|
+
</div>
|
|
1646
|
+
</div>
|
|
1647
|
+
<div class="tags">
|
|
1648
|
+
|
|
1649
|
+
|
|
1650
|
+
</div><table class="source_code">
|
|
1651
|
+
<tr>
|
|
1652
|
+
<td>
|
|
1653
|
+
<pre class="lines">
|
|
1654
|
+
|
|
1655
|
+
|
|
1656
|
+
77
|
|
1657
|
+
78
|
|
1658
|
+
79</pre>
|
|
1659
|
+
</td>
|
|
1660
|
+
<td>
|
|
1661
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 77</span>
|
|
1662
|
+
|
|
1663
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_path_hash'>path_hash</span>
|
|
1664
|
+
<span class='const'>Digest</span><span class='op'>::</span><span class='const'>SHA1</span><span class='period'>.</span><span class='id identifier rubyid_hexdigest'>hexdigest</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='op'>..</span><span class='int'>4</span><span class='rbracket'>]</span>
|
|
1665
|
+
<span class='kw'>end</span></pre>
|
|
1666
|
+
</td>
|
|
1667
|
+
</tr>
|
|
1668
|
+
</table>
|
|
1669
|
+
</div>
|
|
1670
|
+
|
|
1671
|
+
<div class="method_details ">
|
|
1672
|
+
<h3 class="signature " id="render-instance_method">
|
|
1673
|
+
|
|
1674
|
+
#<strong>render</strong>(controller, standalone: false, **locals) ⇒ <tt>Object</tt>
|
|
1675
|
+
|
|
1676
|
+
|
|
1677
|
+
|
|
1678
|
+
|
|
1679
|
+
|
|
1680
|
+
</h3><div class="docstring">
|
|
1681
|
+
<div class="discussion">
|
|
1682
|
+
|
|
1683
|
+
<p>Renders the component using the controller passsed to it and returns it as a string. Do not overwrite.</p>
|
|
1684
|
+
|
|
1685
|
+
|
|
1686
|
+
</div>
|
|
1687
|
+
</div>
|
|
1688
|
+
<div class="tags">
|
|
1689
|
+
<p class="tag_title">Parameters:</p>
|
|
1690
|
+
<ul class="param">
|
|
1691
|
+
|
|
1692
|
+
<li>
|
|
1693
|
+
|
|
1694
|
+
<span class='name'>standalone</span>
|
|
1695
|
+
|
|
1696
|
+
|
|
1697
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
1698
|
+
|
|
1699
|
+
|
|
1700
|
+
<em class="default">(defaults to: <tt>false</tt>)</em>
|
|
1701
|
+
|
|
1702
|
+
|
|
1703
|
+
—
|
|
1704
|
+
<div class='inline'>
|
|
1705
|
+
<p>pass true iff <code>render</code> is called from <code>render_standalone</code></p>
|
|
1706
|
+
</div>
|
|
1707
|
+
|
|
1708
|
+
</li>
|
|
1709
|
+
|
|
1710
|
+
</ul>
|
|
1711
|
+
|
|
1712
|
+
|
|
1713
|
+
</div><table class="source_code">
|
|
1714
|
+
<tr>
|
|
1715
|
+
<td>
|
|
1716
|
+
<pre class="lines">
|
|
1717
|
+
|
|
1718
|
+
|
|
1719
|
+
150
|
|
1720
|
+
151
|
|
1721
|
+
152
|
|
1722
|
+
153
|
|
1723
|
+
154
|
|
1724
|
+
155
|
|
1725
|
+
156
|
|
1726
|
+
157
|
|
1727
|
+
158
|
|
1728
|
+
159
|
|
1729
|
+
160
|
|
1730
|
+
161
|
|
1731
|
+
162
|
|
1732
|
+
163
|
|
1733
|
+
164
|
|
1734
|
+
165
|
|
1735
|
+
166
|
|
1736
|
+
167
|
|
1737
|
+
168
|
|
1738
|
+
169
|
|
1739
|
+
170
|
|
1740
|
+
171
|
|
1741
|
+
172
|
|
1742
|
+
173
|
|
1743
|
+
174
|
|
1744
|
+
175
|
|
1745
|
+
176</pre>
|
|
1746
|
+
</td>
|
|
1747
|
+
<td>
|
|
1748
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 150</span>
|
|
1749
|
+
|
|
1750
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_render'>render</span><span class='lparen'>(</span><span class='id identifier rubyid_controller'>controller</span><span class='comma'>,</span> <span class='label'>standalone:</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_locals'>locals</span><span class='rparen'>)</span>
|
|
1751
|
+
<span class='comment'># Call before_render hook if any and backfire instance variables back to the component
|
|
1752
|
+
</span> <span class='comment'># TODO: Can .request_context be removed from the next line? Test well!
|
|
1753
|
+
</span> <span class='const'><span class='object_link'><a href="RequestContext.html" title="Compony::RequestContext (class)">RequestContext</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="RequestContext.html#initialize-instance_method" title="Compony::RequestContext#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_controller'>controller</span><span class='comma'>,</span> <span class='label'>locals:</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_request_context'><span class='object_link'><a href="RequestContext.html#request_context-instance_method" title="Compony::RequestContext#request_context (method)">request_context</a></span></span><span class='period'>.</span><span class='id identifier rubyid_evaluate_with_backfire'>evaluate_with_backfire</span><span class='lparen'>(</span><span class='op'>&</span><span class='ivar'>@before_render_block</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@before_render_block</span>
|
|
1754
|
+
<span class='comment'># Render, unless before_render has already issued a body (e.g. through redirecting).
|
|
1755
|
+
</span> <span class='kw'>if</span> <span class='id identifier rubyid_controller'>controller</span><span class='period'>.</span><span class='id identifier rubyid_response_body'>response_body</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
|
1756
|
+
<span class='id identifier rubyid_fail'>fail</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'> must define `content` or set a response body in `before_render`</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='ivar'>@content_blocks</span><span class='period'>.</span><span class='id identifier rubyid_none?'>none?</span>
|
|
1757
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_controller'>controller</span><span class='period'>.</span><span class='id identifier rubyid_render_to_string'>render_to_string</span><span class='lparen'>(</span>
|
|
1758
|
+
<span class='label'>type:</span> <span class='symbol'>:dyny</span><span class='comma'>,</span>
|
|
1759
|
+
<span class='label'>locals:</span> <span class='lbrace'>{</span> <span class='label'>content_blocks:</span> <span class='ivar'>@content_blocks</span><span class='comma'>,</span> <span class='label'>standalone:</span><span class='comma'>,</span> <span class='label'>component:</span> <span class='kw'>self</span><span class='comma'>,</span> <span class='label'>render_locals:</span> <span class='id identifier rubyid_locals'>locals</span> <span class='rbrace'>}</span><span class='comma'>,</span>
|
|
1760
|
+
<span class='label'>inline:</span> <span class='heredoc_beg'><<~RUBY</span>
|
|
1761
|
+
<span class='tstring_content'> if Compony.content_before_root_comp_block && standalone
|
|
1762
|
+
</span><span class='tstring_content'> Compony::RequestContext.new(component, controller, helpers: self, locals: render_locals).evaluate(&Compony.content_before_root_comp_block)
|
|
1763
|
+
</span><span class='tstring_content'> end
|
|
1764
|
+
</span><span class='tstring_content'> content_blocks.each do |block|
|
|
1765
|
+
</span><span class='tstring_content'> # Instanciate and evaluate a fresh RequestContext in order to use the buffer allocated by the ActionView (needed for `concat` calls)
|
|
1766
|
+
</span><span class='tstring_content'> Compony::RequestContext.new(component, controller, helpers: self, locals: render_locals).evaluate(&block)
|
|
1767
|
+
</span><span class='tstring_content'> end
|
|
1768
|
+
</span><span class='tstring_content'> if Compony.content_after_root_comp_block && standalone
|
|
1769
|
+
</span><span class='tstring_content'> Compony::RequestContext.new(component, controller, helpers: self, locals: render_locals).evaluate(&Compony.content_after_root_comp_block)
|
|
1770
|
+
</span><span class='tstring_content'> end
|
|
1771
|
+
</span><span class='heredoc_end'> RUBY
|
|
1772
|
+
</span> <span class='rparen'>)</span>
|
|
1773
|
+
<span class='kw'>else</span>
|
|
1774
|
+
<span class='kw'>return</span> <span class='kw'>nil</span> <span class='comment'># Prevent double render errors
|
|
1775
|
+
</span> <span class='kw'>end</span>
|
|
1776
|
+
<span class='kw'>end</span></pre>
|
|
1777
|
+
</td>
|
|
1778
|
+
</tr>
|
|
1779
|
+
</table>
|
|
1780
|
+
</div>
|
|
1781
|
+
|
|
1782
|
+
<div class="method_details ">
|
|
1783
|
+
<h3 class="signature " id="render_actions-instance_method">
|
|
1784
|
+
|
|
1785
|
+
#<strong>render_actions</strong>(controller, wrapper_class: '', action_class: '') ⇒ <tt>Object</tt>
|
|
1786
|
+
|
|
1787
|
+
|
|
1788
|
+
|
|
1789
|
+
|
|
1790
|
+
|
|
1791
|
+
</h3><div class="docstring">
|
|
1792
|
+
<div class="discussion">
|
|
1793
|
+
|
|
1794
|
+
<p>Used to render all actions of this component, each button wrapped in a div with the specified class</p>
|
|
1795
|
+
|
|
1796
|
+
|
|
1797
|
+
</div>
|
|
1798
|
+
</div>
|
|
1799
|
+
<div class="tags">
|
|
1800
|
+
|
|
1801
|
+
|
|
1802
|
+
</div><table class="source_code">
|
|
1803
|
+
<tr>
|
|
1804
|
+
<td>
|
|
1805
|
+
<pre class="lines">
|
|
1806
|
+
|
|
1807
|
+
|
|
1808
|
+
210
|
|
1809
|
+
211
|
|
1810
|
+
212
|
|
1811
|
+
213
|
|
1812
|
+
214
|
|
1813
|
+
215
|
|
1814
|
+
216
|
|
1815
|
+
217
|
|
1816
|
+
218
|
|
1817
|
+
219
|
|
1818
|
+
220
|
|
1819
|
+
221
|
|
1820
|
+
222
|
|
1821
|
+
223
|
|
1822
|
+
224
|
|
1823
|
+
225</pre>
|
|
1824
|
+
</td>
|
|
1825
|
+
<td>
|
|
1826
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 210</span>
|
|
1827
|
+
|
|
1828
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_render_actions'>render_actions</span><span class='lparen'>(</span><span class='id identifier rubyid_controller'>controller</span><span class='comma'>,</span> <span class='label'>wrapper_class:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='label'>action_class:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
|
1829
|
+
<span class='id identifier rubyid_h'>h</span> <span class='op'>=</span> <span class='id identifier rubyid_controller'>controller</span><span class='period'>.</span><span class='id identifier rubyid_helpers'>helpers</span>
|
|
1830
|
+
<span class='id identifier rubyid_h'>h</span><span class='period'>.</span><span class='id identifier rubyid_content_tag'>content_tag</span><span class='lparen'>(</span><span class='symbol'>:div</span><span class='comma'>,</span> <span class='label'>class:</span> <span class='id identifier rubyid_wrapper_class'>wrapper_class</span><span class='rparen'>)</span> <span class='kw'>do</span>
|
|
1831
|
+
<span class='id identifier rubyid_button_htmls'>button_htmls</span> <span class='op'>=</span> <span class='ivar'>@actions</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_action'>action</span><span class='op'>|</span>
|
|
1832
|
+
<span class='kw'>next</span> <span class='kw'>if</span> <span class='ivar'>@skipped_actions</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_action'>action</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
|
|
1833
|
+
<span class='const'><span class='object_link'><a href="../Compony.html" title="Compony (module)">Compony</a></span></span><span class='period'>.</span><span class='id identifier rubyid_with_button_defaults'><span class='object_link'><a href="../Compony.html#with_button_defaults-class_method" title="Compony.with_button_defaults (method)">with_button_defaults</a></span></span><span class='lparen'>(</span><span class='label'>feasibility_action:</span> <span class='id identifier rubyid_action'>action</span><span class='period'>.</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='rparen'>)</span> <span class='kw'>do</span>
|
|
1834
|
+
<span class='id identifier rubyid_action_button'>action_button</span> <span class='op'>=</span> <span class='id identifier rubyid_action'>action</span><span class='period'>.</span><span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_controller'>controller</span><span class='rparen'>)</span>
|
|
1835
|
+
<span class='kw'>next</span> <span class='kw'>unless</span> <span class='id identifier rubyid_action_button'>action_button</span>
|
|
1836
|
+
<span class='id identifier rubyid_button_html'>button_html</span> <span class='op'>=</span> <span class='id identifier rubyid_action_button'>action_button</span><span class='period'>.</span><span class='id identifier rubyid_render'>render</span><span class='lparen'>(</span><span class='id identifier rubyid_controller'>controller</span><span class='rparen'>)</span>
|
|
1837
|
+
<span class='kw'>next</span> <span class='kw'>if</span> <span class='id identifier rubyid_button_html'>button_html</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
|
|
1838
|
+
<span class='id identifier rubyid_h'>h</span><span class='period'>.</span><span class='id identifier rubyid_content_tag'>content_tag</span><span class='lparen'>(</span><span class='symbol'>:div</span><span class='comma'>,</span> <span class='id identifier rubyid_button_html'>button_html</span><span class='comma'>,</span> <span class='label'>class:</span> <span class='id identifier rubyid_action_class'>action_class</span><span class='rparen'>)</span>
|
|
1839
|
+
<span class='kw'>end</span>
|
|
1840
|
+
<span class='kw'>end</span>
|
|
1841
|
+
<span class='kw'>next</span> <span class='id identifier rubyid_h'>h</span><span class='period'>.</span><span class='id identifier rubyid_safe_join'>safe_join</span> <span class='id identifier rubyid_button_htmls'>button_htmls</span>
|
|
1842
|
+
<span class='kw'>end</span>
|
|
1843
|
+
<span class='kw'>end</span></pre>
|
|
1844
|
+
</td>
|
|
1845
|
+
</tr>
|
|
1846
|
+
</table>
|
|
1847
|
+
</div>
|
|
1848
|
+
|
|
1849
|
+
<div class="method_details ">
|
|
1850
|
+
<h3 class="signature " id="resourceful?-instance_method">
|
|
1851
|
+
|
|
1852
|
+
#<strong>resourceful?</strong> ⇒ <tt>Boolean</tt>
|
|
1853
|
+
|
|
1854
|
+
|
|
1855
|
+
|
|
1856
|
+
|
|
1857
|
+
|
|
1858
|
+
</h3><div class="docstring">
|
|
1859
|
+
<div class="discussion">
|
|
1860
|
+
|
|
1861
|
+
<p>Is true for resourceful components</p>
|
|
1862
|
+
|
|
1863
|
+
|
|
1864
|
+
</div>
|
|
1865
|
+
</div>
|
|
1866
|
+
<div class="tags">
|
|
1867
|
+
|
|
1868
|
+
<p class="tag_title">Returns:</p>
|
|
1869
|
+
<ul class="return">
|
|
1870
|
+
|
|
1871
|
+
<li>
|
|
1872
|
+
|
|
1873
|
+
|
|
1874
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
1875
|
+
|
|
1876
|
+
|
|
1877
|
+
|
|
1878
|
+
</li>
|
|
1879
|
+
|
|
1880
|
+
</ul>
|
|
1881
|
+
|
|
1882
|
+
</div><table class="source_code">
|
|
1883
|
+
<tr>
|
|
1884
|
+
<td>
|
|
1885
|
+
<pre class="lines">
|
|
1886
|
+
|
|
1887
|
+
|
|
1888
|
+
228
|
|
1889
|
+
229
|
|
1890
|
+
230</pre>
|
|
1891
|
+
</td>
|
|
1892
|
+
<td>
|
|
1893
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 228</span>
|
|
1894
|
+
|
|
1895
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_resourceful?'>resourceful?</span>
|
|
1896
|
+
<span class='kw'>return</span> <span class='kw'>false</span>
|
|
1897
|
+
<span class='kw'>end</span></pre>
|
|
1898
|
+
</td>
|
|
1899
|
+
</tr>
|
|
1900
|
+
</table>
|
|
1901
|
+
</div>
|
|
1902
|
+
|
|
1903
|
+
<div class="method_details ">
|
|
1904
|
+
<h3 class="signature " id="root_comp-instance_method">
|
|
1905
|
+
|
|
1906
|
+
#<strong>root_comp</strong> ⇒ <tt>Object</tt>
|
|
1907
|
+
|
|
1908
|
+
|
|
1909
|
+
|
|
1910
|
+
|
|
1911
|
+
|
|
1912
|
+
</h3><div class="docstring">
|
|
1913
|
+
<div class="discussion">
|
|
1914
|
+
|
|
1915
|
+
<p>Returns the current root comp. Do not overwrite.</p>
|
|
1916
|
+
|
|
1917
|
+
|
|
1918
|
+
</div>
|
|
1919
|
+
</div>
|
|
1920
|
+
<div class="tags">
|
|
1921
|
+
|
|
1922
|
+
|
|
1923
|
+
</div><table class="source_code">
|
|
1924
|
+
<tr>
|
|
1925
|
+
<td>
|
|
1926
|
+
<pre class="lines">
|
|
1927
|
+
|
|
1928
|
+
|
|
1929
|
+
48
|
|
1930
|
+
49
|
|
1931
|
+
50
|
|
1932
|
+
51</pre>
|
|
1933
|
+
</td>
|
|
1934
|
+
<td>
|
|
1935
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 48</span>
|
|
1936
|
+
|
|
1937
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_root_comp'>root_comp</span>
|
|
1938
|
+
<span class='kw'>return</span> <span class='kw'>self</span> <span class='kw'>unless</span> <span class='id identifier rubyid_parent_comp'>parent_comp</span>
|
|
1939
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_parent_comp'>parent_comp</span><span class='period'>.</span><span class='id identifier rubyid_root_comp'>root_comp</span>
|
|
1940
|
+
<span class='kw'>end</span></pre>
|
|
1941
|
+
</td>
|
|
1942
|
+
</tr>
|
|
1943
|
+
</table>
|
|
1944
|
+
</div>
|
|
1945
|
+
|
|
1946
|
+
<div class="method_details ">
|
|
1947
|
+
<h3 class="signature " id="root_comp?-instance_method">
|
|
1948
|
+
|
|
1949
|
+
#<strong>root_comp?</strong> ⇒ <tt>Boolean</tt>
|
|
1950
|
+
|
|
1951
|
+
|
|
1952
|
+
|
|
1953
|
+
|
|
1954
|
+
|
|
1955
|
+
</h3><div class="docstring">
|
|
1956
|
+
<div class="discussion">
|
|
1957
|
+
|
|
1958
|
+
<p>Returns whether or not this is the root comp. Do not overwrite.</p>
|
|
1959
|
+
|
|
1960
|
+
|
|
1961
|
+
</div>
|
|
1962
|
+
</div>
|
|
1963
|
+
<div class="tags">
|
|
1964
|
+
|
|
1965
|
+
<p class="tag_title">Returns:</p>
|
|
1966
|
+
<ul class="return">
|
|
1967
|
+
|
|
1968
|
+
<li>
|
|
1969
|
+
|
|
1970
|
+
|
|
1971
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
1972
|
+
|
|
1973
|
+
|
|
1974
|
+
|
|
1975
|
+
</li>
|
|
1976
|
+
|
|
1977
|
+
</ul>
|
|
1978
|
+
|
|
1979
|
+
</div><table class="source_code">
|
|
1980
|
+
<tr>
|
|
1981
|
+
<td>
|
|
1982
|
+
<pre class="lines">
|
|
1983
|
+
|
|
1984
|
+
|
|
1985
|
+
55
|
|
1986
|
+
56
|
|
1987
|
+
57</pre>
|
|
1988
|
+
</td>
|
|
1989
|
+
<td>
|
|
1990
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 55</span>
|
|
1991
|
+
|
|
1992
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_root_comp?'>root_comp?</span>
|
|
1993
|
+
<span class='id identifier rubyid_parent_comp'>parent_comp</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
|
1994
|
+
<span class='kw'>end</span></pre>
|
|
1995
|
+
</td>
|
|
1996
|
+
</tr>
|
|
1997
|
+
</table>
|
|
1998
|
+
</div>
|
|
1999
|
+
|
|
2000
|
+
<div class="method_details ">
|
|
2001
|
+
<h3 class="signature " id="skip_action-instance_method">
|
|
2002
|
+
|
|
2003
|
+
#<strong>skip_action</strong>(action_name) ⇒ <tt>Object</tt>
|
|
2004
|
+
|
|
2005
|
+
|
|
2006
|
+
|
|
2007
|
+
|
|
2008
|
+
|
|
2009
|
+
</h3><div class="docstring">
|
|
2010
|
+
<div class="discussion">
|
|
2011
|
+
|
|
2012
|
+
<p>DSL method Marks an action for skip</p>
|
|
2013
|
+
|
|
2014
|
+
|
|
2015
|
+
</div>
|
|
2016
|
+
</div>
|
|
2017
|
+
<div class="tags">
|
|
2018
|
+
|
|
2019
|
+
|
|
2020
|
+
</div><table class="source_code">
|
|
2021
|
+
<tr>
|
|
2022
|
+
<td>
|
|
2023
|
+
<pre class="lines">
|
|
2024
|
+
|
|
2025
|
+
|
|
2026
|
+
205
|
|
2027
|
+
206
|
|
2028
|
+
207</pre>
|
|
2029
|
+
</td>
|
|
2030
|
+
<td>
|
|
2031
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 205</span>
|
|
2032
|
+
|
|
2033
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_skip_action'>skip_action</span><span class='lparen'>(</span><span class='id identifier rubyid_action_name'>action_name</span><span class='rparen'>)</span>
|
|
2034
|
+
<span class='ivar'>@skipped_actions</span> <span class='op'><<</span> <span class='id identifier rubyid_action_name'>action_name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
|
|
2035
|
+
<span class='kw'>end</span></pre>
|
|
2036
|
+
</td>
|
|
2037
|
+
</tr>
|
|
2038
|
+
</table>
|
|
2039
|
+
</div>
|
|
2040
|
+
|
|
2041
|
+
<div class="method_details ">
|
|
2042
|
+
<h3 class="signature " id="sub_comp-instance_method">
|
|
2043
|
+
|
|
2044
|
+
#<strong>sub_comp</strong>(component_class, **comp_opts) ⇒ <tt>Object</tt>
|
|
2045
|
+
|
|
2046
|
+
|
|
2047
|
+
|
|
2048
|
+
|
|
2049
|
+
|
|
2050
|
+
</h3><div class="docstring">
|
|
2051
|
+
<div class="discussion">
|
|
2052
|
+
|
|
2053
|
+
<p>Instanciate a component with <code>self</code> as a parent</p>
|
|
2054
|
+
|
|
2055
|
+
|
|
2056
|
+
</div>
|
|
2057
|
+
</div>
|
|
2058
|
+
<div class="tags">
|
|
2059
|
+
|
|
2060
|
+
|
|
2061
|
+
</div><table class="source_code">
|
|
2062
|
+
<tr>
|
|
2063
|
+
<td>
|
|
2064
|
+
<pre class="lines">
|
|
2065
|
+
|
|
2066
|
+
|
|
2067
|
+
88
|
|
2068
|
+
89
|
|
2069
|
+
90
|
|
2070
|
+
91
|
|
2071
|
+
92</pre>
|
|
2072
|
+
</td>
|
|
2073
|
+
<td>
|
|
2074
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 88</span>
|
|
2075
|
+
|
|
2076
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_sub_comp'>sub_comp</span><span class='lparen'>(</span><span class='id identifier rubyid_component_class'>component_class</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_comp_opts'>comp_opts</span><span class='rparen'>)</span>
|
|
2077
|
+
<span class='id identifier rubyid_sub'>sub</span> <span class='op'>=</span> <span class='id identifier rubyid_component_class'>component_class</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='label'>index:</span> <span class='ivar'>@sub_comps</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_comp_opts'>comp_opts</span><span class='rparen'>)</span>
|
|
2078
|
+
<span class='ivar'>@sub_comps</span> <span class='op'><<</span> <span class='id identifier rubyid_sub'>sub</span>
|
|
2079
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_sub'>sub</span>
|
|
2080
|
+
<span class='kw'>end</span></pre>
|
|
2081
|
+
</td>
|
|
2082
|
+
</tr>
|
|
2083
|
+
</table>
|
|
2084
|
+
</div>
|
|
2085
|
+
|
|
2086
|
+
</div>
|
|
2087
|
+
|
|
2088
|
+
</div>
|
|
2089
|
+
|
|
2090
|
+
<div id="footer">
|
|
2091
|
+
Generated on Wed Apr 24 17:14:06 2024 by
|
|
2092
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
2093
|
+
0.9.34 (ruby-3.2.2).
|
|
2094
|
+
</div>
|
|
2095
|
+
|
|
2096
|
+
</div>
|
|
2097
|
+
</body>
|
|
2098
|
+
</html>
|