compony 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/Gemfile.lock +3 -3
  4. data/README.md +1397 -33
  5. data/Rakefile +6 -2
  6. data/TODO.md +1 -0
  7. data/VERSION +1 -0
  8. data/compony.gemspec +7 -7
  9. data/doc/ComponentGenerator.html +231 -0
  10. data/doc/Components.html +105 -0
  11. data/doc/ComponentsGenerator.html +203 -0
  12. data/doc/Compony/Component.html +2098 -0
  13. data/doc/Compony/ComponentMixins/Default/Labelling.html +406 -0
  14. data/doc/Compony/ComponentMixins/Default/Standalone/ResourcefulVerbDsl.html +539 -0
  15. data/doc/Compony/ComponentMixins/Default/Standalone/StandaloneDsl.html +588 -0
  16. data/doc/Compony/ComponentMixins/Default/Standalone/VerbDsl.html +577 -0
  17. data/doc/Compony/ComponentMixins/Default/Standalone.html +692 -0
  18. data/doc/Compony/ComponentMixins/Default.html +126 -0
  19. data/doc/Compony/ComponentMixins/Resourceful.html +1193 -0
  20. data/doc/Compony/ComponentMixins.html +126 -0
  21. data/doc/Compony/Components/Button.html +293 -0
  22. data/doc/Compony/Components/Destroy.html +384 -0
  23. data/doc/Compony/Components/Edit.html +462 -0
  24. data/doc/Compony/Components/Form.html +1112 -0
  25. data/doc/Compony/Components/New.html +462 -0
  26. data/doc/Compony/Components/WithForm.html +528 -0
  27. data/doc/Compony/Components.html +126 -0
  28. data/doc/Compony/ControllerMixin.html +136 -0
  29. data/doc/Compony/Engine.html +133 -0
  30. data/doc/Compony/MethodAccessibleHash.html +453 -0
  31. data/doc/Compony/ModelFields/Anchormodel.html +383 -0
  32. data/doc/Compony/ModelFields/Association.html +613 -0
  33. data/doc/Compony/ModelFields/Attachment.html +305 -0
  34. data/doc/Compony/ModelFields/Base.html +1066 -0
  35. data/doc/Compony/ModelFields/Boolean.html +232 -0
  36. data/doc/Compony/ModelFields/Color.html +299 -0
  37. data/doc/Compony/ModelFields/Currency.html +232 -0
  38. data/doc/Compony/ModelFields/Date.html +232 -0
  39. data/doc/Compony/ModelFields/Datetime.html +232 -0
  40. data/doc/Compony/ModelFields/Decimal.html +154 -0
  41. data/doc/Compony/ModelFields/Email.html +240 -0
  42. data/doc/Compony/ModelFields/Float.html +154 -0
  43. data/doc/Compony/ModelFields/Integer.html +154 -0
  44. data/doc/Compony/ModelFields/Percentage.html +232 -0
  45. data/doc/Compony/ModelFields/Phone.html +301 -0
  46. data/doc/Compony/ModelFields/RichText.html +232 -0
  47. data/doc/Compony/ModelFields/String.html +154 -0
  48. data/doc/Compony/ModelFields/Text.html +154 -0
  49. data/doc/Compony/ModelFields/Time.html +154 -0
  50. data/doc/Compony/ModelFields/Url.html +240 -0
  51. data/doc/Compony/ModelFields.html +126 -0
  52. data/doc/Compony/ModelMixin.html +524 -0
  53. data/doc/Compony/RequestContext.html +791 -0
  54. data/doc/Compony/Version.html +139 -0
  55. data/doc/Compony/ViewHelpers.html +443 -0
  56. data/doc/Compony.html +2156 -0
  57. data/doc/ComponyController.html +124 -0
  58. data/doc/_index.html +569 -0
  59. data/doc/class_list.html +51 -0
  60. data/doc/css/common.css +1 -0
  61. data/doc/css/full_list.css +58 -0
  62. data/doc/css/style.css +497 -0
  63. data/doc/file.README.html +1565 -0
  64. data/doc/file_list.html +56 -0
  65. data/doc/frames.html +17 -0
  66. data/doc/imgs/intro-example-destroy.png +0 -0
  67. data/doc/imgs/intro-example-edit.png +0 -0
  68. data/doc/imgs/intro-example-index.png +0 -0
  69. data/doc/imgs/intro-example-new.png +0 -0
  70. data/doc/imgs/intro-example-show.png +0 -0
  71. data/doc/index.html +1565 -0
  72. data/doc/js/app.js +314 -0
  73. data/doc/js/full_list.js +216 -0
  74. data/doc/js/jquery.js +4 -0
  75. data/doc/method_list.html +1435 -0
  76. data/doc/resourceful_lifecycle.png +0 -0
  77. data/doc/top-level-namespace.html +112 -0
  78. data/lib/compony/component.rb +2 -1
  79. data/lib/compony/component_mixins/default/standalone.rb +4 -0
  80. data/lib/compony/components/with_form.rb +1 -0
  81. data/lib/compony/model_fields/anchormodel.rb +0 -22
  82. data/lib/compony/model_mixin.rb +12 -2
  83. data/lib/compony/version.rb +1 -7
  84. data/logo.svg +133 -0
  85. metadata +82 -6
