compony 0.2.1 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -1
  3. data/CHANGELOG.md +11 -0
  4. data/Gemfile.lock +3 -3
  5. data/README.md +1397 -33
  6. data/Rakefile +6 -2
  7. data/TODO.md +1 -0
  8. data/VERSION +1 -0
  9. data/compony.gemspec +7 -7
  10. data/doc/ComponentGenerator.html +231 -0
  11. data/doc/Components.html +105 -0
  12. data/doc/ComponentsGenerator.html +203 -0
  13. data/doc/Compony/Component.html +2098 -0
  14. data/doc/Compony/ComponentMixins/Default/Labelling.html +406 -0
  15. data/doc/Compony/ComponentMixins/Default/Standalone/ResourcefulVerbDsl.html +539 -0
  16. data/doc/Compony/ComponentMixins/Default/Standalone/StandaloneDsl.html +588 -0
  17. data/doc/Compony/ComponentMixins/Default/Standalone/VerbDsl.html +577 -0
  18. data/doc/Compony/ComponentMixins/Default/Standalone.html +692 -0
  19. data/doc/Compony/ComponentMixins/Default.html +126 -0
  20. data/doc/Compony/ComponentMixins/Resourceful.html +1193 -0
  21. data/doc/Compony/ComponentMixins.html +126 -0
  22. data/doc/Compony/Components/Button.html +293 -0
  23. data/doc/Compony/Components/Destroy.html +384 -0
  24. data/doc/Compony/Components/Edit.html +462 -0
  25. data/doc/Compony/Components/Form.html +1112 -0
  26. data/doc/Compony/Components/New.html +462 -0
  27. data/doc/Compony/Components/WithForm.html +528 -0
  28. data/doc/Compony/Components.html +126 -0
  29. data/doc/Compony/ControllerMixin.html +136 -0
  30. data/doc/Compony/Engine.html +133 -0
  31. data/doc/Compony/MethodAccessibleHash.html +453 -0
  32. data/doc/Compony/ModelFields/Anchormodel.html +387 -0
  33. data/doc/Compony/ModelFields/Association.html +613 -0
  34. data/doc/Compony/ModelFields/Attachment.html +305 -0
  35. data/doc/Compony/ModelFields/Base.html +1066 -0
  36. data/doc/Compony/ModelFields/Boolean.html +232 -0
  37. data/doc/Compony/ModelFields/Color.html +299 -0
  38. data/doc/Compony/ModelFields/Currency.html +232 -0
  39. data/doc/Compony/ModelFields/Date.html +232 -0
  40. data/doc/Compony/ModelFields/Datetime.html +232 -0
  41. data/doc/Compony/ModelFields/Decimal.html +154 -0
  42. data/doc/Compony/ModelFields/Email.html +240 -0
  43. data/doc/Compony/ModelFields/Float.html +154 -0
  44. data/doc/Compony/ModelFields/Integer.html +154 -0
  45. data/doc/Compony/ModelFields/Percentage.html +232 -0
  46. data/doc/Compony/ModelFields/Phone.html +301 -0
  47. data/doc/Compony/ModelFields/RichText.html +232 -0
  48. data/doc/Compony/ModelFields/String.html +154 -0
  49. data/doc/Compony/ModelFields/Text.html +154 -0
  50. data/doc/Compony/ModelFields/Time.html +154 -0
  51. data/doc/Compony/ModelFields/Url.html +240 -0
  52. data/doc/Compony/ModelFields.html +126 -0
  53. data/doc/Compony/ModelMixin.html +524 -0
  54. data/doc/Compony/RequestContext.html +791 -0
  55. data/doc/Compony/Version.html +139 -0
  56. data/doc/Compony/ViewHelpers.html +443 -0
  57. data/doc/Compony.html +2156 -0
  58. data/doc/ComponyController.html +124 -0
  59. data/doc/_index.html +569 -0
  60. data/doc/class_list.html +51 -0
  61. data/doc/css/common.css +1 -0
  62. data/doc/css/full_list.css +58 -0
  63. data/doc/css/style.css +497 -0
  64. data/doc/file.README.html +1565 -0
  65. data/doc/file_list.html +56 -0
  66. data/doc/frames.html +17 -0
  67. data/doc/imgs/intro-example-destroy.png +0 -0
  68. data/doc/imgs/intro-example-edit.png +0 -0
  69. data/doc/imgs/intro-example-index.png +0 -0
  70. data/doc/imgs/intro-example-new.png +0 -0
  71. data/doc/imgs/intro-example-show.png +0 -0
  72. data/doc/index.html +1565 -0
  73. data/doc/js/app.js +314 -0
  74. data/doc/js/full_list.js +216 -0
  75. data/doc/js/jquery.js +4 -0
  76. data/doc/method_list.html +1435 -0
  77. data/doc/resourceful_lifecycle.png +0 -0
  78. data/doc/top-level-namespace.html +112 -0
  79. data/lib/compony/component.rb +2 -1
  80. data/lib/compony/component_mixins/default/standalone.rb +4 -0
  81. data/lib/compony/components/with_form.rb +1 -0
  82. data/lib/compony/model_fields/anchormodel.rb +3 -23
  83. data/lib/compony/model_mixin.rb +12 -2
  84. data/lib/compony/version.rb +1 -7
  85. data/logo.svg +133 -0
  86. metadata +82 -6