@@ -0,0 +1,1193 @@
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
+ Module: Compony::ComponentMixins::Resourceful
8
+
9
+ &mdash; 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::ComponentMixins::Resourceful";
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 (R)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../../Compony.html" title="Compony (module)">Compony</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../ComponentMixins.html" title="Compony::ComponentMixins (module)">ComponentMixins</a></span></span>
41
+ &raquo;
42
+ <span class="title">Resourceful</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>Module: Compony::ComponentMixins::Resourceful
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+ <dl>
73
+ <dt>Extended by:</dt>
74
+ <dd>ActiveSupport::Concern</dd>
75
+ </dl>
76
+
77
+
78
+
79
+
80
+
81
+
82
+ <dl>
83
+ <dt>Included in:</dt>
84
+ <dd><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/Edit.html" title="Compony::Components::Edit (class)">Compony::Components::Edit</a></span>, <span class='object_link'><a href="../Components/New.html" title="Compony::Components::New (class)">Compony::Components::New</a></span></dd>
85
+ </dl>
86
+
87
+
88
+
89
+ <dl>
90
+ <dt>Defined in:</dt>
91
+ <dd>lib/compony/component_mixins/resourceful.rb</dd>
92
+ </dl>
93
+
94
+ </div>
95
+
96
+ <h2>Overview</h2><div class="docstring">
97
+ <div class="discussion">
98
+
99
+ <p>Include this when your component’s family name corresponds to the pluralized Rails model name the component’s family is responsible for. When including this, the component gets an attribute @data which contains a record or a collection of records. Resourceful components are always aware of a data_class, corresponding to the expected @data.class and used e.g. to render lists or for <code>.new</code>.</p>
100
+
101
+
102
+ </div>
103
+ </div>
104
+ <div class="tags">
105
+
106
+
107
+ </div>
108
+
109
+
110
+
111
+ <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
112
+ <ul class="summary">
113
+
114
+ <li class="public ">
115
+ <span class="summary_signature">
116
+
117
+ <a href="#data-instance_method" title="#data (instance method)">#<strong>data</strong> &#x21d2; Object </a>
118
+
119
+
120
+
121
+ </span>
122
+
123
+
124
+
125
+
126
+ <span class="note title readonly">readonly</span>
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+ <span class="summary_desc"><div class='inline'></div></span>
137
+
138
+ </li>
139
+
140
+
141
+ <li class="public ">
142
+ <span class="summary_signature">
143
+
144
+ <a href="#global_after_assign_attributes_block-instance_method" title="#global_after_assign_attributes_block (instance method)">#<strong>global_after_assign_attributes_block</strong> &#x21d2; Object </a>
145
+
146
+
147
+
148
+ </span>
149
+
150
+
151
+
152
+
153
+ <span class="note title readonly">readonly</span>
154
+
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+ <span class="summary_desc"><div class='inline'></div></span>
164
+
165
+ </li>
166
+
167
+
168
+ <li class="public ">
169
+ <span class="summary_signature">
170
+
171
+ <a href="#global_after_load_data_block-instance_method" title="#global_after_load_data_block (instance method)">#<strong>global_after_load_data_block</strong> &#x21d2; Object </a>
172
+
173
+
174
+
175
+ </span>
176
+
177
+
178
+
179
+
180
+ <span class="note title readonly">readonly</span>
181
+
182
+
183
+
184
+
185
+
186
+
187
+
188
+
189
+
190
+ <span class="summary_desc"><div class='inline'></div></span>
191
+
192
+ </li>
193
+
194
+
195
+ <li class="public ">
196
+ <span class="summary_signature">
197
+
198
+ <a href="#global_assign_attributes_block-instance_method" title="#global_assign_attributes_block (instance method)">#<strong>global_assign_attributes_block</strong> &#x21d2; Object </a>
199
+
200
+
201
+
202
+ </span>
203
+
204
+
205
+
206
+
207
+ <span class="note title readonly">readonly</span>
208
+
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+ <span class="summary_desc"><div class='inline'></div></span>
218
+
219
+ </li>
220
+
221
+
222
+ <li class="public ">
223
+ <span class="summary_signature">
224
+
225
+ <a href="#global_load_data_block-instance_method" title="#global_load_data_block (instance method)">#<strong>global_load_data_block</strong> &#x21d2; Object </a>
226
+
227
+
228
+
229
+ </span>
230
+
231
+
232
+
233
+
234
+ <span class="note title readonly">readonly</span>
235
+
236
+
237
+
238
+
239
+
240
+
241
+
242
+
243
+
244
+ <span class="summary_desc"><div class='inline'>
245
+ <p>Must prefix the following instance variables with global_ in order to avoid overwriting VerbDsl inst vars due to Dslblend.</p>
246
+ </div></span>
247
+
248
+ </li>
249
+
250
+
251
+ <li class="public ">
252
+ <span class="summary_signature">
253
+
254
+ <a href="#global_store_data_block-instance_method" title="#global_store_data_block (instance method)">#<strong>global_store_data_block</strong> &#x21d2; Object </a>
255
+
256
+
257
+
258
+ </span>
259
+
260
+
261
+
262
+
263
+ <span class="note title readonly">readonly</span>
264
+
265
+
266
+
267
+
268
+
269
+
270
+
271
+
272
+
273
+ <span class="summary_desc"><div class='inline'></div></span>
274
+
275
+ </li>
276
+
277
+
278
+ </ul>
279
+
280
+
281
+
282
+
283
+
284
+ <h2>
285
+ Instance Method Summary
286
+ <small><a href="#" class="summary_toggle">collapse</a></small>
287
+ </h2>
288
+
289
+ <ul class="summary">
290
+
291
+ <li class="protected ">
292
+ <span class="summary_signature">
293
+
294
+ <a href="#after_assign_attributes-instance_method" title="#after_assign_attributes (instance method)">#<strong>after_assign_attributes</strong>(&amp;block) &#x21d2; Object </a>
295
+
296
+
297
+
298
+ </span>
299
+
300
+
301
+
302
+ <span class="note title protected">protected</span>
303
+
304
+
305
+
306
+
307
+
308
+ <span class="summary_desc"><div class='inline'>
309
+ <p>DSL method Runs after <code>assign_attributes</code> and before <code>store_data</code> for all standalone paths and verbs.</p>
310
+ </div></span>
311
+
312
+ </li>
313
+
314
+
315
+ <li class="protected ">
316
+ <span class="summary_signature">
317
+
318
+ <a href="#after_load_data-instance_method" title="#after_load_data (instance method)">#<strong>after_load_data</strong>(&amp;block) &#x21d2; Object </a>
319
+
320
+
321
+
322
+ </span>
323
+
324
+
325
+
326
+ <span class="note title protected">protected</span>
327
+
328
+
329
+
330
+
331
+
332
+ <span class="summary_desc"><div class='inline'>
333
+ <p>DSL method Runs after loading data and before authorization for all standalone paths and verbs.</p>
334
+ </div></span>
335
+
336
+ </li>
337
+
338
+
339
+ <li class="protected ">
340
+ <span class="summary_signature">
341
+
342
+ <a href="#assign_attributes-instance_method" title="#assign_attributes (instance method)">#<strong>assign_attributes</strong>(&amp;block) &#x21d2; Object </a>
343
+
344
+
345
+
346
+ </span>
347
+
348
+
349
+
350
+ <span class="note title protected">protected</span>
351
+
352
+
353
+
354
+
355
+
356
+ <span class="summary_desc"><div class='inline'>
357
+ <p>DSL method Sets a default default assign_attributes block for all standalone paths and verbs.</p>
358
+ </div></span>
359
+
360
+ </li>
361
+
362
+
363
+ <li class="public ">
364
+ <span class="summary_signature">
365
+
366
+ <a href="#data_class-instance_method" title="#data_class (instance method)">#<strong>data_class</strong>(new_data_class = nil) &#x21d2; Object </a>
367
+
368
+
369
+
370
+ </span>
371
+
372
+
373
+
374
+
375
+
376
+
377
+
378
+
379
+
380
+ <span class="summary_desc"><div class='inline'>
381
+ <p>DSL method Sets or calculates the model class based on the component’s family name.</p>
382
+ </div></span>
383
+
384
+ </li>
385
+
386
+
387
+ <li class="public ">
388
+ <span class="summary_signature">
389
+
390
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(*args, data: nil, data_class: nil, **nargs, &amp;block) &#x21d2; Object </a>
391
+
392
+
393
+
394
+ </span>
395
+
396
+
397
+
398
+
399
+
400
+
401
+
402
+
403
+
404
+ <span class="summary_desc"><div class='inline'></div></span>
405
+
406
+ </li>
407
+
408
+
409
+ <li class="protected ">
410
+ <span class="summary_signature">
411
+
412
+ <a href="#load_data-instance_method" title="#load_data (instance method)">#<strong>load_data</strong>(&amp;block) &#x21d2; Object </a>
413
+
414
+
415
+
416
+ </span>
417
+
418
+
419
+
420
+ <span class="note title protected">protected</span>
421
+
422
+
423
+
424
+
425
+
426
+ <span class="summary_desc"><div class='inline'>
427
+ <p>DSL method Sets a default load_data block for all standalone paths and verbs.</p>
428
+ </div></span>
429
+
430
+ </li>
431
+
432
+
433
+ <li class="public ">
434
+ <span class="summary_signature">
435
+
436
+ <a href="#resourceful%3F-instance_method" title="#resourceful? (instance method)">#<strong>resourceful?</strong> &#x21d2; Boolean </a>
437
+
438
+
439
+
440
+ </span>
441
+
442
+
443
+
444
+
445
+
446
+
447
+
448
+
449
+
450
+ <span class="summary_desc"><div class='inline'></div></span>
451
+
452
+ </li>
453
+
454
+
455
+ <li class="public ">
456
+ <span class="summary_signature">
457
+
458
+ <a href="#resourceful_sub_comp-instance_method" title="#resourceful_sub_comp (instance method)">#<strong>resourceful_sub_comp</strong>(component_class, **comp_opts) &#x21d2; Object </a>
459
+
460
+
461
+
462
+ </span>
463
+
464
+
465
+
466
+
467
+
468
+
469
+
470
+
471
+
472
+ <span class="summary_desc"><div class='inline'>
473
+ <p>Instanciate a component with <code>self</code> as a parent and render it, having it inherit the resource.</p>
474
+ </div></span>
475
+
476
+ </li>
477
+
478
+
479
+ <li class="protected ">
480
+ <span class="summary_signature">
481
+
482
+ <a href="#store_data-instance_method" title="#store_data (instance method)">#<strong>store_data</strong>(&amp;block) &#x21d2; Object </a>
483
+
484
+
485
+
486
+ </span>
487
+
488
+
489
+
490
+ <span class="note title protected">protected</span>
491
+
492
+
493
+
494
+
495
+
496
+ <span class="summary_desc"><div class='inline'>
497
+ <p>DSL method Sets a default store_data block for all standalone paths and verbs.</p>
498
+ </div></span>
499
+
500
+ </li>
501
+
502
+
503
+ </ul>
504
+
505
+
506
+
507
+
508
+ <div id="instance_attr_details" class="attr_details">
509
+ <h2>Instance Attribute Details</h2>
510
+
511
+
512
+ <span id=""></span>
513
+ <div class="method_details first">
514
+ <h3 class="signature first" id="data-instance_method">
515
+
516
+ #<strong>data</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
517
+
518
+
519
+
520
+
521
+
522
+ </h3><div class="docstring">
523
+ <div class="discussion">
524
+
525
+
526
+ </div>
527
+ </div>
528
+ <div class="tags">
529
+
530
+
531
+ </div><table class="source_code">
532
+ <tr>
533
+ <td>
534
+ <pre class="lines">
535
+
536
+
537
+ 9
538
+ 10
539
+ 11</pre>
540
+ </td>
541
+ <td>
542
+ <pre class="code"><span class="info file"># File 'lib/compony/component_mixins/resourceful.rb', line 9</span>
543
+
544
+ <span class='kw'>def</span> <span class='id identifier rubyid_data'>data</span>
545
+ <span class='ivar'>@data</span>
546
+ <span class='kw'>end</span></pre>
547
+ </td>
548
+ </tr>
549
+ </table>
550
+ </div>
551
+
552
+
553
+ <span id=""></span>
554
+ <div class="method_details ">
555
+ <h3 class="signature " id="global_after_assign_attributes_block-instance_method">
556
+
557
+ #<strong>global_after_assign_attributes_block</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
558
+
559
+
560
+
561
+
562
+
563
+ </h3><div class="docstring">
564
+ <div class="discussion">
565
+
566
+
567
+ </div>
568
+ </div>
569
+ <div class="tags">
570
+
571
+
572
+ </div><table class="source_code">
573
+ <tr>
574
+ <td>
575
+ <pre class="lines">
576
+
577
+
578
+ 15
579
+ 16
580
+ 17</pre>
581
+ </td>
582
+ <td>
583
+ <pre class="code"><span class="info file"># File 'lib/compony/component_mixins/resourceful.rb', line 15</span>
584
+
585
+ <span class='kw'>def</span> <span class='id identifier rubyid_global_after_assign_attributes_block'>global_after_assign_attributes_block</span>
586
+ <span class='ivar'>@global_after_assign_attributes_block</span>
587
+ <span class='kw'>end</span></pre>
588
+ </td>
589
+ </tr>
590
+ </table>
591
+ </div>
592
+
593
+
594
+ <span id=""></span>
595
+ <div class="method_details ">
596
+ <h3 class="signature " id="global_after_load_data_block-instance_method">
597
+
598
+ #<strong>global_after_load_data_block</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
599
+
600
+
601
+
602
+
603
+
604
+ </h3><div class="docstring">
605
+ <div class="discussion">
606
+
607
+
608
+ </div>
609
+ </div>
610
+ <div class="tags">
611
+
612
+
613
+ </div><table class="source_code">
614
+ <tr>
615
+ <td>
616
+ <pre class="lines">
617
+
618
+
619
+ 13
620
+ 14
621
+ 15</pre>
622
+ </td>
623
+ <td>
624
+ <pre class="code"><span class="info file"># File 'lib/compony/component_mixins/resourceful.rb', line 13</span>
625
+
626
+ <span class='kw'>def</span> <span class='id identifier rubyid_global_after_load_data_block'>global_after_load_data_block</span>
627
+ <span class='ivar'>@global_after_load_data_block</span>
628
+ <span class='kw'>end</span></pre>
629
+ </td>
630
+ </tr>
631
+ </table>
632
+ </div>
633
+
634
+
635
+ <span id=""></span>
636
+ <div class="method_details ">
637
+ <h3 class="signature " id="global_assign_attributes_block-instance_method">
638
+
639
+ #<strong>global_assign_attributes_block</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
640
+
641
+
642
+
643
+
644
+
645
+ </h3><div class="docstring">
646
+ <div class="discussion">
647
+
648
+
649
+ </div>
650
+ </div>
651
+ <div class="tags">
652
+
653
+
654
+ </div><table class="source_code">
655
+ <tr>
656
+ <td>
657
+ <pre class="lines">
658
+
659
+
660
+ 14
661
+ 15
662
+ 16</pre>
663
+ </td>
664
+ <td>
665
+ <pre class="code"><span class="info file"># File 'lib/compony/component_mixins/resourceful.rb', line 14</span>
666
+
667
+ <span class='kw'>def</span> <span class='id identifier rubyid_global_assign_attributes_block'>global_assign_attributes_block</span>
668
+ <span class='ivar'>@global_assign_attributes_block</span>
669
+ <span class='kw'>end</span></pre>
670
+ </td>
671
+ </tr>
672
+ </table>
673
+ </div>
674
+
675
+
676
+ <span id=""></span>
677
+ <div class="method_details ">
678
+ <h3 class="signature " id="global_load_data_block-instance_method">
679
+
680
+ #<strong>global_load_data_block</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
681
+
682
+
683
+
684
+
685
+
686
+ </h3><div class="docstring">
687
+ <div class="discussion">
688
+
689
+ <p>Must prefix the following instance variables with global_ in order to avoid overwriting VerbDsl inst vars due to Dslblend.</p>
690
+
691
+
692
+ </div>
693
+ </div>
694
+ <div class="tags">
695
+
696
+
697
+ </div><table class="source_code">
698
+ <tr>
699
+ <td>
700
+ <pre class="lines">
701
+
702
+
703
+ 12
704
+ 13
705
+ 14</pre>
706
+ </td>
707
+ <td>
708
+ <pre class="code"><span class="info file"># File 'lib/compony/component_mixins/resourceful.rb', line 12</span>
709
+
710
+ <span class='kw'>def</span> <span class='id identifier rubyid_global_load_data_block'>global_load_data_block</span>
711
+ <span class='ivar'>@global_load_data_block</span>
712
+ <span class='kw'>end</span></pre>
713
+ </td>
714
+ </tr>
715
+ </table>
716
+ </div>
717
+
718
+
719
+ <span id=""></span>
720
+ <div class="method_details ">
721
+ <h3 class="signature " id="global_store_data_block-instance_method">
722
+
723
+ #<strong>global_store_data_block</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
724
+
725
+
726
+
727
+
728
+
729
+ </h3><div class="docstring">
730
+ <div class="discussion">
731
+
732
+
733
+ </div>
734
+ </div>
735
+ <div class="tags">
736
+
737
+
738
+ </div><table class="source_code">
739
+ <tr>
740
+ <td>
741
+ <pre class="lines">
742
+
743
+
744
+ 16
745
+ 17
746
+ 18</pre>
747
+ </td>
748
+ <td>
749
+ <pre class="code"><span class="info file"># File 'lib/compony/component_mixins/resourceful.rb', line 16</span>
750
+
751
+ <span class='kw'>def</span> <span class='id identifier rubyid_global_store_data_block'>global_store_data_block</span>
752
+ <span class='ivar'>@global_store_data_block</span>
753
+ <span class='kw'>end</span></pre>
754
+ </td>
755
+ </tr>
756
+ </table>
757
+ </div>
758
+
759
+ </div>
760
+
761
+
762
+ <div id="instance_method_details" class="method_details_list">
763
+ <h2>Instance Method Details</h2>
764
+
765
+
766
+ <div class="method_details first">
767
+ <h3 class="signature first" id="after_assign_attributes-instance_method">
768
+
769
+ #<strong>after_assign_attributes</strong>(&amp;block) &#x21d2; <tt>Object</tt> <span class="extras">(protected)</span>
770
+
771
+
772
+
773
+
774
+
775
+ </h3><div class="docstring">
776
+ <div class="discussion">
777
+
778
+ <p>DSL method Runs after <code>assign_attributes</code> and before <code>store_data</code> for all standalone paths and verbs. Example use case: prefilling some fields for a form</p>
779
+
780
+
781
+ </div>
782
+ </div>
783
+ <div class="tags">
784
+
785
+
786
+ </div><table class="source_code">
787
+ <tr>
788
+ <td>
789
+ <pre class="lines">
790
+
791
+
792
+ 77
793
+ 78
794
+ 79</pre>
795
+ </td>
796
+ <td>
797
+ <pre class="code"><span class="info file"># File 'lib/compony/component_mixins/resourceful.rb', line 77</span>
798
+
799
+ <span class='kw'>def</span> <span class='id identifier rubyid_after_assign_attributes'>after_assign_attributes</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
800
+ <span class='ivar'>@global_after_assign_attributes_block</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span>
801
+ <span class='kw'>end</span></pre>
802
+ </td>
803
+ </tr>
804
+ </table>
805
+ </div>
806
+
807
+ <div class="method_details ">
808
+ <h3 class="signature " id="after_load_data-instance_method">
809
+
810
+ #<strong>after_load_data</strong>(&amp;block) &#x21d2; <tt>Object</tt> <span class="extras">(protected)</span>
811
+
812
+
813
+
814
+
815
+
816
+ </h3><div class="docstring">
817
+ <div class="discussion">
818
+
819
+ <p>DSL method Runs after loading data and before authorization for all standalone paths and verbs. Example use case: if <code>load_data</code> produced an AR collection proxy, can still refine result here before <code>to_sql</code> is called.</p>
820
+
821
+
822
+ </div>
823
+ </div>
824
+ <div class="tags">
825
+
826
+
827
+ </div><table class="source_code">
828
+ <tr>
829
+ <td>
830
+ <pre class="lines">
831
+
832
+
833
+ 60
834
+ 61
835
+ 62</pre>
836
+ </td>
837
+ <td>
838
+ <pre class="code"><span class="info file"># File 'lib/compony/component_mixins/resourceful.rb', line 60</span>
839
+
840
+ <span class='kw'>def</span> <span class='id identifier rubyid_after_load_data'>after_load_data</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
841
+ <span class='ivar'>@global_after_load_data_block</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span>
842
+ <span class='kw'>end</span></pre>
843
+ </td>
844
+ </tr>
845
+ </table>
846
+ </div>
847
+
848
+ <div class="method_details ">
849
+ <h3 class="signature " id="assign_attributes-instance_method">
850
+
851
+ #<strong>assign_attributes</strong>(&amp;block) &#x21d2; <tt>Object</tt> <span class="extras">(protected)</span>
852
+
853
+
854
+
855
+
856
+
857
+ </h3><div class="docstring">
858
+ <div class="discussion">
859
+
860
+ <p>DSL method Sets a default default assign_attributes block for all standalone paths and verbs. Can be overwritten for a specific path and verb in the <span class='object_link'><a href="Default/Standalone/VerbDsl.html" title="Compony::ComponentMixins::Default::Standalone::VerbDsl (class)">Default::Standalone::VerbDsl</a></span>. The block is expected to assign suitable <code>params</code> to attributes of <code>@data</code>.</p>
861
+
862
+
863
+ </div>
864
+ </div>
865
+ <div class="tags">
866
+
867
+
868
+ <p class="tag_title">See Also:</p>
869
+ <ul class="see">
870
+
871
+ <li>Default::Standalone::VerbDsl#assign_attributes</li>
872
+
873
+ </ul>
874
+
875
+ </div><table class="source_code">
876
+ <tr>
877
+ <td>
878
+ <pre class="lines">
879
+
880
+
881
+ 70
882
+ 71
883
+ 72</pre>
884
+ </td>
885
+ <td>
886
+ <pre class="code"><span class="info file"># File 'lib/compony/component_mixins/resourceful.rb', line 70</span>
887
+
888
+ <span class='kw'>def</span> <span class='id identifier rubyid_assign_attributes'>assign_attributes</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
889
+ <span class='ivar'>@global_assign_attributes_block</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span>
890
+ <span class='kw'>end</span></pre>
891
+ </td>
892
+ </tr>
893
+ </table>
894
+ </div>
895
+
896
+ <div class="method_details ">
897
+ <h3 class="signature " id="data_class-instance_method">
898
+
899
+ #<strong>data_class</strong>(new_data_class = nil) &#x21d2; <tt>Object</tt>
900
+
901
+
902
+
903
+
904
+
905
+ </h3><div class="docstring">
906
+ <div class="discussion">
907
+
908
+ <p>DSL method Sets or calculates the model class based on the component’s family name</p>
909
+
910
+
911
+ </div>
912
+ </div>
913
+ <div class="tags">
914
+
915
+
916
+ </div><table class="source_code">
917
+ <tr>
918
+ <td>
919
+ <pre class="lines">
920
+
921
+
922
+ 30
923
+ 31
924
+ 32</pre>
925
+ </td>
926
+ <td>
927
+ <pre class="code"><span class="info file"># File 'lib/compony/component_mixins/resourceful.rb', line 30</span>
928
+
929
+ <span class='kw'>def</span> <span class='id identifier rubyid_data_class'>data_class</span><span class='lparen'>(</span><span class='id identifier rubyid_new_data_class'>new_data_class</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
930
+ <span class='ivar'>@data_class</span> <span class='op'>||=</span> <span class='id identifier rubyid_new_data_class'>new_data_class</span> <span class='op'>||</span> <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_singularize'>singularize</span><span class='period'>.</span><span class='id identifier rubyid_constantize'>constantize</span>
931
+ <span class='kw'>end</span></pre>
932
+ </td>
933
+ </tr>
934
+ </table>
935
+ </div>
936
+
937
+ <div class="method_details ">
938
+ <h3 class="signature " id="initialize-instance_method">
939
+
940
+ #<strong>initialize</strong>(*args, data: nil, data_class: nil, **nargs, &amp;block) &#x21d2; <tt>Object</tt>
941
+
942
+
943
+
944
+
945
+
946
+ </h3><div class="docstring">
947
+ <div class="discussion">
948
+
949
+
950
+ </div>
951
+ </div>
952
+ <div class="tags">
953
+
954
+
955
+ </div><table class="source_code">
956
+ <tr>
957
+ <td>
958
+ <pre class="lines">
959
+
960
+
961
+ 18
962
+ 19
963
+ 20
964
+ 21
965
+ 22
966
+ 23
967
+ 24
968
+ 25
969
+ 26</pre>
970
+ </td>
971
+ <td>
972
+ <pre class="code"><span class="info file"># File 'lib/compony/component_mixins/resourceful.rb', line 18</span>
973
+
974
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='label'>data:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>data_class:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_nargs'>nargs</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
975
+ <span class='ivar'>@data</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span>
976
+ <span class='ivar'>@data_class</span> <span class='op'>=</span> <span class='id identifier rubyid_data_class'>data_class</span>
977
+
978
+ <span class='comment'># Provide defaults for hook blocks
979
+ </span> <span class='ivar'>@global_load_data_block</span> <span class='op'>||=</span> <span class='id identifier rubyid_proc'>proc</span> <span class='lbrace'>{</span> <span class='ivar'>@data</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_data_class'>data_class</span><span class='period'>.</span><span class='id identifier rubyid_find'>find</span><span class='lparen'>(</span><span class='id identifier rubyid_controller'>controller</span><span class='period'>.</span><span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='symbol'>:id</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
980
+
981
+ <span class='kw'>super</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_nargs'>nargs</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
982
+ <span class='kw'>end</span></pre>
983
+ </td>
984
+ </tr>
985
+ </table>
986
+ </div>
987
+
988
+ <div class="method_details ">
989
+ <h3 class="signature " id="load_data-instance_method">
990
+
991
+ #<strong>load_data</strong>(&amp;block) &#x21d2; <tt>Object</tt> <span class="extras">(protected)</span>
992
+
993
+
994
+
995
+
996
+
997
+ </h3><div class="docstring">
998
+ <div class="discussion">
999
+
1000
+ <p>DSL method Sets a default load_data block for all standalone paths and verbs. Can be overwritten for a specific path and verb in the <span class='object_link'><a href="Default/Standalone/VerbDsl.html" title="Compony::ComponentMixins::Default::Standalone::VerbDsl (class)">Default::Standalone::VerbDsl</a></span>. The block is expected to assign <code>@data</code>.</p>
1001
+
1002
+
1003
+ </div>
1004
+ </div>
1005
+ <div class="tags">
1006
+
1007
+
1008
+ <p class="tag_title">See Also:</p>
1009
+ <ul class="see">
1010
+
1011
+ <li>Default::Standalone::VerbDsl#load_data</li>
1012
+
1013
+ </ul>
1014
+
1015
+ </div><table class="source_code">
1016
+ <tr>
1017
+ <td>
1018
+ <pre class="lines">
1019
+
1020
+
1021
+ 53
1022
+ 54
1023
+ 55</pre>
1024
+ </td>
1025
+ <td>
1026
+ <pre class="code"><span class="info file"># File 'lib/compony/component_mixins/resourceful.rb', line 53</span>
1027
+
1028
+ <span class='kw'>def</span> <span class='id identifier rubyid_load_data'>load_data</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
1029
+ <span class='ivar'>@global_load_data_block</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span>
1030
+ <span class='kw'>end</span></pre>
1031
+ </td>
1032
+ </tr>
1033
+ </table>
1034
+ </div>
1035
+
1036
+ <div class="method_details ">
1037
+ <h3 class="signature " id="resourceful?-instance_method">
1038
+
1039
+ #<strong>resourceful?</strong> &#x21d2; <tt>Boolean</tt>
1040
+
1041
+
1042
+
1043
+
1044
+
1045
+ </h3><div class="docstring">
1046
+ <div class="discussion">
1047
+
1048
+
1049
+ </div>
1050
+ </div>
1051
+ <div class="tags">
1052
+
1053
+ <p class="tag_title">Returns:</p>
1054
+ <ul class="return">
1055
+
1056
+ <li>
1057
+
1058
+
1059
+ <span class='type'>(<tt>Boolean</tt>)</span>
1060
+
1061
+
1062
+
1063
+ </li>
1064
+
1065
+ </ul>
1066
+
1067
+ </div><table class="source_code">
1068
+ <tr>
1069
+ <td>
1070
+ <pre class="lines">
1071
+
1072
+
1073
+ 41
1074
+ 42
1075
+ 43</pre>
1076
+ </td>
1077
+ <td>
1078
+ <pre class="code"><span class="info file"># File 'lib/compony/component_mixins/resourceful.rb', line 41</span>
1079
+
1080
+ <span class='kw'>def</span> <span class='id identifier rubyid_resourceful?'>resourceful?</span>
1081
+ <span class='kw'>return</span> <span class='kw'>true</span>
1082
+ <span class='kw'>end</span></pre>
1083
+ </td>
1084
+ </tr>
1085
+ </table>
1086
+ </div>
1087
+
1088
+ <div class="method_details ">
1089
+ <h3 class="signature " id="resourceful_sub_comp-instance_method">
1090
+
1091
+ #<strong>resourceful_sub_comp</strong>(component_class, **comp_opts) &#x21d2; <tt>Object</tt>
1092
+
1093
+
1094
+
1095
+
1096
+
1097
+ </h3><div class="docstring">
1098
+ <div class="discussion">
1099
+
1100
+ <p>Instanciate a component with <code>self</code> as a parent and render it, having it inherit the resource</p>
1101
+
1102
+
1103
+ </div>
1104
+ </div>
1105
+ <div class="tags">
1106
+
1107
+
1108
+ </div><table class="source_code">
1109
+ <tr>
1110
+ <td>
1111
+ <pre class="lines">
1112
+
1113
+
1114
+ 35
1115
+ 36
1116
+ 37
1117
+ 38
1118
+ 39</pre>
1119
+ </td>
1120
+ <td>
1121
+ <pre class="code"><span class="info file"># File 'lib/compony/component_mixins/resourceful.rb', line 35</span>
1122
+
1123
+ <span class='kw'>def</span> <span class='id identifier rubyid_resourceful_sub_comp'>resourceful_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>
1124
+ <span class='id identifier rubyid_comp_opts'>comp_opts</span><span class='lbracket'>[</span><span class='symbol'>:data</span><span class='rbracket'>]</span> <span class='op'>||=</span> <span class='id identifier rubyid_data'>data</span> <span class='comment'># Inject additional param before forwarding all of them to super
1125
+ </span> <span class='id identifier rubyid_comp_opts'>comp_opts</span><span class='lbracket'>[</span><span class='symbol'>:data_class</span><span class='rbracket'>]</span> <span class='op'>||=</span> <span class='id identifier rubyid_data_class'>data_class</span> <span class='comment'># Inject additional param before forwarding all of them to super
1126
+ </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>
1127
+ <span class='kw'>end</span></pre>
1128
+ </td>
1129
+ </tr>
1130
+ </table>
1131
+ </div>
1132
+
1133
+ <div class="method_details ">
1134
+ <h3 class="signature " id="store_data-instance_method">
1135
+
1136
+ #<strong>store_data</strong>(&amp;block) &#x21d2; <tt>Object</tt> <span class="extras">(protected)</span>
1137
+
1138
+
1139
+
1140
+
1141
+
1142
+ </h3><div class="docstring">
1143
+ <div class="discussion">
1144
+
1145
+ <p>DSL method Sets a default store_data block for all standalone paths and verbs. Can be overwritten for a specific path and verb in the <span class='object_link'><a href="Default/Standalone/VerbDsl.html" title="Compony::ComponentMixins::Default::Standalone::VerbDsl (class)">Default::Standalone::VerbDsl</a></span>. The block is expected save <code>@data</code> to the database.</p>
1146
+
1147
+
1148
+ </div>
1149
+ </div>
1150
+ <div class="tags">
1151
+
1152
+
1153
+ <p class="tag_title">See Also:</p>
1154
+ <ul class="see">
1155
+
1156
+ <li>Default::Standalone::VerbDsl#store_data</li>
1157
+
1158
+ </ul>
1159
+
1160
+ </div><table class="source_code">
1161
+ <tr>
1162
+ <td>
1163
+ <pre class="lines">
1164
+
1165
+
1166
+ 87
1167
+ 88
1168
+ 89</pre>
1169
+ </td>
1170
+ <td>
1171
+ <pre class="code"><span class="info file"># File 'lib/compony/component_mixins/resourceful.rb', line 87</span>
1172
+
1173
+ <span class='kw'>def</span> <span class='id identifier rubyid_store_data'>store_data</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
1174
+ <span class='ivar'>@global_store_data_block</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span>
1175
+ <span class='kw'>end</span></pre>
1176
+ </td>
1177
+ </tr>
1178
+ </table>
1179
+ </div>
1180
+
1181
+ </div>
1182
+
1183
+ </div>
1184
+
1185
+ <div id="footer">
1186
+ Generated on Wed Apr 24 17:14:06 2024 by
1187
+ <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1188
+ 0.9.34 (ruby-3.2.2).
1189
+ </div>
1190
+
1191
+ </div>
1192
+ </body>
1193
+ </html>