data/doc/Compony.html ADDED
@@ -0,0 +1,2156 @@
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
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";
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> &raquo;
40
+
41
+
42
+ <span class="title">Compony</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
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+ <dl>
80
+ <dt>Defined in:</dt>
81
+ <dd>lib/compony.rb<span class="defines">,<br />
82
+ lib/compony/engine.rb,<br /> lib/compony/version.rb,<br /> lib/compony/component.rb,<br /> lib/compony/model_mixin.rb,<br /> lib/compony/view_helpers.rb,<br /> lib/compony/components/new.rb,<br /> lib/compony/components/edit.rb,<br /> lib/compony/components/form.rb,<br /> lib/compony/request_context.rb,<br /> lib/compony/controller_mixin.rb,<br /> lib/compony/model_fields/url.rb,<br /> lib/compony/components/button.rb,<br /> lib/compony/model_fields/base.rb,<br /> lib/compony/model_fields/date.rb,<br /> lib/compony/model_fields/text.rb,<br /> lib/compony/model_fields/time.rb,<br /> lib/compony/components/destroy.rb,<br /> lib/compony/model_fields/color.rb,<br /> lib/compony/model_fields/email.rb,<br /> lib/compony/model_fields/float.rb,<br /> lib/compony/model_fields/phone.rb,<br /> lib/compony/model_fields/string.rb,<br /> lib/compony/components/with_form.rb,<br /> lib/compony/model_fields/boolean.rb,<br /> lib/compony/model_fields/decimal.rb,<br /> lib/compony/model_fields/integer.rb,<br /> lib/compony/model_fields/currency.rb,<br /> lib/compony/model_fields/datetime.rb,<br /> lib/compony/method_accessible_hash.rb,<br /> lib/compony/model_fields/rich_text.rb,<br /> lib/compony/model_fields/attachment.rb,<br /> lib/compony/model_fields/percentage.rb,<br /> lib/compony/model_fields/anchormodel.rb,<br /> lib/compony/model_fields/association.rb,<br /> lib/compony/component_mixins/resourceful.rb,<br /> lib/compony/component_mixins/default/labelling.rb,<br /> lib/compony/component_mixins/default/standalone.rb,<br /> lib/compony/component_mixins/default/standalone/verb_dsl.rb,<br /> lib/compony/component_mixins/default/standalone/standalone_dsl.rb,<br /> lib/compony/component_mixins/default/standalone/resourceful_verb_dsl.rb</span>
83
+ </dd>
84
+ </dl>
85
+
86
+ </div>
87
+
88
+ <h2>Overview</h2><div class="docstring">
89
+ <div class="discussion">
90
+
91
+ <p>Root module, containing confguration and pure helpers. For the setters, create an initializer <code>config/initializers/compony.rb</code> and call them from there.</p>
92
+
93
+
94
+ </div>
95
+ </div>
96
+ <div class="tags">
97
+
98
+
99
+ <p class="tag_title">See Also:</p>
100
+ <ul class="see">
101
+
102
+ <li><span class='object_link'><a href="Compony/ViewHelpers.html" title="Compony::ViewHelpers (module)">Compony::ViewHelpers for helpers that require a view context and render results immediately</a></span></li>
103
+
104
+ </ul>
105
+
106
+ </div><h2>Defined Under Namespace</h2>
107
+ <p class="children">
108
+
109
+
110
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="Compony/ComponentMixins.html" title="Compony::ComponentMixins (module)">ComponentMixins</a></span>, <span class='object_link'><a href="Compony/Components.html" title="Compony::Components (module)">Components</a></span>, <span class='object_link'><a href="Compony/ControllerMixin.html" title="Compony::ControllerMixin (module)">ControllerMixin</a></span>, <span class='object_link'><a href="Compony/ModelFields.html" title="Compony::ModelFields (module)">ModelFields</a></span>, <span class='object_link'><a href="Compony/ModelMixin.html" title="Compony::ModelMixin (module)">ModelMixin</a></span>, <span class='object_link'><a href="Compony/Version.html" title="Compony::Version (module)">Version</a></span>, <span class='object_link'><a href="Compony/ViewHelpers.html" title="Compony::ViewHelpers (module)">ViewHelpers</a></span>
111
+
112
+
113
+
114
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="Compony/Component.html" title="Compony::Component (class)">Component</a></span>, <span class='object_link'><a href="Compony/Engine.html" title="Compony::Engine (class)">Engine</a></span>, <span class='object_link'><a href="Compony/MethodAccessibleHash.html" title="Compony::MethodAccessibleHash (class)">MethodAccessibleHash</a></span>, <span class='object_link'><a href="Compony/RequestContext.html" title="Compony::RequestContext (class)">RequestContext</a></span>
115
+
116
+
117
+ </p>
118
+
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+ <h2>
127
+ Class Method Summary
128
+ <small><a href="#" class="summary_toggle">collapse</a></small>
129
+ </h2>
130
+
131
+ <ul class="summary">
132
+
133
+ <li class="public ">
134
+ <span class="summary_signature">
135
+
136
+ <a href="#authentication_before_action-class_method" title="authentication_before_action (class method)">.<strong>authentication_before_action</strong> &#x21d2; Object </a>
137
+
138
+
139
+
140
+ </span>
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+ <span class="summary_desc"><div class='inline'>
151
+ <p>Getter for the name of the Rails <code>before_action</code> that enforces authentication.</p>
152
+ </div></span>
153
+
154
+ </li>
155
+
156
+
157
+ <li class="public ">
158
+ <span class="summary_signature">
159
+
160
+ <a href="#authentication_before_action=-class_method" title="authentication_before_action= (class method)">.<strong>authentication_before_action=</strong>(authentication_before_action) &#x21d2; Object </a>
161
+
162
+
163
+
164
+ </span>
165
+
166
+
167
+
168
+
169
+
170
+
171
+
172
+
173
+
174
+ <span class="summary_desc"><div class='inline'>
175
+ <p>Setter for the name of the Rails <code>before_action</code> that should be called to ensure that users are authenticated before accessing the component.</p>
176
+ </div></span>
177
+
178
+ </li>
179
+
180
+
181
+ <li class="public ">
182
+ <span class="summary_signature">
183
+
184
+ <a href="#button-class_method" title="button (class method)">.<strong>button</strong>(comp_name_or_cst, model_or_family_name_or_cst, label_opts: nil, params: nil, feasibility_action: nil, feasibility_target: nil, method: nil, **override_kwargs) &#x21d2; Object </a>
185
+
186
+
187
+
188
+ </span>
189
+
190
+
191
+
192
+
193
+
194
+
195
+
196
+
197
+
198
+ <span class="summary_desc"><div class='inline'>
199
+ <p>Given a component and a family/model, this instanciates and returns a button component.</p>
200
+ </div></span>
201
+
202
+ </li>
203
+
204
+
205
+ <li class="public ">
206
+ <span class="summary_signature">
207
+
208
+ <a href="#button_component_class-class_method" title="button_component_class (class method)">.<strong>button_component_class</strong> &#x21d2; Object </a>
209
+
210
+
211
+
212
+ </span>
213
+
214
+
215
+
216
+
217
+
218
+
219
+
220
+
221
+
222
+ <span class="summary_desc"><div class='inline'>
223
+ <p>Getter for the global button component class.</p>
224
+ </div></span>
225
+
226
+ </li>
227
+
228
+
229
+ <li class="public ">
230
+ <span class="summary_signature">
231
+
232
+ <a href="#button_component_class=-class_method" title="button_component_class= (class method)">.<strong>button_component_class=</strong>(button_component_class) &#x21d2; Object </a>
233
+
234
+
235
+
236
+ </span>
237
+
238
+
239
+
240
+
241
+
242
+
243
+
244
+
245
+
246
+ <span class="summary_desc"><div class='inline'>
247
+ <p>Setter for the global button component class.</p>
248
+ </div></span>
249
+
250
+ </li>
251
+
252
+
253
+ <li class="public ">
254
+ <span class="summary_signature">
255
+
256
+ <a href="#button_defaults-class_method" title="button_defaults (class method)">.<strong>button_defaults</strong> &#x21d2; Object </a>
257
+
258
+
259
+
260
+ </span>
261
+
262
+
263
+
264
+
265
+
266
+
267
+
268
+
269
+
270
+ <span class="summary_desc"><div class='inline'>
271
+ <p>Getter for current button defaults.</p>
272
+ </div></span>
273
+
274
+ </li>
275
+
276
+
277
+ <li class="public ">
278
+ <span class="summary_signature">
279
+
280
+ <a href="#comp_class_for-class_method" title="comp_class_for (class method)">.<strong>comp_class_for</strong>(comp_name_or_cst, model_or_family_name_or_cst) &#x21d2; Object </a>
281
+
282
+
283
+
284
+ </span>
285
+
286
+
287
+
288
+
289
+
290
+
291
+
292
+
293
+
294
+ <span class="summary_desc"><div class='inline'>
295
+ <p>Given a component and a family/model, this returns the matching component class if any, or nil if the component does not exist.</p>
296
+ </div></span>
297
+
298
+ </li>
299
+
300
+
301
+ <li class="public ">
302
+ <span class="summary_signature">
303
+
304
+ <a href="#comp_class_for!-class_method" title="comp_class_for! (class method)">.<strong>comp_class_for!</strong>(comp_name_or_cst, model_or_family_name_or_cst) &#x21d2; Object </a>
305
+
306
+
307
+
308
+ </span>
309
+
310
+
311
+
312
+
313
+
314
+
315
+
316
+
317
+
318
+ <span class="summary_desc"><div class='inline'>
319
+ <p>Same as Compony#comp_class_for but fails if none found.</p>
320
+ </div></span>
321
+
322
+ </li>
323
+
324
+
325
+ <li class="public ">
326
+ <span class="summary_signature">
327
+
328
+ <a href="#content_after_root_comp-class_method" title="content_after_root_comp (class method)">.<strong>content_after_root_comp</strong>(&amp;block) &#x21d2; Object </a>
329
+
330
+
331
+
332
+ </span>
333
+
334
+
335
+
336
+
337
+
338
+
339
+
340
+
341
+
342
+ <span class="summary_desc"><div class='inline'>
343
+ <p>Setter for a content block that runs after the root component gets rendered (standalone only).</p>
344
+ </div></span>
345
+
346
+ </li>
347
+
348
+
349
+ <li class="public ">
350
+ <span class="summary_signature">
351
+
352
+ <a href="#content_after_root_comp_block-class_method" title="content_after_root_comp_block (class method)">.<strong>content_after_root_comp_block</strong> &#x21d2; Object </a>
353
+
354
+
355
+
356
+ </span>
357
+
358
+
359
+
360
+
361
+
362
+
363
+
364
+
365
+
366
+ <span class="summary_desc"><div class='inline'>
367
+ <p>Getter for content_after_root_comp_block.</p>
368
+ </div></span>
369
+
370
+ </li>
371
+
372
+
373
+ <li class="public ">
374
+ <span class="summary_signature">
375
+
376
+ <a href="#content_before_root_comp-class_method" title="content_before_root_comp (class method)">.<strong>content_before_root_comp</strong>(&amp;block) &#x21d2; Object </a>
377
+
378
+
379
+
380
+ </span>
381
+
382
+
383
+
384
+
385
+
386
+
387
+
388
+
389
+
390
+ <span class="summary_desc"><div class='inline'>
391
+ <p>Setter for a content block that runs before the root component gets rendered (standalone only).</p>
392
+ </div></span>
393
+
394
+ </li>
395
+
396
+
397
+ <li class="public ">
398
+ <span class="summary_signature">
399
+
400
+ <a href="#content_before_root_comp_block-class_method" title="content_before_root_comp_block (class method)">.<strong>content_before_root_comp_block</strong> &#x21d2; Object </a>
401
+
402
+
403
+
404
+ </span>
405
+
406
+
407
+
408
+
409
+
410
+
411
+
412
+
413
+
414
+ <span class="summary_desc"><div class='inline'>
415
+ <p>Getter for content_before_root_comp_block.</p>
416
+ </div></span>
417
+
418
+ </li>
419
+
420
+
421
+ <li class="public ">
422
+ <span class="summary_signature">
423
+
424
+ <a href="#family_name_for-class_method" title="family_name_for (class method)">.<strong>family_name_for</strong>(model_or_family_name_or_cst) &#x21d2; Object </a>
425
+
426
+
427
+
428
+ </span>
429
+
430
+
431
+
432
+
433
+
434
+
435
+
436
+
437
+
438
+ <span class="summary_desc"><div class='inline'>
439
+ <p>Given a family name or a model-like class, this returns the suitable family name as String.</p>
440
+ </div></span>
441
+
442
+ </li>
443
+
444
+
445
+ <li class="public ">
446
+ <span class="summary_signature">
447
+
448
+ <a href="#model_field_class_for-class_method" title="model_field_class_for (class method)">.<strong>model_field_class_for</strong>(constant) &#x21d2; Object </a>
449
+
450
+
451
+
452
+ </span>
453
+
454
+
455
+
456
+
457
+
458
+
459
+
460
+
461
+
462
+ <span class="summary_desc"><div class='inline'>
463
+ <p>Goes through model_field_namespaces and returns the first hit for the given constant.</p>
464
+ </div></span>
465
+
466
+ </li>
467
+
468
+
469
+ <li class="public ">
470
+ <span class="summary_signature">
471
+
472
+ <a href="#model_field_namespaces-class_method" title="model_field_namespaces (class method)">.<strong>model_field_namespaces</strong> &#x21d2; Object </a>
473
+
474
+
475
+
476
+ </span>
477
+
478
+
479
+
480
+
481
+
482
+
483
+
484
+
485
+
486
+ <span class="summary_desc"><div class='inline'>
487
+ <p>Getter for the global field namespaces.</p>
488
+ </div></span>
489
+
490
+ </li>
491
+
492
+
493
+ <li class="public ">
494
+ <span class="summary_signature">
495
+
496
+ <a href="#model_field_namespaces=-class_method" title="model_field_namespaces= (class method)">.<strong>model_field_namespaces=</strong>(model_field_namespaces) &#x21d2; Object </a>
497
+
498
+
499
+
500
+ </span>
501
+
502
+
503
+
504
+
505
+
506
+
507
+
508
+
509
+
510
+ <span class="summary_desc"><div class='inline'>
511
+ <p>Setter for the global field namespaces.</p>
512
+ </div></span>
513
+
514
+ </li>
515
+
516
+
517
+ <li class="public ">
518
+ <span class="summary_signature">
519
+
520
+ <a href="#path-class_method" title="path (class method)">.<strong>path</strong>(comp_name_or_cst, model_or_family_name_or_cst, *args_for_path_helper, **kwargs_for_path_helper) &#x21d2; Object </a>
521
+
522
+
523
+
524
+ </span>
525
+
526
+
527
+
528
+
529
+
530
+
531
+
532
+
533
+
534
+ <span class="summary_desc"><div class='inline'>
535
+ <p>Generates a Rails path to a component.</p>
536
+ </div></span>
537
+
538
+ </li>
539
+
540
+
541
+ <li class="public ">
542
+ <span class="summary_signature">
543
+
544
+ <a href="#path_helper_name-class_method" title="path_helper_name (class method)">.<strong>path_helper_name</strong> &#x21d2; Object </a>
545
+
546
+
547
+
548
+ </span>
549
+
550
+
551
+
552
+
553
+
554
+
555
+
556
+
557
+
558
+ <span class="summary_desc"><div class='inline'>
559
+ <p>Given a component and a family, this returns the name of the Rails URL helper returning the path to this component.<br> The parameters are the same as for <span class='object_link'><a href="#rails_action_name-class_method" title="Compony.rails_action_name (method)">Compony.rails_action_name</a></span>.<br> Example usage: <code>send(&quot;#{path_helper_name(:index, :users)}_url)</code>.</p>
560
+ </div></span>
561
+
562
+ </li>
563
+
564
+
565
+ <li class="public ">
566
+ <span class="summary_signature">
567
+
568
+ <a href="#rails_action_name-class_method" title="rails_action_name (class method)">.<strong>rails_action_name</strong>(comp_name_or_cst, model_or_family_name_or_cst, name = nil) &#x21d2; Object </a>
569
+
570
+
571
+
572
+ </span>
573
+
574
+
575
+
576
+
577
+
578
+
579
+
580
+
581
+
582
+ <span class="summary_desc"><div class='inline'>
583
+ <p>Given a component and a family, this returns the name of the ComponyController action for this component.<br> Optionally can pass a name for extra standalone configs.</p>
584
+ </div></span>
585
+
586
+ </li>
587
+
588
+
589
+ <li class="public ">
590
+ <span class="summary_signature">
591
+
592
+ <a href="#root_comp-class_method" title="root_comp (class method)">.<strong>root_comp</strong> &#x21d2; Object </a>
593
+
594
+
595
+
596
+ </span>
597
+
598
+
599
+
600
+
601
+
602
+
603
+
604
+
605
+
606
+ <span class="summary_desc"><div class='inline'>
607
+ <p>Returns the current root component, if any.</p>
608
+ </div></span>
609
+
610
+ </li>
611
+
612
+
613
+ <li class="public ">
614
+ <span class="summary_signature">
615
+
616
+ <a href="#with_button_defaults-class_method" title="with_button_defaults (class method)">.<strong>with_button_defaults</strong>(**keys_to_overwrite, &amp;block) &#x21d2; Object </a>
617
+
618
+
619
+
620
+ </span>
621
+
622
+
623
+
624
+
625
+
626
+
627
+
628
+
629
+
630
+ <span class="summary_desc"><div class='inline'>
631
+ <p>Overwrites the keys of the current button defaults by the ones provided during the execution of a given block and restores them afterwords.</p>
632
+ </div></span>
633
+
634
+ </li>
635
+
636
+
637
+ </ul>
638
+
639
+
640
+
641
+
642
+ <div id="class_method_details" class="method_details_list">
643
+ <h2>Class Method Details</h2>
644
+
645
+
646
+ <div class="method_details first">
647
+ <h3 class="signature first" id="authentication_before_action-class_method">
648
+
649
+ .<strong>authentication_before_action</strong> &#x21d2; <tt>Object</tt>
650
+
651
+
652
+
653
+
654
+
655
+ </h3><div class="docstring">
656
+ <div class="discussion">
657
+
658
+ <p>Getter for the name of the Rails <code>before_action</code> that enforces authentication.</p>
659
+
660
+
661
+ </div>
662
+ </div>
663
+ <div class="tags">
664
+
665
+
666
+ <p class="tag_title">See Also:</p>
667
+ <ul class="see">
668
+
669
+ <li><span class='object_link'><a href="#authentication_before_action=-class_method" title="Compony.authentication_before_action= (method)">Explanation of authentication_before_action (documented in the corresponding setter)</a></span></li>
670
+
671
+ </ul>
672
+
673
+ </div><table class="source_code">
674
+ <tr>
675
+ <td>
676
+ <pre class="lines">
677
+
678
+
679
+ 77
680
+ 78
681
+ 79</pre>
682
+ </td>
683
+ <td>
684
+ <pre class="code"><span class="info file"># File 'lib/compony.rb', line 77</span>
685
+
686
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_authentication_before_action'>authentication_before_action</span>
687
+ <span class='ivar'>@authentication_before_action</span>
688
+ <span class='kw'>end</span></pre>
689
+ </td>
690
+ </tr>
691
+ </table>
692
+ </div>
693
+
694
+ <div class="method_details ">
695
+ <h3 class="signature " id="authentication_before_action=-class_method">
696
+
697
+ .<strong>authentication_before_action=</strong>(authentication_before_action) &#x21d2; <tt>Object</tt>
698
+
699
+
700
+
701
+
702
+
703
+ </h3><div class="docstring">
704
+ <div class="discussion">
705
+
706
+ <p>Setter for the name of the Rails <code>before_action</code> that should be called to ensure that users are authenticated before accessing the component. For instance, implement a method <code>def enforce_authentication</code> in your <code>ApplicationController</code>. In the method, make sure the user has a session and redirect to the login page if they don’t. <br> The action must be accessible by <span class='object_link'><a href="ComponyController.html" title="ComponyController (class)">ComponyController</a></span> and the easiest way to achieve this is to implement the action in your <code>ApplicationController</code>. If this is never called, authentication is disabled.</p>
707
+
708
+
709
+ </div>
710
+ </div>
711
+ <div class="tags">
712
+ <p class="tag_title">Parameters:</p>
713
+ <ul class="param">
714
+
715
+ <li>
716
+
717
+ <span class='name'>authentication_before_action</span>
718
+
719
+
720
+ <span class='type'>(<tt>Symbol</tt>)</span>
721
+
722
+
723
+
724
+ &mdash;
725
+ <div class='inline'>
726
+ <p>Name of the method you want to call for authentication</p>
727
+ </div>
728
+
729
+ </li>
730
+
731
+ </ul>
732
+
733
+
734
+ </div><table class="source_code">
735
+ <tr>
736
+ <td>
737
+ <pre class="lines">
738
+
739
+
740
+ 39
741
+ 40
742
+ 41</pre>
743
+ </td>
744
+ <td>
745
+ <pre class="code"><span class="info file"># File 'lib/compony.rb', line 39</span>
746
+
747
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_authentication_before_action='>authentication_before_action=</span><span class='lparen'>(</span><span class='id identifier rubyid_authentication_before_action'>authentication_before_action</span><span class='rparen'>)</span>
748
+ <span class='ivar'>@authentication_before_action</span> <span class='op'>=</span> <span class='id identifier rubyid_authentication_before_action'>authentication_before_action</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
749
+ <span class='kw'>end</span></pre>
750
+ </td>
751
+ </tr>
752
+ </table>
753
+ </div>
754
+
755
+ <div class="method_details ">
756
+ <h3 class="signature " id="button-class_method">
757
+
758
+ .<strong>button</strong>(comp_name_or_cst, model_or_family_name_or_cst, label_opts: nil, params: nil, feasibility_action: nil, feasibility_target: nil, method: nil, **override_kwargs) &#x21d2; <tt>Object</tt>
759
+
760
+
761
+
762
+
763
+
764
+ </h3><div class="docstring">
765
+ <div class="discussion">
766
+
767
+ <p>Given a component and a family/model, this instanciates and returns a button component.</p>
768
+
769
+
770
+ </div>
771
+ </div>
772
+ <div class="tags">
773
+ <p class="tag_title">Parameters:</p>
774
+ <ul class="param">
775
+
776
+ <li>
777
+
778
+ <span class='name'>comp_name_or_cst</span>
779
+
780
+
781
+ <span class='type'>(<tt>String</tt>, <tt>Symbol</tt>)</span>
782
+
783
+
784
+
785
+ &mdash;
786
+ <div class='inline'>
787
+ <p>The component that should be loaded, for instance <code>ShowForAll</code>, <code>&#39;ShowForAll&#39;</code> or <code>:show_for_all</code></p>
788
+ </div>
789
+
790
+ </li>
791
+
792
+ <li>
793
+
794
+ <span class='name'>model_or_family_name_or_cst</span>
795
+
796
+
797
+ <span class='type'>(<tt>String</tt>, <tt>Symbol</tt>, <tt>ApplicationRecord</tt>)</span>
798
+
799
+
800
+
801
+ &mdash;
802
+ <div class='inline'>
803
+ <p>Either the family that contains the requested component, or an instance implementing <code>model_name</code> from which the family name is auto-generated. Examples: <code>Users</code>, <code>&#39;Users&#39;</code>, <code>:users</code>, <code>User.first</code></p>
804
+ </div>
805
+
806
+ </li>
807
+
808
+ <li>
809
+
810
+ <span class='name'>label_opts</span>
811
+
812
+
813
+ <span class='type'>(<tt>Hash</tt>)</span>
814
+
815
+
816
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
817
+
818
+
819
+ &mdash;
820
+ <div class='inline'>
821
+ <p>Options hash that will be passed to the label method (see <span class='object_link'><a href="Compony/ComponentMixins/Default/Labelling.html#label-instance_method" title="Compony::ComponentMixins::Default::Labelling#label (method)">Compony::ComponentMixins::Default::Labelling#label</a></span>)</p>
822
+ </div>
823
+
824
+ </li>
825
+
826
+ <li>
827
+
828
+ <span class='name'>params</span>
829
+
830
+
831
+ <span class='type'>(<tt>Hash</tt>)</span>
832
+
833
+
834
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
835
+
836
+
837
+ &mdash;
838
+ <div class='inline'>
839
+ <p>GET parameters to be inclued into the path this button points to. Special case: e.g. format: :pdf -&gt; some.url/foo/bar.pdf</p>
840
+ </div>
841
+
842
+ </li>
843
+
844
+ <li>
845
+
846
+ <span class='name'>feasibility_action</span>
847
+
848
+
849
+ <span class='type'>(<tt>Symbol</tt>)</span>
850
+
851
+
852
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
853
+
854
+
855
+ &mdash;
856
+ <div class='inline'>
857
+ <p>Name of the feasibility action that should be checked for this button, defaults to the component name</p>
858
+ </div>
859
+
860
+ </li>
861
+
862
+ <li>
863
+
864
+ <span class='name'>feasibility_target</span>
865
+
866
+
867
+ <span class='type'>(<tt>Symbol</tt>)</span>
868
+
869
+
870
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
871
+
872
+
873
+ &mdash;
874
+ <div class='inline'>
875
+ <p>Name of the feasibility target (subject) that the feasibility should be checked on, defaults to the model if given</p>
876
+ </div>
877
+
878
+ </li>
879
+
880
+ <li>
881
+
882
+ <span class='name'>override_kwargs</span>
883
+
884
+
885
+ <span class='type'>(<tt>Hash</tt>)</span>
886
+
887
+
888
+
889
+ &mdash;
890
+ <div class='inline'>
891
+ <p>Override button options, see options for <span class='object_link'><a href="Compony/Components/Button.html" title="Compony::Components::Button (class)">Compony::Components::Button</a></span></p>
892
+ </div>
893
+
894
+ </li>
895
+
896
+ </ul>
897
+
898
+
899
+ <p class="tag_title">See Also:</p>
900
+ <ul class="see">
901
+
902
+ <li><span class='object_link'><a href="Compony/ViewHelpers.html#compony_button-instance_method" title="Compony::ViewHelpers#compony_button (method)">View helper providing a wrapper for this method that immediately renders a button.</a></span></li>
903
+
904
+ <li><span class='object_link'><a href="Compony/Components/Button.html" title="Compony::Components::Button (class)">Compony::Components::Button: the default underlying implementation</a></span></li>
905
+
906
+ </ul>
907
+
908
+ </div><table class="source_code">
909
+ <tr>
910
+ <td>
911
+ <pre class="lines">
912
+
913
+
914
+ 168
915
+ 169
916
+ 170
917
+ 171
918
+ 172
919
+ 173
920
+ 174
921
+ 175
922
+ 176
923
+ 177
924
+ 178
925
+ 179
926
+ 180
927
+ 181
928
+ 182
929
+ 183
930
+ 184
931
+ 185
932
+ 186
933
+ 187
934
+ 188
935
+ 189
936
+ 190
937
+ 191
938
+ 192
939
+ 193
940
+ 194
941
+ 195
942
+ 196
943
+ 197
944
+ 198</pre>
945
+ </td>
946
+ <td>
947
+ <pre class="code"><span class="info file"># File 'lib/compony.rb', line 168</span>
948
+
949
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_button'>button</span><span class='lparen'>(</span><span class='id identifier rubyid_comp_name_or_cst'>comp_name_or_cst</span><span class='comma'>,</span>
950
+ <span class='id identifier rubyid_model_or_family_name_or_cst'>model_or_family_name_or_cst</span><span class='comma'>,</span>
951
+ <span class='label'>label_opts:</span> <span class='kw'>nil</span><span class='comma'>,</span>
952
+ <span class='label'>params:</span> <span class='kw'>nil</span><span class='comma'>,</span>
953
+ <span class='label'>feasibility_action:</span> <span class='kw'>nil</span><span class='comma'>,</span>
954
+ <span class='label'>feasibility_target:</span> <span class='kw'>nil</span><span class='comma'>,</span>
955
+ <span class='label'>method:</span> <span class='kw'>nil</span><span class='comma'>,</span>
956
+ <span class='op'>**</span><span class='id identifier rubyid_override_kwargs'>override_kwargs</span><span class='rparen'>)</span>
957
+ <span class='id identifier rubyid_label_opts'>label_opts</span> <span class='op'>||=</span> <span class='id identifier rubyid_button_defaults'>button_defaults</span><span class='lbracket'>[</span><span class='symbol'>:label_opts</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
958
+ <span class='id identifier rubyid_params'>params</span> <span class='op'>||=</span> <span class='id identifier rubyid_button_defaults'>button_defaults</span><span class='lbracket'>[</span><span class='symbol'>:params</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
959
+ <span class='id identifier rubyid_model'>model</span> <span class='op'>=</span> <span class='id identifier rubyid_model_or_family_name_or_cst'>model_or_family_name_or_cst</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:model_name</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_model_or_family_name_or_cst'>model_or_family_name_or_cst</span> <span class='op'>:</span> <span class='kw'>nil</span>
960
+ <span class='id identifier rubyid_target_comp_instance'>target_comp_instance</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="" 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="#comp_class_for!-class_method" title="Compony.comp_class_for! (method)">comp_class_for!</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_comp_name_or_cst'>comp_name_or_cst</span><span class='comma'>,</span> <span class='id identifier rubyid_model_or_family_name_or_cst'>model_or_family_name_or_cst</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='label'>data:</span> <span class='id identifier rubyid_model'>model</span><span class='rparen'>)</span>
961
+ <span class='id identifier rubyid_feasibility_action'>feasibility_action</span> <span class='op'>||=</span> <span class='id identifier rubyid_button_defaults'>button_defaults</span><span class='lbracket'>[</span><span class='symbol'>:feasibility_action</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='id identifier rubyid_comp_name_or_cst'>comp_name_or_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><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
962
+ <span class='id identifier rubyid_feasibility_target'>feasibility_target</span> <span class='op'>||=</span> <span class='id identifier rubyid_button_defaults'>button_defaults</span><span class='lbracket'>[</span><span class='symbol'>:feasibility_target</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='id identifier rubyid_model'>model</span>
963
+ <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span>
964
+ <span class='label'>label:</span> <span class='id identifier rubyid_target_comp_instance'>target_comp_instance</span><span class='period'>.</span><span class='id identifier rubyid_label'>label</span><span class='lparen'>(</span><span class='id identifier rubyid_model'>model</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_label_opts'>label_opts</span><span class='rparen'>)</span><span class='comma'>,</span>
965
+ <span class='label'>icon:</span> <span class='id identifier rubyid_target_comp_instance'>target_comp_instance</span><span class='period'>.</span><span class='id identifier rubyid_icon'>icon</span><span class='comma'>,</span>
966
+ <span class='label'>color:</span> <span class='id identifier rubyid_target_comp_instance'>target_comp_instance</span><span class='period'>.</span><span class='id identifier rubyid_color'>color</span><span class='comma'>,</span>
967
+ <span class='label'>path:</span> <span class='const'><span class='object_link'><a href="" title="Compony (module)">Compony</a></span></span><span class='period'>.</span><span class='id identifier rubyid_path'><span class='object_link'><a href="#path-class_method" title="Compony.path (method)">path</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_target_comp_instance'>target_comp_instance</span><span class='period'>.</span><span class='id identifier rubyid_comp_name'>comp_name</span><span class='comma'>,</span> <span class='id identifier rubyid_target_comp_instance'>target_comp_instance</span><span class='period'>.</span><span class='id identifier rubyid_family_name'>family_name</span><span class='comma'>,</span> <span class='id identifier rubyid_model'>model</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_params'>params</span><span class='rparen'>)</span><span class='comma'>,</span>
968
+ <span class='label'>method:</span><span class='comma'>,</span>
969
+ <span class='label'>visible:</span> <span class='tlambda'>-&gt;</span><span class='lparen'>(</span><span class='id identifier rubyid_controller'>controller</span><span class='rparen'>)</span> <span class='tlambeg'>{</span> <span class='id identifier rubyid_target_comp_instance'>target_comp_instance</span><span class='period'>.</span><span class='id identifier rubyid_standalone_access_permitted_for?'>standalone_access_permitted_for?</span><span class='lparen'>(</span><span class='id identifier rubyid_controller'>controller</span><span class='comma'>,</span> <span class='label'>verb:</span> <span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
970
+ <span class='rbrace'>}</span>
971
+ <span class='kw'>if</span> <span class='id identifier rubyid_feasibility_target'>feasibility_target</span>
972
+ <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='lbrace'>{</span>
973
+ <span class='label'>enabled:</span> <span class='id identifier rubyid_feasibility_target'>feasibility_target</span><span class='period'>.</span><span class='id identifier rubyid_feasible?'>feasible?</span><span class='lparen'>(</span><span class='id identifier rubyid_feasibility_action'>feasibility_action</span><span class='rparen'>)</span><span class='comma'>,</span>
974
+ <span class='label'>title:</span> <span class='id identifier rubyid_feasibility_target'>feasibility_target</span><span class='period'>.</span><span class='id identifier rubyid_full_feasibility_messages'>full_feasibility_messages</span><span class='lparen'>(</span><span class='id identifier rubyid_feasibility_action'>feasibility_action</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_presence'>presence</span>
975
+ <span class='rbrace'>}</span><span class='rparen'>)</span>
976
+ <span class='kw'>end</span>
977
+ <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='id identifier rubyid_override_kwargs'>override_kwargs</span><span class='period'>.</span><span class='id identifier rubyid_symbolize_keys'>symbolize_keys</span><span class='rparen'>)</span>
978
+ <span class='kw'>return</span> <span class='const'><span class='object_link'><a href="" title="Compony (module)">Compony</a></span></span><span class='period'>.</span><span class='id identifier rubyid_button_component_class'><span class='object_link'><a href="#button_component_class-class_method" title="Compony.button_component_class (method)">button_component_class</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='op'>**</span><span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_symbolize_keys'>symbolize_keys</span><span class='rparen'>)</span>
979
+ <span class='kw'>end</span></pre>
980
+ </td>
981
+ </tr>
982
+ </table>
983
+ </div>
984
+
985
+ <div class="method_details ">
986
+ <h3 class="signature " id="button_component_class-class_method">
987
+
988
+ .<strong>button_component_class</strong> &#x21d2; <tt>Object</tt>
989
+
990
+
991
+
992
+
993
+
994
+ </h3><div class="docstring">
995
+ <div class="discussion">
996
+
997
+ <p>Getter for the global button component class.</p>
998
+
999
+
1000
+ </div>
1001
+ </div>
1002
+ <div class="tags">
1003
+
1004
+
1005
+ <p class="tag_title">See Also:</p>
1006
+ <ul class="see">
1007
+
1008
+ <li><span class='object_link'><a href="#button_component_class=-class_method" title="Compony.button_component_class= (method)">Explanation of button_component_class (documented in the corresponding setter)</a></span></li>
1009
+
1010
+ </ul>
1011
+
1012
+ </div><table class="source_code">
1013
+ <tr>
1014
+ <td>
1015
+ <pre class="lines">
1016
+
1017
+
1018
+ 63
1019
+ 64
1020
+ 65
1021
+ 66
1022
+ 67</pre>
1023
+ </td>
1024
+ <td>
1025
+ <pre class="code"><span class="info file"># File 'lib/compony.rb', line 63</span>
1026
+
1027
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_button_component_class'>button_component_class</span>
1028
+ <span class='ivar'>@button_component_class</span> <span class='op'>||=</span> <span class='const'><span class='object_link'><a href="Compony/Components.html" title="Compony::Components (module)">Components</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Compony/Components/Button.html" title="Compony::Components::Button (class)">Button</a></span></span>
1029
+ <span class='ivar'>@button_component_class</span> <span class='op'>=</span> <span class='id identifier rubyid_const_get'>const_get</span><span class='lparen'>(</span><span class='ivar'>@button_component_class</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@button_component_class</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
1030
+ <span class='kw'>return</span> <span class='ivar'>@button_component_class</span>
1031
+ <span class='kw'>end</span></pre>
1032
+ </td>
1033
+ </tr>
1034
+ </table>
1035
+ </div>
1036
+
1037
+ <div class="method_details ">
1038
+ <h3 class="signature " id="button_component_class=-class_method">
1039
+
1040
+ .<strong>button_component_class=</strong>(button_component_class) &#x21d2; <tt>Object</tt>
1041
+
1042
+
1043
+
1044
+
1045
+
1046
+ </h3><div class="docstring">
1047
+ <div class="discussion">
1048
+
1049
+ <p>Setter for the global button component class. This allows you to implement a custom button component and have all Compony button helpers use your custom button component instead of <span class='object_link'><a href="Compony/Components/Button.html" title="Compony::Components::Button (class)">Compony::Components::Button</a></span>.</p>
1050
+
1051
+
1052
+ </div>
1053
+ </div>
1054
+ <div class="tags">
1055
+ <p class="tag_title">Parameters:</p>
1056
+ <ul class="param">
1057
+
1058
+ <li>
1059
+
1060
+ <span class='name'>button_component_class</span>
1061
+
1062
+
1063
+ <span class='type'>(<tt>String</tt>)</span>
1064
+
1065
+
1066
+
1067
+ &mdash;
1068
+ <div class='inline'>
1069
+ <p>Name of your custom button component class (inherit from <span class='object_link'><a href="Compony/Components/Button.html" title="Compony::Components::Button (class)">Compony::Components::Button</a></span> or <span class='object_link'><a href="Compony/Component.html" title="Compony::Component (class)">Component</a></span>)</p>
1070
+ </div>
1071
+
1072
+ </li>
1073
+
1074
+ </ul>
1075
+
1076
+
1077
+ </div><table class="source_code">
1078
+ <tr>
1079
+ <td>
1080
+ <pre class="lines">
1081
+
1082
+
1083
+ 15
1084
+ 16
1085
+ 17</pre>
1086
+ </td>
1087
+ <td>
1088
+ <pre class="code"><span class="info file"># File 'lib/compony.rb', line 15</span>
1089
+
1090
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_button_component_class='>button_component_class=</span><span class='lparen'>(</span><span class='id identifier rubyid_button_component_class'>button_component_class</span><span class='rparen'>)</span>
1091
+ <span class='ivar'>@button_component_class</span> <span class='op'>=</span> <span class='id identifier rubyid_button_component_class'>button_component_class</span>
1092
+ <span class='kw'>end</span></pre>
1093
+ </td>
1094
+ </tr>
1095
+ </table>
1096
+ </div>
1097
+
1098
+ <div class="method_details ">
1099
+ <h3 class="signature " id="button_defaults-class_method">
1100
+
1101
+ .<strong>button_defaults</strong> &#x21d2; <tt>Object</tt>
1102
+
1103
+
1104
+
1105
+
1106
+
1107
+ </h3><div class="docstring">
1108
+ <div class="discussion">
1109
+
1110
+ <div class="note todo">
1111
+ <strong>TODO:</strong>
1112
+ <div class='inline'>
1113
+ <p>document params</p>
1114
+ </div>
1115
+ </div>
1116
+
1117
+
1118
+ <p>Getter for current button defaults</p>
1119
+
1120
+
1121
+ </div>
1122
+ </div>
1123
+ <div class="tags">
1124
+
1125
+
1126
+ </div><table class="source_code">
1127
+ <tr>
1128
+ <td>
1129
+ <pre class="lines">
1130
+
1131
+
1132
+ 219
1133
+ 220
1134
+ 221</pre>
1135
+ </td>
1136
+ <td>
1137
+ <pre class="code"><span class="info file"># File 'lib/compony.rb', line 219</span>
1138
+
1139
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_button_defaults'>button_defaults</span>
1140
+ <span class='const'>RequestStore</span><span class='period'>.</span><span class='id identifier rubyid_store'>store</span><span class='lbracket'>[</span><span class='symbol'>:button_defaults</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
1141
+ <span class='kw'>end</span></pre>
1142
+ </td>
1143
+ </tr>
1144
+ </table>
1145
+ </div>
1146
+
1147
+ <div class="method_details ">
1148
+ <h3 class="signature " id="comp_class_for-class_method">
1149
+
1150
+ .<strong>comp_class_for</strong>(comp_name_or_cst, model_or_family_name_or_cst) &#x21d2; <tt>Object</tt>
1151
+
1152
+
1153
+
1154
+
1155
+
1156
+ </h3><div class="docstring">
1157
+ <div class="discussion">
1158
+
1159
+ <p>Given a component and a family/model, this returns the matching component class if any, or nil if the component does not exist.</p>
1160
+
1161
+
1162
+ </div>
1163
+ </div>
1164
+ <div class="tags">
1165
+ <p class="tag_title">Parameters:</p>
1166
+ <ul class="param">
1167
+
1168
+ <li>
1169
+
1170
+ <span class='name'>comp_name_or_cst</span>
1171
+
1172
+
1173
+ <span class='type'>(<tt>String</tt>, <tt>Symbol</tt>)</span>
1174
+
1175
+
1176
+
1177
+ &mdash;
1178
+ <div class='inline'>
1179
+ <p>The component that should be loaded, for instance <code>ShowForAll</code>, <code>&#39;ShowForAll&#39;</code> or <code>:show_for_all</code></p>
1180
+ </div>
1181
+
1182
+ </li>
1183
+
1184
+ <li>
1185
+
1186
+ <span class='name'>model_or_family_name_or_cst</span>
1187
+
1188
+
1189
+ <span class='type'>(<tt>String</tt>, <tt>Symbol</tt>, <tt>ApplicationRecord</tt>)</span>
1190
+
1191
+
1192
+
1193
+ &mdash;
1194
+ <div class='inline'>
1195
+ <p>Either the family that contains the requested component, or an instance implementing <code>model_name</code> from which the family name is auto-generated. Examples: <code>Users</code>, <code>&#39;Users&#39;</code>, <code>:users</code>, <code>User.first</code></p>
1196
+ </div>
1197
+
1198
+ </li>
1199
+
1200
+ </ul>
1201
+
1202
+
1203
+ </div><table class="source_code">
1204
+ <tr>
1205
+ <td>
1206
+ <pre class="lines">
1207
+
1208
+
1209
+ 120
1210
+ 121
1211
+ 122
1212
+ 123
1213
+ 124
1214
+ 125
1215
+ 126
1216
+ 127</pre>
1217
+ </td>
1218
+ <td>
1219
+ <pre class="code"><span class="info file"># File 'lib/compony.rb', line 120</span>
1220
+
1221
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_comp_class_for'>comp_class_for</span><span class='lparen'>(</span><span class='id identifier rubyid_comp_name_or_cst'>comp_name_or_cst</span><span class='comma'>,</span> <span class='id identifier rubyid_model_or_family_name_or_cst'>model_or_family_name_or_cst</span><span class='rparen'>)</span>
1222
+ <span class='id identifier rubyid_family_cst_str'>family_cst_str</span> <span class='op'>=</span> <span class='id identifier rubyid_family_name_for'>family_name_for</span><span class='lparen'>(</span><span class='id identifier rubyid_model_or_family_name_or_cst'>model_or_family_name_or_cst</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_camelize'>camelize</span>
1223
+ <span class='id identifier rubyid_comp_cst_str'>comp_cst_str</span> <span class='op'>=</span> <span class='id identifier rubyid_comp_name_or_cst'>comp_name_or_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_camelize'>camelize</span>
1224
+ <span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>unless</span> <span class='op'>::</span><span class='const'><span class='object_link'><a href="Components.html" title="Components (module)">Components</a></span></span><span class='period'>.</span><span class='id identifier rubyid_const_defined?'>const_defined?</span><span class='lparen'>(</span><span class='id identifier rubyid_family_cst_str'>family_cst_str</span><span class='rparen'>)</span>
1225
+ <span class='id identifier rubyid_family_constant'>family_constant</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'><span class='object_link'><a href="Components.html" title="Components (module)">Components</a></span></span><span class='period'>.</span><span class='id identifier rubyid_const_get'>const_get</span><span class='lparen'>(</span><span class='id identifier rubyid_family_cst_str'>family_cst_str</span><span class='rparen'>)</span>
1226
+ <span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>unless</span> <span class='id identifier rubyid_family_constant'>family_constant</span><span class='period'>.</span><span class='id identifier rubyid_const_defined?'>const_defined?</span><span class='lparen'>(</span><span class='id identifier rubyid_comp_cst_str'>comp_cst_str</span><span class='rparen'>)</span>
1227
+ <span class='kw'>return</span> <span class='id identifier rubyid_family_constant'>family_constant</span><span class='period'>.</span><span class='id identifier rubyid_const_get'>const_get</span><span class='lparen'>(</span><span class='id identifier rubyid_comp_cst_str'>comp_cst_str</span><span class='rparen'>)</span>
1228
+ <span class='kw'>end</span></pre>
1229
+ </td>
1230
+ </tr>
1231
+ </table>
1232
+ </div>
1233
+
1234
+ <div class="method_details ">
1235
+ <h3 class="signature " id="comp_class_for!-class_method">
1236
+
1237
+ .<strong>comp_class_for!</strong>(comp_name_or_cst, model_or_family_name_or_cst) &#x21d2; <tt>Object</tt>
1238
+
1239
+
1240
+
1241
+
1242
+
1243
+ </h3><div class="docstring">
1244
+ <div class="discussion">
1245
+
1246
+ <p>Same as Compony#comp_class_for but fails if none found</p>
1247
+
1248
+
1249
+ </div>
1250
+ </div>
1251
+ <div class="tags">
1252
+
1253
+
1254
+ <p class="tag_title">See Also:</p>
1255
+ <ul class="see">
1256
+
1257
+ <li><span class='object_link'><a href="#comp_class_for-class_method" title="Compony.comp_class_for (method)">comp_class_for</a></span></li>
1258
+
1259
+ </ul>
1260
+
1261
+ </div><table class="source_code">
1262
+ <tr>
1263
+ <td>
1264
+ <pre class="lines">
1265
+
1266
+
1267
+ 131
1268
+ 132
1269
+ 133
1270
+ 134
1271
+ 135</pre>
1272
+ </td>
1273
+ <td>
1274
+ <pre class="code"><span class="info file"># File 'lib/compony.rb', line 131</span>
1275
+
1276
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_comp_class_for!'>comp_class_for!</span><span class='lparen'>(</span><span class='id identifier rubyid_comp_name_or_cst'>comp_name_or_cst</span><span class='comma'>,</span> <span class='id identifier rubyid_model_or_family_name_or_cst'>model_or_family_name_or_cst</span><span class='rparen'>)</span>
1277
+ <span class='id identifier rubyid_comp_class_for'>comp_class_for</span><span class='lparen'>(</span><span class='id identifier rubyid_comp_name_or_cst'>comp_name_or_cst</span><span class='comma'>,</span> <span class='id identifier rubyid_model_or_family_name_or_cst'>model_or_family_name_or_cst</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_fail'>fail</span><span class='lparen'>(</span>
1278
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>No component found for [</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_comp_name_or_cst'>comp_name_or_cst</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'>, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_model_or_family_name_or_cst'>model_or_family_name_or_cst</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'>]</span><span class='tstring_end'>&quot;</span></span>
1279
+ <span class='rparen'>)</span>
1280
+ <span class='kw'>end</span></pre>
1281
+ </td>
1282
+ </tr>
1283
+ </table>
1284
+ </div>
1285
+
1286
+ <div class="method_details ">
1287
+ <h3 class="signature " id="content_after_root_comp-class_method">
1288
+
1289
+ .<strong>content_after_root_comp</strong>(&amp;block) &#x21d2; <tt>Object</tt>
1290
+
1291
+
1292
+
1293
+
1294
+
1295
+ </h3><div class="docstring">
1296
+ <div class="discussion">
1297
+
1298
+ <p>Setter for a content block that runs after the root component gets rendered (standalone only). Usage is the same as <code>content</code>. The block runs after <code>render</code>, i.e. after the last <code>content</code> block.</p>
1299
+
1300
+
1301
+ </div>
1302
+ </div>
1303
+ <div class="tags">
1304
+
1305
+
1306
+ </div><table class="source_code">
1307
+ <tr>
1308
+ <td>
1309
+ <pre class="lines">
1310
+
1311
+
1312
+ 52
1313
+ 53
1314
+ 54
1315
+ 55</pre>
1316
+ </td>
1317
+ <td>
1318
+ <pre class="code"><span class="info file"># File 'lib/compony.rb', line 52</span>
1319
+
1320
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_content_after_root_comp'>content_after_root_comp</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
1321
+ <span class='id identifier rubyid_fail'>fail</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>`Compony.content_after` requires a block.</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
1322
+ <span class='ivar'>@content_after_root_comp_block</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span>
1323
+ <span class='kw'>end</span></pre>
1324
+ </td>
1325
+ </tr>
1326
+ </table>
1327
+ </div>
1328
+
1329
+ <div class="method_details ">
1330
+ <h3 class="signature " id="content_after_root_comp_block-class_method">
1331
+
1332
+ .<strong>content_after_root_comp_block</strong> &#x21d2; <tt>Object</tt>
1333
+
1334
+
1335
+
1336
+
1337
+
1338
+ </h3><div class="docstring">
1339
+ <div class="discussion">
1340
+
1341
+ <p>Getter for content_after_root_comp_block</p>
1342
+
1343
+
1344
+ </div>
1345
+ </div>
1346
+ <div class="tags">
1347
+
1348
+
1349
+ <p class="tag_title">See Also:</p>
1350
+ <ul class="see">
1351
+
1352
+ <li><span class='object_link'><a href="#content_after_root_comp-class_method" title="Compony.content_after_root_comp (method)">content_after_root_comp</a></span></li>
1353
+
1354
+ </ul>
1355
+
1356
+ </div><table class="source_code">
1357
+ <tr>
1358
+ <td>
1359
+ <pre class="lines">
1360
+
1361
+
1362
+ 89
1363
+ 90
1364
+ 91</pre>
1365
+ </td>
1366
+ <td>
1367
+ <pre class="code"><span class="info file"># File 'lib/compony.rb', line 89</span>
1368
+
1369
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_content_after_root_comp_block'>content_after_root_comp_block</span>
1370
+ <span class='ivar'>@content_after_root_comp_block</span>
1371
+ <span class='kw'>end</span></pre>
1372
+ </td>
1373
+ </tr>
1374
+ </table>
1375
+ </div>
1376
+
1377
+ <div class="method_details ">
1378
+ <h3 class="signature " id="content_before_root_comp-class_method">
1379
+
1380
+ .<strong>content_before_root_comp</strong>(&amp;block) &#x21d2; <tt>Object</tt>
1381
+
1382
+
1383
+
1384
+
1385
+
1386
+ </h3><div class="docstring">
1387
+ <div class="discussion">
1388
+
1389
+ <p>Setter for a content block that runs before the root component gets rendered (standalone only). Usage is the same as <code>content</code>. The block runs between <code>before_render</code> and <code>render</code>, i.e. before the first <code>content</code> block.</p>
1390
+
1391
+
1392
+ </div>
1393
+ </div>
1394
+ <div class="tags">
1395
+
1396
+
1397
+ </div><table class="source_code">
1398
+ <tr>
1399
+ <td>
1400
+ <pre class="lines">
1401
+
1402
+
1403
+ 45
1404
+ 46
1405
+ 47
1406
+ 48</pre>
1407
+ </td>
1408
+ <td>
1409
+ <pre class="code"><span class="info file"># File 'lib/compony.rb', line 45</span>
1410
+
1411
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_content_before_root_comp'>content_before_root_comp</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
1412
+ <span class='id identifier rubyid_fail'>fail</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>`Compony.content_before` requires a block.</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
1413
+ <span class='ivar'>@content_before_root_comp_block</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span>
1414
+ <span class='kw'>end</span></pre>
1415
+ </td>
1416
+ </tr>
1417
+ </table>
1418
+ </div>
1419
+
1420
+ <div class="method_details ">
1421
+ <h3 class="signature " id="content_before_root_comp_block-class_method">
1422
+
1423
+ .<strong>content_before_root_comp_block</strong> &#x21d2; <tt>Object</tt>
1424
+
1425
+
1426
+
1427
+
1428
+
1429
+ </h3><div class="docstring">
1430
+ <div class="discussion">
1431
+
1432
+ <p>Getter for content_before_root_comp_block</p>
1433
+
1434
+
1435
+ </div>
1436
+ </div>
1437
+ <div class="tags">
1438
+
1439
+
1440
+ <p class="tag_title">See Also:</p>
1441
+ <ul class="see">
1442
+
1443
+ <li><span class='object_link'><a href="#content_before_root_comp-class_method" title="Compony.content_before_root_comp (method)">content_before_root_comp</a></span></li>
1444
+
1445
+ </ul>
1446
+
1447
+ </div><table class="source_code">
1448
+ <tr>
1449
+ <td>
1450
+ <pre class="lines">
1451
+
1452
+
1453
+ 83
1454
+ 84
1455
+ 85</pre>
1456
+ </td>
1457
+ <td>
1458
+ <pre class="code"><span class="info file"># File 'lib/compony.rb', line 83</span>
1459
+
1460
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_content_before_root_comp_block'>content_before_root_comp_block</span>
1461
+ <span class='ivar'>@content_before_root_comp_block</span>
1462
+ <span class='kw'>end</span></pre>
1463
+ </td>
1464
+ </tr>
1465
+ </table>
1466
+ </div>
1467
+
1468
+ <div class="method_details ">
1469
+ <h3 class="signature " id="family_name_for-class_method">
1470
+
1471
+ .<strong>family_name_for</strong>(model_or_family_name_or_cst) &#x21d2; <tt>Object</tt>
1472
+
1473
+
1474
+
1475
+
1476
+
1477
+ </h3><div class="docstring">
1478
+ <div class="discussion">
1479
+
1480
+ <p>Given a family name or a model-like class, this returns the suitable family name as String.</p>
1481
+
1482
+
1483
+ </div>
1484
+ </div>
1485
+ <div class="tags">
1486
+ <p class="tag_title">Parameters:</p>
1487
+ <ul class="param">
1488
+
1489
+ <li>
1490
+
1491
+ <span class='name'>model_or_family_name_or_cst</span>
1492
+
1493
+
1494
+ <span class='type'>(<tt>String</tt>, <tt>Symbol</tt>, <tt>ApplicationRecord</tt>)</span>
1495
+
1496
+
1497
+
1498
+ &mdash;
1499
+ <div class='inline'>
1500
+ <p>Either the family that contains the requested component, or an instance implementing <code>model_name</code> from which the family name is auto-generated. Examples: <code>Users</code>, <code>&#39;Users&#39;</code>, <code>:users</code>, <code>User.first</code></p>
1501
+ </div>
1502
+
1503
+ </li>
1504
+
1505
+ </ul>
1506
+
1507
+
1508
+ </div><table class="source_code">
1509
+ <tr>
1510
+ <td>
1511
+ <pre class="lines">
1512
+
1513
+
1514
+ 209
1515
+ 210
1516
+ 211
1517
+ 212
1518
+ 213
1519
+ 214
1520
+ 215</pre>
1521
+ </td>
1522
+ <td>
1523
+ <pre class="code"><span class="info file"># File 'lib/compony.rb', line 209</span>
1524
+
1525
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_family_name_for'>family_name_for</span><span class='lparen'>(</span><span class='id identifier rubyid_model_or_family_name_or_cst'>model_or_family_name_or_cst</span><span class='rparen'>)</span>
1526
+ <span class='kw'>if</span> <span class='id identifier rubyid_model_or_family_name_or_cst'>model_or_family_name_or_cst</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:model_name</span><span class='rparen'>)</span>
1527
+ <span class='kw'>return</span> <span class='id identifier rubyid_model_or_family_name_or_cst'>model_or_family_name_or_cst</span><span class='period'>.</span><span class='id identifier rubyid_model_name'>model_name</span><span class='period'>.</span><span class='id identifier rubyid_plural'>plural</span>
1528
+ <span class='kw'>else</span>
1529
+ <span class='kw'>return</span> <span class='id identifier rubyid_model_or_family_name_or_cst'>model_or_family_name_or_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>
1530
+ <span class='kw'>end</span>
1531
+ <span class='kw'>end</span></pre>
1532
+ </td>
1533
+ </tr>
1534
+ </table>
1535
+ </div>
1536
+
1537
+ <div class="method_details ">
1538
+ <h3 class="signature " id="model_field_class_for-class_method">
1539
+
1540
+ .<strong>model_field_class_for</strong>(constant) &#x21d2; <tt>Object</tt>
1541
+
1542
+
1543
+
1544
+
1545
+
1546
+ </h3><div class="docstring">
1547
+ <div class="discussion">
1548
+
1549
+ <p>Goes through model_field_namespaces and returns the first hit for the given constant</p>
1550
+
1551
+
1552
+ </div>
1553
+ </div>
1554
+ <div class="tags">
1555
+ <p class="tag_title">Parameters:</p>
1556
+ <ul class="param">
1557
+
1558
+ <li>
1559
+
1560
+ <span class='name'>constant</span>
1561
+
1562
+
1563
+ <span class='type'>(<tt>Constant</tt>)</span>
1564
+
1565
+
1566
+
1567
+ &mdash;
1568
+ <div class='inline'>
1569
+ <p>The constant that is searched, e.g. RichText -&gt; would return e.g. Compony::ModelFields::RichText</p>
1570
+ </div>
1571
+
1572
+ </li>
1573
+
1574
+ </ul>
1575
+
1576
+
1577
+ </div><table class="source_code">
1578
+ <tr>
1579
+ <td>
1580
+ <pre class="lines">
1581
+
1582
+
1583
+ 250
1584
+ 251
1585
+ 252
1586
+ 253
1587
+ 254
1588
+ 255
1589
+ 256
1590
+ 257
1591
+ 258</pre>
1592
+ </td>
1593
+ <td>
1594
+ <pre class="code"><span class="info file"># File 'lib/compony.rb', line 250</span>
1595
+
1596
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_model_field_class_for'>model_field_class_for</span><span class='lparen'>(</span><span class='id identifier rubyid_constant'>constant</span><span class='rparen'>)</span>
1597
+ <span class='id identifier rubyid_model_field_namespaces'>model_field_namespaces</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_model_field_namespace'>model_field_namespace</span><span class='op'>|</span>
1598
+ <span class='id identifier rubyid_model_field_namespace'>model_field_namespace</span> <span class='op'>=</span> <span class='id identifier rubyid_model_field_namespace'>model_field_namespace</span><span class='period'>.</span><span class='id identifier rubyid_constantize'>constantize</span> <span class='kw'>if</span> <span class='id identifier rubyid_model_field_namespace'>model_field_namespace</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>String</span><span class='rparen'>)</span>
1599
+ <span class='kw'>if</span> <span class='id identifier rubyid_model_field_namespace'>model_field_namespace</span><span class='period'>.</span><span class='id identifier rubyid_const_defined?'>const_defined?</span><span class='lparen'>(</span><span class='id identifier rubyid_constant'>constant</span><span class='comma'>,</span> <span class='kw'>false</span><span class='rparen'>)</span>
1600
+ <span class='kw'>return</span> <span class='id identifier rubyid_model_field_namespace'>model_field_namespace</span><span class='period'>.</span><span class='id identifier rubyid_const_get'>const_get</span><span class='lparen'>(</span><span class='id identifier rubyid_constant'>constant</span><span class='comma'>,</span> <span class='kw'>false</span><span class='rparen'>)</span>
1601
+ <span class='kw'>end</span>
1602
+ <span class='kw'>end</span>
1603
+ <span class='id identifier rubyid_fail'>fail</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>No `model_field_namespace` implements ...::</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_constant'>constant</span><span class='embexpr_end'>}</span><span class='tstring_content'>. Configured namespaces: </span><span class='embexpr_beg'>#{</span><span class='const'><span class='object_link'><a href="" title="Compony (module)">Compony</a></span></span><span class='period'>.</span><span class='id identifier rubyid_model_field_namespaces'><span class='object_link'><a href="#model_field_namespaces-class_method" title="Compony.model_field_namespaces (method)">model_field_namespaces</a></span></span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1604
+ <span class='kw'>end</span></pre>
1605
+ </td>
1606
+ </tr>
1607
+ </table>
1608
+ </div>
1609
+
1610
+ <div class="method_details ">
1611
+ <h3 class="signature " id="model_field_namespaces-class_method">
1612
+
1613
+ .<strong>model_field_namespaces</strong> &#x21d2; <tt>Object</tt>
1614
+
1615
+
1616
+
1617
+
1618
+
1619
+ </h3><div class="docstring">
1620
+ <div class="discussion">
1621
+
1622
+ <p>Getter for the global field namespaces.</p>
1623
+
1624
+
1625
+ </div>
1626
+ </div>
1627
+ <div class="tags">
1628
+
1629
+
1630
+ <p class="tag_title">See Also:</p>
1631
+ <ul class="see">
1632
+
1633
+ <li><span class='object_link'><a href="#model_field_namespaces=-class_method" title="Compony.model_field_namespaces= (method)">Explanation of model_field_namespaces (documented in the corresponding setter)</a></span></li>
1634
+
1635
+ </ul>
1636
+
1637
+ </div><table class="source_code">
1638
+ <tr>
1639
+ <td>
1640
+ <pre class="lines">
1641
+
1642
+
1643
+ 71
1644
+ 72
1645
+ 73</pre>
1646
+ </td>
1647
+ <td>
1648
+ <pre class="code"><span class="info file"># File 'lib/compony.rb', line 71</span>
1649
+
1650
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_model_field_namespaces'>model_field_namespaces</span>
1651
+ <span class='kw'>return</span> <span class='ivar'>@model_field_namespaces</span> <span class='op'>||=</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Compony::ModelFields</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
1652
+ <span class='kw'>end</span></pre>
1653
+ </td>
1654
+ </tr>
1655
+ </table>
1656
+ </div>
1657
+
1658
+ <div class="method_details ">
1659
+ <h3 class="signature " id="model_field_namespaces=-class_method">
1660
+
1661
+ .<strong>model_field_namespaces=</strong>(model_field_namespaces) &#x21d2; <tt>Object</tt>
1662
+
1663
+
1664
+
1665
+
1666
+
1667
+ </h3><div class="docstring">
1668
+ <div class="discussion">
1669
+
1670
+ <p>Setter for the global field namespaces. This allows you to implement custom Fields, be it new ones or overrides for existing Compony model fields. Must give an array of strings of namespaces that contain field classes named after the field type. The array is queried in order, if the first namespace does not contain the class we’re looking for, the next is considered and so on. The classes defined in the namespace must inherit from Compony::ModelFields::Base</p>
1671
+
1672
+
1673
+ </div>
1674
+ </div>
1675
+ <div class="tags">
1676
+ <p class="tag_title">Parameters:</p>
1677
+ <ul class="param">
1678
+
1679
+ <li>
1680
+
1681
+ <span class='name'>model_field_namespaces</span>
1682
+
1683
+
1684
+ <span class='type'>(<tt>Array</tt>)</span>
1685
+
1686
+
1687
+
1688
+ &mdash;
1689
+ <div class='inline'>
1690
+ <p>Array of strings, the names of the namespaces in the order they should be searched</p>
1691
+ </div>
1692
+
1693
+ </li>
1694
+
1695
+ </ul>
1696
+
1697
+
1698
+ </div><table class="source_code">
1699
+ <tr>
1700
+ <td>
1701
+ <pre class="lines">
1702
+
1703
+
1704
+ 26
1705
+ 27
1706
+ 28</pre>
1707
+ </td>
1708
+ <td>
1709
+ <pre class="code"><span class="info file"># File 'lib/compony.rb', line 26</span>
1710
+
1711
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_model_field_namespaces='>model_field_namespaces=</span><span class='lparen'>(</span><span class='id identifier rubyid_model_field_namespaces'>model_field_namespaces</span><span class='rparen'>)</span>
1712
+ <span class='ivar'>@model_field_namespaces</span> <span class='op'>=</span> <span class='id identifier rubyid_model_field_namespaces'>model_field_namespaces</span>
1713
+ <span class='kw'>end</span></pre>
1714
+ </td>
1715
+ </tr>
1716
+ </table>
1717
+ </div>
1718
+
1719
+ <div class="method_details ">
1720
+ <h3 class="signature " id="path-class_method">
1721
+
1722
+ .<strong>path</strong>(comp_name_or_cst, model_or_family_name_or_cst, *args_for_path_helper, **kwargs_for_path_helper) &#x21d2; <tt>Object</tt>
1723
+
1724
+
1725
+
1726
+
1727
+
1728
+ </h3><div class="docstring">
1729
+ <div class="discussion">
1730
+
1731
+ <p>Generates a Rails path to a component. Examples: <code>Compony.path(:index, :users)</code>, <code>Compony.path(:show, User.first)</code></p>
1732
+
1733
+
1734
+ </div>
1735
+ </div>
1736
+ <div class="tags">
1737
+ <p class="tag_title">Parameters:</p>
1738
+ <ul class="param">
1739
+
1740
+ <li>
1741
+
1742
+ <span class='name'>comp_name_or_cst</span>
1743
+
1744
+
1745
+ <span class='type'>(<tt>String</tt>, <tt>Symbol</tt>)</span>
1746
+
1747
+
1748
+
1749
+ &mdash;
1750
+ <div class='inline'>
1751
+ <p>The component that should be loaded, for instance <code>ShowForAll</code>, <code>&#39;ShowForAll&#39;</code> or <code>:show_for_all</code></p>
1752
+ </div>
1753
+
1754
+ </li>
1755
+
1756
+ <li>
1757
+
1758
+ <span class='name'>model_or_family_name_or_cst</span>
1759
+
1760
+
1761
+ <span class='type'>(<tt>String</tt>, <tt>Symbol</tt>, <tt>ApplicationRecord</tt>)</span>
1762
+
1763
+
1764
+
1765
+ &mdash;
1766
+ <div class='inline'>
1767
+ <p>Either the family that contains the requested component, or an instance implementing <code>model_name</code> from which the family name is auto-generated. Examples: <code>Users</code>, <code>&#39;Users&#39;</code>, <code>:users</code>, <code>User.first</code></p>
1768
+ </div>
1769
+
1770
+ </li>
1771
+
1772
+ <li>
1773
+
1774
+ <span class='name'>args_for_path_helper</span>
1775
+
1776
+
1777
+ <span class='type'>(<tt>Array</tt>)</span>
1778
+
1779
+
1780
+
1781
+ &mdash;
1782
+ <div class='inline'>
1783
+ <p>Positional arguments passed to the Rails helper</p>
1784
+ </div>
1785
+
1786
+ </li>
1787
+
1788
+ <li>
1789
+
1790
+ <span class='name'>kwargs_for_path_helper</span>
1791
+
1792
+
1793
+ <span class='type'>(<tt>Hash</tt>)</span>
1794
+
1795
+
1796
+
1797
+ &mdash;
1798
+ <div class='inline'>
1799
+ <p>Named arguments passed to the Rails helper. If a model is given to <code>model_or_family_name_or_cst</code>, the param <code>id</code> defaults to the passed model’s ID.</p>
1800
+ </div>
1801
+
1802
+ </li>
1803
+
1804
+ </ul>
1805
+
1806
+
1807
+ </div><table class="source_code">
1808
+ <tr>
1809
+ <td>
1810
+ <pre class="lines">
1811
+
1812
+
1813
+ 105
1814
+ 106
1815
+ 107
1816
+ 108
1817
+ 109
1818
+ 110
1819
+ 111
1820
+ 112
1821
+ 113</pre>
1822
+ </td>
1823
+ <td>
1824
+ <pre class="code"><span class="info file"># File 'lib/compony.rb', line 105</span>
1825
+
1826
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span><span class='lparen'>(</span><span class='id identifier rubyid_comp_name_or_cst'>comp_name_or_cst</span><span class='comma'>,</span> <span class='id identifier rubyid_model_or_family_name_or_cst'>model_or_family_name_or_cst</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args_for_path_helper'>args_for_path_helper</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_kwargs_for_path_helper'>kwargs_for_path_helper</span><span class='rparen'>)</span>
1827
+ <span class='comment'># Extract model if any, to get the ID
1828
+ </span> <span class='id identifier rubyid_kwargs_for_path_helper'>kwargs_for_path_helper</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='label'>id:</span> <span class='id identifier rubyid_model_or_family_name_or_cst'>model_or_family_name_or_cst</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_model_or_family_name_or_cst'>model_or_family_name_or_cst</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:model_name</span><span class='rparen'>)</span>
1829
+ <span class='kw'>return</span> <span class='const'>Rails</span><span class='period'>.</span><span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_routes'>routes</span><span class='period'>.</span><span class='id identifier rubyid_url_helpers'>url_helpers</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span>
1830
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_path_helper_name'>path_helper_name</span><span class='lparen'>(</span><span class='id identifier rubyid_comp_name_or_cst'>comp_name_or_cst</span><span class='comma'>,</span> <span class='id identifier rubyid_model_or_family_name_or_cst'>model_or_family_name_or_cst</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>_path</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
1831
+ <span class='op'>*</span><span class='id identifier rubyid_args_for_path_helper'>args_for_path_helper</span><span class='comma'>,</span>
1832
+ <span class='op'>**</span><span class='id identifier rubyid_kwargs_for_path_helper'>kwargs_for_path_helper</span>
1833
+ <span class='rparen'>)</span>
1834
+ <span class='kw'>end</span></pre>
1835
+ </td>
1836
+ </tr>
1837
+ </table>
1838
+ </div>
1839
+
1840
+ <div class="method_details ">
1841
+ <h3 class="signature " id="path_helper_name-class_method">
1842
+
1843
+ .<strong>path_helper_name</strong> &#x21d2; <tt>Object</tt>
1844
+
1845
+
1846
+
1847
+
1848
+
1849
+ </h3><div class="docstring">
1850
+ <div class="discussion">
1851
+
1852
+ <p>Given a component and a family, this returns the name of the Rails URL helper returning the path to this component.<br> The parameters are the same as for <span class='object_link'><a href="#rails_action_name-class_method" title="Compony.rails_action_name (method)">rails_action_name</a></span>.<br> Example usage: <code>send(&quot;#{path_helper_name(:index, :users)}_url)</code></p>
1853
+
1854
+
1855
+ </div>
1856
+ </div>
1857
+ <div class="tags">
1858
+
1859
+
1860
+ <p class="tag_title">See Also:</p>
1861
+ <ul class="see">
1862
+
1863
+ <li><span class='object_link'><a href="#path-class_method" title="Compony.path (method)">path</a></span></li>
1864
+
1865
+ <li><span class='object_link'><a href="#rails_action_name-class_method" title="Compony.rails_action_name (method)">rails_action_name for the accepted params</a></span></li>
1866
+
1867
+ </ul>
1868
+
1869
+ </div><table class="source_code">
1870
+ <tr>
1871
+ <td>
1872
+ <pre class="lines">
1873
+
1874
+
1875
+ 142
1876
+ 143
1877
+ 144</pre>
1878
+ </td>
1879
+ <td>
1880
+ <pre class="code"><span class="info file"># File 'lib/compony.rb', line 142</span>
1881
+
1882
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_path_helper_name'>path_helper_name</span><span class='lparen'>(</span><span class='op'>...</span><span class='rparen'>)</span>
1883
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_rails_action_name'>rails_action_name</span><span class='lparen'>(</span><span class='op'>...</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>_comp</span><span class='tstring_end'>&quot;</span></span>
1884
+ <span class='kw'>end</span></pre>
1885
+ </td>
1886
+ </tr>
1887
+ </table>
1888
+ </div>
1889
+
1890
+ <div class="method_details ">
1891
+ <h3 class="signature " id="rails_action_name-class_method">
1892
+
1893
+ .<strong>rails_action_name</strong>(comp_name_or_cst, model_or_family_name_or_cst, name = nil) &#x21d2; <tt>Object</tt>
1894
+
1895
+
1896
+
1897
+
1898
+
1899
+ </h3><div class="docstring">
1900
+ <div class="discussion">
1901
+
1902
+ <p>Given a component and a family, this returns the name of the ComponyController action for this component.<br> Optionally can pass a name for extra standalone configs.</p>
1903
+
1904
+
1905
+ </div>
1906
+ </div>
1907
+ <div class="tags">
1908
+ <p class="tag_title">Parameters:</p>
1909
+ <ul class="param">
1910
+
1911
+ <li>
1912
+
1913
+ <span class='name'>comp_name_or_cst</span>
1914
+
1915
+
1916
+ <span class='type'>(<tt>String</tt>, <tt>Symbol</tt>)</span>
1917
+
1918
+
1919
+
1920
+ &mdash;
1921
+ <div class='inline'>
1922
+ <p>Name of the component the action points to.</p>
1923
+ </div>
1924
+
1925
+ </li>
1926
+
1927
+ <li>
1928
+
1929
+ <span class='name'>model_or_family_name_or_cst</span>
1930
+
1931
+
1932
+ <span class='type'>(<tt>String</tt>, <tt>Symbol</tt>)</span>
1933
+
1934
+
1935
+
1936
+ &mdash;
1937
+ <div class='inline'>
1938
+ <p>Name of the family the action points to.</p>
1939
+ </div>
1940
+
1941
+ </li>
1942
+
1943
+ <li>
1944
+
1945
+ <span class='name'>name</span>
1946
+
1947
+
1948
+ <span class='type'>(<tt>String</tt>, <tt>Symbol</tt>)</span>
1949
+
1950
+
1951
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
1952
+
1953
+
1954
+ &mdash;
1955
+ <div class='inline'>
1956
+ <p>If referring to an extra standalone entrypoint, specify its name using this param.</p>
1957
+ </div>
1958
+
1959
+ </li>
1960
+
1961
+ </ul>
1962
+
1963
+
1964
+ <p class="tag_title">See Also:</p>
1965
+ <ul class="see">
1966
+
1967
+ <li><span class='object_link'><a href="#path-class_method" title="Compony.path (method)">path</a></span></li>
1968
+
1969
+ </ul>
1970
+
1971
+ </div><table class="source_code">
1972
+ <tr>
1973
+ <td>
1974
+ <pre class="lines">
1975
+
1976
+
1977
+ 152
1978
+ 153
1979
+ 154</pre>
1980
+ </td>
1981
+ <td>
1982
+ <pre class="code"><span class="info file"># File 'lib/compony.rb', line 152</span>
1983
+
1984
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_rails_action_name'>rails_action_name</span><span class='lparen'>(</span><span class='id identifier rubyid_comp_name_or_cst'>comp_name_or_cst</span><span class='comma'>,</span> <span class='id identifier rubyid_model_or_family_name_or_cst'>model_or_family_name_or_cst</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
1985
+ <span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_presence'>presence</span><span class='comma'>,</span> <span class='id identifier rubyid_comp_name_or_cst'>comp_name_or_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><span class='comma'>,</span> <span class='id identifier rubyid_family_name_for'>family_name_for</span><span class='lparen'>(</span><span class='id identifier rubyid_model_or_family_name_or_cst'>model_or_family_name_or_cst</span><span class='rparen'>)</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>_</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
1986
+ <span class='kw'>end</span></pre>
1987
+ </td>
1988
+ </tr>
1989
+ </table>
1990
+ </div>
1991
+
1992
+ <div class="method_details ">
1993
+ <h3 class="signature " id="root_comp-class_method">
1994
+
1995
+ .<strong>root_comp</strong> &#x21d2; <tt>Object</tt>
1996
+
1997
+
1998
+
1999
+
2000
+
2001
+ </h3><div class="docstring">
2002
+ <div class="discussion">
2003
+
2004
+ <p>Returns the current root component, if any</p>
2005
+
2006
+
2007
+ </div>
2008
+ </div>
2009
+ <div class="tags">
2010
+
2011
+
2012
+ </div><table class="source_code">
2013
+ <tr>
2014
+ <td>
2015
+ <pre class="lines">
2016
+
2017
+
2018
+ 201
2019
+ 202
2020
+ 203</pre>
2021
+ </td>
2022
+ <td>
2023
+ <pre class="code"><span class="info file"># File 'lib/compony.rb', line 201</span>
2024
+
2025
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_root_comp'>root_comp</span>
2026
+ <span class='const'>RequestStore</span><span class='period'>.</span><span class='id identifier rubyid_store'>store</span><span class='lbracket'>[</span><span class='symbol'>:compony_root_comp</span><span class='rbracket'>]</span>
2027
+ <span class='kw'>end</span></pre>
2028
+ </td>
2029
+ </tr>
2030
+ </table>
2031
+ </div>
2032
+
2033
+ <div class="method_details ">
2034
+ <h3 class="signature " id="with_button_defaults-class_method">
2035
+
2036
+ .<strong>with_button_defaults</strong>(**keys_to_overwrite, &amp;block) &#x21d2; <tt>Object</tt>
2037
+
2038
+
2039
+
2040
+
2041
+
2042
+ </h3><div class="docstring">
2043
+ <div class="discussion">
2044
+
2045
+ <p>Overwrites the keys of the current button defaults by the ones provided during the execution of a given block and restores them afterwords. This method is useful when the same set of options is to be given to a multitude of buttons.</p>
2046
+
2047
+
2048
+ </div>
2049
+ </div>
2050
+ <div class="tags">
2051
+ <p class="tag_title">Parameters:</p>
2052
+ <ul class="param">
2053
+
2054
+ <li>
2055
+
2056
+ <span class='name'>keys_to_overwrite</span>
2057
+
2058
+
2059
+ <span class='type'>(<tt>Hash</tt>)</span>
2060
+
2061
+
2062
+
2063
+ &mdash;
2064
+ <div class='inline'>
2065
+ <p>Options that should be given to the buttons within the block, with their values</p>
2066
+ </div>
2067
+
2068
+ </li>
2069
+
2070
+ <li>
2071
+
2072
+ <span class='name'>block</span>
2073
+
2074
+
2075
+ <span class='type'>(<tt>Block</tt>)</span>
2076
+
2077
+
2078
+
2079
+ &mdash;
2080
+ <div class='inline'>
2081
+ <p>Within this block, all omitted button options point to <code>keys_to_overwrite</code></p>
2082
+ </div>
2083
+
2084
+ </li>
2085
+
2086
+ </ul>
2087
+
2088
+
2089
+ </div><table class="source_code">
2090
+ <tr>
2091
+ <td>
2092
+ <pre class="lines">
2093
+
2094
+
2095
+ 227
2096
+ 228
2097
+ 229
2098
+ 230
2099
+ 231
2100
+ 232
2101
+ 233
2102
+ 234
2103
+ 235
2104
+ 236
2105
+ 237
2106
+ 238
2107
+ 239
2108
+ 240
2109
+ 241
2110
+ 242
2111
+ 243
2112
+ 244
2113
+ 245
2114
+ 246</pre>
2115
+ </td>
2116
+ <td>
2117
+ <pre class="code"><span class="info file"># File 'lib/compony.rb', line 227</span>
2118
+
2119
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_with_button_defaults'>with_button_defaults</span><span class='lparen'>(</span><span class='op'>**</span><span class='id identifier rubyid_keys_to_overwrite'>keys_to_overwrite</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
2120
+ <span class='comment'># Lazy initialize butto_defaults store if it hasn&#39;t been yet
2121
+ </span> <span class='const'>RequestStore</span><span class='period'>.</span><span class='id identifier rubyid_store'>store</span><span class='lbracket'>[</span><span class='symbol'>:button_defaults</span><span class='rbracket'>]</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
2122
+ <span class='id identifier rubyid_keys_to_overwrite'>keys_to_overwrite</span><span class='period'>.</span><span class='id identifier rubyid_transform_keys!'>transform_keys!</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:to_sym</span><span class='rparen'>)</span>
2123
+ <span class='id identifier rubyid_old_values'>old_values</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
2124
+ <span class='id identifier rubyid_newly_defined_keys'>newly_defined_keys</span> <span class='op'>=</span> <span class='id identifier rubyid_keys_to_overwrite'>keys_to_overwrite</span><span class='period'>.</span><span class='id identifier rubyid_keys'>keys</span> <span class='op'>-</span> <span class='const'>RequestStore</span><span class='period'>.</span><span class='id identifier rubyid_store'>store</span><span class='lbracket'>[</span><span class='symbol'>:button_defaults</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_keys'>keys</span>
2125
+ <span class='id identifier rubyid_keys_to_overwrite'>keys_to_overwrite</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_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_new_value'>new_value</span><span class='op'>|</span>
2126
+ <span class='comment'># Assign new value
2127
+ </span> <span class='id identifier rubyid_old_values'>old_values</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='const'>RequestStore</span><span class='period'>.</span><span class='id identifier rubyid_store'>store</span><span class='lbracket'>[</span><span class='symbol'>:button_defaults</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span>
2128
+ <span class='const'>RequestStore</span><span class='period'>.</span><span class='id identifier rubyid_store'>store</span><span class='lbracket'>[</span><span class='symbol'>:button_defaults</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_new_value'>new_value</span>
2129
+ <span class='kw'>end</span>
2130
+ <span class='id identifier rubyid_return_value'>return_value</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span>
2131
+ <span class='comment'># Restore previous value
2132
+ </span> <span class='id identifier rubyid_keys_to_overwrite'>keys_to_overwrite</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_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid__new_value'>_new_value</span><span class='op'>|</span>
2133
+ <span class='const'>RequestStore</span><span class='period'>.</span><span class='id identifier rubyid_store'>store</span><span class='lbracket'>[</span><span class='symbol'>:button_defaults</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_old_values'>old_values</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span>
2134
+ <span class='kw'>end</span>
2135
+ <span class='comment'># Undefine keys that were not there previously
2136
+ </span> <span class='id identifier rubyid_newly_defined_keys'>newly_defined_keys</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='op'>|</span> <span class='const'>RequestStore</span><span class='period'>.</span><span class='id identifier rubyid_store'>store</span><span class='lbracket'>[</span><span class='symbol'>:button_defaults</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
2137
+ <span class='kw'>return</span> <span class='id identifier rubyid_return_value'>return_value</span>
2138
+ <span class='kw'>end</span></pre>
2139
+ </td>
2140
+ </tr>
2141
+ </table>
2142
+ </div>
2143
+
2144
+ </div>
2145
+
2146
+ </div>
2147
+
2148
+ <div id="footer">
2149
+ Generated on Sat Apr 27 10:22:11 2024 by
2150
+ <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
2151
+ 0.9.34 (ruby-3.2.2).
2152
+ </div>
2153
+
2154
+ </div>
2155
+ </body>
2156
+ </html>