compony 0.2.3 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +19 -0
- data/README.md +80 -13
- data/VERSION +1 -1
- data/compony.gemspec +4 -4
- data/doc/ComponentGenerator.html +1 -1
- data/doc/Components.html +1 -1
- data/doc/ComponentsGenerator.html +1 -1
- data/doc/Compony/Component.html +308 -341
- data/doc/Compony/ComponentMixins/Default/Labelling.html +1 -1
- data/doc/Compony/ComponentMixins/Default/Standalone/ResourcefulVerbDsl.html +1 -1
- data/doc/Compony/ComponentMixins/Default/Standalone/StandaloneDsl.html +1 -1
- data/doc/Compony/ComponentMixins/Default/Standalone/VerbDsl.html +1 -1
- data/doc/Compony/ComponentMixins/Default/Standalone.html +1 -1
- data/doc/Compony/ComponentMixins/Default.html +1 -1
- data/doc/Compony/ComponentMixins/Resourceful.html +1 -1
- data/doc/Compony/ComponentMixins.html +1 -1
- data/doc/Compony/Components/Button.html +3 -3
- data/doc/Compony/Components/Destroy.html +3 -3
- data/doc/Compony/Components/Edit.html +19 -19
- data/doc/Compony/Components/Form.html +3 -3
- data/doc/Compony/Components/New.html +19 -19
- data/doc/Compony/Components/WithForm.html +4 -4
- data/doc/Compony/Components.html +1 -1
- data/doc/Compony/ControllerMixin.html +1 -1
- data/doc/Compony/Engine.html +1 -1
- data/doc/Compony/MethodAccessibleHash.html +1 -1
- data/doc/Compony/ModelFields/Anchormodel.html +1 -1
- data/doc/Compony/ModelFields/Association.html +1 -1
- data/doc/Compony/ModelFields/Attachment.html +1 -1
- data/doc/Compony/ModelFields/Base.html +1 -1
- data/doc/Compony/ModelFields/Boolean.html +1 -1
- data/doc/Compony/ModelFields/Color.html +1 -1
- data/doc/Compony/ModelFields/Currency.html +1 -1
- data/doc/Compony/ModelFields/Date.html +1 -1
- data/doc/Compony/ModelFields/Datetime.html +1 -1
- data/doc/Compony/ModelFields/Decimal.html +1 -1
- data/doc/Compony/ModelFields/Email.html +1 -1
- data/doc/Compony/ModelFields/Float.html +1 -1
- data/doc/Compony/ModelFields/Integer.html +1 -1
- data/doc/Compony/ModelFields/Percentage.html +1 -1
- data/doc/Compony/ModelFields/Phone.html +1 -1
- data/doc/Compony/ModelFields/RichText.html +1 -1
- data/doc/Compony/ModelFields/String.html +1 -1
- data/doc/Compony/ModelFields/Text.html +1 -1
- data/doc/Compony/ModelFields/Time.html +1 -1
- data/doc/Compony/ModelFields/Url.html +1 -1
- data/doc/Compony/ModelFields.html +1 -1
- data/doc/Compony/ModelMixin.html +1 -1
- data/doc/Compony/NaturalOrdering.html +292 -0
- data/doc/Compony/RequestContext.html +72 -1
- data/doc/Compony/Version.html +1 -1
- data/doc/Compony/ViewHelpers.html +1 -1
- data/doc/Compony.html +3 -3
- data/doc/ComponyController.html +1 -1
- data/doc/_index.html +8 -1
- data/doc/class_list.html +1 -1
- data/doc/file.README.html +73 -16
- data/doc/index.html +73 -16
- data/doc/method_list.html +100 -100
- data/doc/top-level-namespace.html +1 -1
- data/lib/compony/component.rb +30 -54
- data/lib/compony/components/edit.rb +2 -4
- data/lib/compony/components/new.rb +4 -6
- data/lib/compony/components/with_form.rb +1 -1
- data/lib/compony/natural_ordering.rb +56 -0
- data/lib/compony/request_context.rb +8 -0
- data/lib/compony.rb +1 -0
- metadata +4 -2
data/doc/Compony/Component.html
CHANGED
@@ -143,6 +143,35 @@
|
|
143
143
|
|
144
144
|
<span class="summary_desc"><div class='inline'></div></span>
|
145
145
|
|
146
|
+
</li>
|
147
|
+
|
148
|
+
|
149
|
+
<li class="public ">
|
150
|
+
<span class="summary_signature">
|
151
|
+
|
152
|
+
<a href="#content_blocks-instance_method" title="#content_blocks (instance method)">#<strong>content_blocks</strong> ⇒ Object </a>
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
</span>
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
<span class="note title readonly">readonly</span>
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
<span class="summary_desc"><div class='inline'>
|
172
|
+
<p>needed in RequestContext for nesting.</p>
|
173
|
+
</div></span>
|
174
|
+
|
146
175
|
</li>
|
147
176
|
|
148
177
|
|
@@ -246,7 +275,7 @@
|
|
246
275
|
<li class="public ">
|
247
276
|
<span class="summary_signature">
|
248
277
|
|
249
|
-
<a href="#
|
278
|
+
<a href="#before_render-instance_method" title="#before_render (instance method)">#<strong>before_render</strong>(name = :main, before: nil, **kwargs, &block) ⇒ Object </a>
|
250
279
|
|
251
280
|
|
252
281
|
|
@@ -261,77 +290,9 @@
|
|
261
290
|
|
262
291
|
|
263
292
|
<span class="summary_desc"><div class='inline'>
|
264
|
-
<p>DSL method Adds a
|
293
|
+
<p>DSL method Adds or overrides a before_render block.</p>
|
265
294
|
</div></span>
|
266
295
|
|
267
|
-
</li>
|
268
|
-
|
269
|
-
|
270
|
-
<li class="public ">
|
271
|
-
<span class="summary_signature">
|
272
|
-
|
273
|
-
<a href="#before_render-instance_method" title="#before_render (instance method)">#<strong>before_render</strong>(&block) ⇒ Object </a>
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
</span>
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
<span class="summary_desc"><div class='inline'>
|
288
|
-
<p>DSL method.</p>
|
289
|
-
</div></span>
|
290
|
-
|
291
|
-
</li>
|
292
|
-
|
293
|
-
|
294
|
-
<li class="public ">
|
295
|
-
<span class="summary_signature">
|
296
|
-
|
297
|
-
<a href="#comp_class_for-instance_method" title="#comp_class_for (instance method)">#<strong>comp_class_for</strong> ⇒ Object </a>
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
</span>
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
<span class="summary_desc"><div class='inline'></div></span>
|
312
|
-
|
313
|
-
</li>
|
314
|
-
|
315
|
-
|
316
|
-
<li class="public ">
|
317
|
-
<span class="summary_signature">
|
318
|
-
|
319
|
-
<a href="#comp_class_for!-instance_method" title="#comp_class_for! (instance method)">#<strong>comp_class_for!</strong> ⇒ Object </a>
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
</span>
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
<span class="summary_desc"><div class='inline'></div></span>
|
334
|
-
|
335
296
|
</li>
|
336
297
|
|
337
298
|
|
@@ -386,7 +347,7 @@
|
|
386
347
|
<li class="public ">
|
387
348
|
<span class="summary_signature">
|
388
349
|
|
389
|
-
<a href="#content-instance_method" title="#content (instance method)">#<strong>content</strong>(&block) ⇒ Object </a>
|
350
|
+
<a href="#content-instance_method" title="#content (instance method)">#<strong>content</strong>(name = :main, before: nil, **kwargs, &block) ⇒ Object </a>
|
390
351
|
|
391
352
|
|
392
353
|
|
@@ -401,7 +362,7 @@
|
|
401
362
|
|
402
363
|
|
403
364
|
<span class="summary_desc"><div class='inline'>
|
404
|
-
<p>DSL method
|
365
|
+
<p>DSL method Adds or overrides a content block.</p>
|
405
366
|
</div></span>
|
406
367
|
|
407
368
|
</li>
|
@@ -799,7 +760,6 @@
|
|
799
760
|
<pre class="lines">
|
800
761
|
|
801
762
|
|
802
|
-
22
|
803
763
|
23
|
804
764
|
24
|
805
765
|
25
|
@@ -817,19 +777,20 @@
|
|
817
777
|
37
|
818
778
|
38
|
819
779
|
39
|
820
|
-
40
|
780
|
+
40
|
781
|
+
41</pre>
|
821
782
|
</td>
|
822
783
|
<td>
|
823
|
-
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line
|
784
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 23</span>
|
824
785
|
|
825
786
|
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_parent_comp'>parent_comp</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>index:</span> <span class='int'>0</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_comp_opts'>comp_opts</span><span class='rparen'>)</span>
|
826
787
|
<span class='ivar'>@parent_comp</span> <span class='op'>=</span> <span class='id identifier rubyid_parent_comp'>parent_comp</span>
|
827
788
|
<span class='ivar'>@sub_comps</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
828
789
|
<span class='ivar'>@index</span> <span class='op'>=</span> <span class='id identifier rubyid_index'>index</span>
|
829
790
|
<span class='ivar'>@comp_opts</span> <span class='op'>=</span> <span class='id identifier rubyid_comp_opts'>comp_opts</span>
|
830
|
-
<span class='ivar'>@
|
831
|
-
<span class='ivar'>@content_blocks</span> <span class='op'>=</span> <span class='
|
832
|
-
<span class='ivar'>@actions</span> <span class='op'>=</span> <span class='
|
791
|
+
<span class='ivar'>@before_render_blocks</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="NaturalOrdering.html" title="Compony::NaturalOrdering (class)">NaturalOrdering</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
792
|
+
<span class='ivar'>@content_blocks</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="NaturalOrdering.html" title="Compony::NaturalOrdering (class)">NaturalOrdering</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
793
|
+
<span class='ivar'>@actions</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="NaturalOrdering.html" title="Compony::NaturalOrdering (class)">NaturalOrdering</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
833
794
|
<span class='ivar'>@skipped_actions</span> <span class='op'>=</span> <span class='const'>Set</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
834
795
|
|
835
796
|
<span class='id identifier rubyid_init_standalone'>init_standalone</span>
|
@@ -893,6 +854,49 @@
|
|
893
854
|
</div>
|
894
855
|
|
895
856
|
|
857
|
+
<span id=""></span>
|
858
|
+
<div class="method_details ">
|
859
|
+
<h3 class="signature " id="content_blocks-instance_method">
|
860
|
+
|
861
|
+
#<strong>content_blocks</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
862
|
+
|
863
|
+
|
864
|
+
|
865
|
+
|
866
|
+
|
867
|
+
</h3><div class="docstring">
|
868
|
+
<div class="discussion">
|
869
|
+
|
870
|
+
<p>needed in RequestContext for nesting</p>
|
871
|
+
|
872
|
+
|
873
|
+
</div>
|
874
|
+
</div>
|
875
|
+
<div class="tags">
|
876
|
+
|
877
|
+
|
878
|
+
</div><table class="source_code">
|
879
|
+
<tr>
|
880
|
+
<td>
|
881
|
+
<pre class="lines">
|
882
|
+
|
883
|
+
|
884
|
+
10
|
885
|
+
11
|
886
|
+
12</pre>
|
887
|
+
</td>
|
888
|
+
<td>
|
889
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 10</span>
|
890
|
+
|
891
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_content_blocks'>content_blocks</span>
|
892
|
+
<span class='ivar'>@content_blocks</span>
|
893
|
+
<span class='kw'>end</span></pre>
|
894
|
+
</td>
|
895
|
+
</tr>
|
896
|
+
</table>
|
897
|
+
</div>
|
898
|
+
|
899
|
+
|
896
900
|
<span id=""></span>
|
897
901
|
<div class="method_details ">
|
898
902
|
<h3 class="signature " id="parent_comp-instance_method">
|
@@ -966,15 +970,15 @@
|
|
966
970
|
<pre class="lines">
|
967
971
|
|
968
972
|
|
969
|
-
15
|
970
973
|
16
|
971
974
|
17
|
972
975
|
18
|
973
976
|
19
|
974
|
-
20
|
977
|
+
20
|
978
|
+
21</pre>
|
975
979
|
</td>
|
976
980
|
<td>
|
977
|
-
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line
|
981
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 16</span>
|
978
982
|
|
979
983
|
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup'>setup</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
980
984
|
<span class='id identifier rubyid_fail'>fail</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>`setup` expects a block in </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'>.</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
|
@@ -1019,96 +1023,15 @@
|
|
1019
1023
|
<pre class="lines">
|
1020
1024
|
|
1021
1025
|
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
184
|
1026
|
-
185
|
1027
|
-
186
|
1028
|
-
187
|
1029
|
-
188
|
1030
|
-
189
|
1031
|
-
190
|
1032
|
-
191
|
1033
|
-
192
|
1034
|
-
193
|
1035
|
-
194
|
1036
|
-
195
|
1037
|
-
196
|
1038
|
-
197
|
1039
|
-
198
|
1040
|
-
199
|
1041
|
-
200
|
1042
|
-
201</pre>
|
1026
|
+
175
|
1027
|
+
176
|
1028
|
+
177</pre>
|
1043
1029
|
</td>
|
1044
1030
|
<td>
|
1045
|
-
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line
|
1031
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 175</span>
|
1046
1032
|
|
1047
1033
|
<span class='kw'>def</span> <span class='id identifier rubyid_action'>action</span><span class='lparen'>(</span><span class='id identifier rubyid_action_name'>action_name</span><span class='comma'>,</span> <span class='label'>before:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
1048
|
-
<span class='id identifier
|
1049
|
-
<span class='id identifier rubyid_before_name'>before_name</span> <span class='op'>=</span> <span class='id identifier rubyid_before'>before</span><span class='op'>&.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
|
1050
|
-
<span class='id identifier rubyid_action'>action</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="MethodAccessibleHash.html" title="Compony::MethodAccessibleHash (class)">MethodAccessibleHash</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="MethodAccessibleHash.html#initialize-instance_method" title="Compony::MethodAccessibleHash#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='label'>name:</span> <span class='id identifier rubyid_action_name'>action_name</span><span class='comma'>,</span> <span class='label'>block:</span><span class='rparen'>)</span>
|
1051
|
-
|
1052
|
-
<span class='id identifier rubyid_existing_index'>existing_index</span> <span class='op'>=</span> <span class='ivar'>@actions</span><span class='period'>.</span><span class='id identifier rubyid_find_index'>find_index</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_el'>el</span><span class='op'>|</span> <span class='id identifier rubyid_el'>el</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span> <span class='op'>==</span> <span class='id identifier rubyid_action_name'>action_name</span> <span class='rbrace'>}</span>
|
1053
|
-
<span class='kw'>if</span> <span class='id identifier rubyid_existing_index'>existing_index</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&&</span> <span class='id identifier rubyid_before_name'>before_name</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
|
1054
|
-
<span class='ivar'>@actions</span><span class='period'>.</span><span class='id identifier rubyid_delete_at'>delete_at</span><span class='lparen'>(</span><span class='id identifier rubyid_existing_index'>existing_index</span><span class='rparen'>)</span> <span class='comment'># Replacing an existing element with a before: directive - must delete before calculating indices
|
1055
|
-
</span> <span class='kw'>end</span>
|
1056
|
-
<span class='kw'>if</span> <span class='id identifier rubyid_before_name'>before_name</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
|
1057
|
-
<span class='id identifier rubyid_before_index'>before_index</span> <span class='op'>=</span> <span class='ivar'>@actions</span><span class='period'>.</span><span class='id identifier rubyid_find_index'>find_index</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_el'>el</span><span class='op'>|</span> <span class='id identifier rubyid_el'>el</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span> <span class='op'>==</span> <span class='id identifier rubyid_before_name'>before_name</span> <span class='rbrace'>}</span> <span class='op'>||</span> <span class='id identifier rubyid_fail'>fail</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Action </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_before_name'>before_name</span><span class='embexpr_end'>}</span><span class='tstring_content'> for :before not found in </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'>.</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1058
|
-
<span class='kw'>end</span>
|
1059
|
-
|
1060
|
-
<span class='kw'>if</span> <span class='id identifier rubyid_before_index'>before_index</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
|
1061
|
-
<span class='ivar'>@actions</span><span class='period'>.</span><span class='id identifier rubyid_insert'>insert</span><span class='lparen'>(</span><span class='id identifier rubyid_before_index'>before_index</span><span class='comma'>,</span> <span class='id identifier rubyid_action'>action</span><span class='rparen'>)</span>
|
1062
|
-
<span class='kw'>elsif</span> <span class='id identifier rubyid_existing_index'>existing_index</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
|
1063
|
-
<span class='ivar'>@actions</span><span class='lbracket'>[</span><span class='id identifier rubyid_existing_index'>existing_index</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_action'>action</span>
|
1064
|
-
<span class='kw'>else</span>
|
1065
|
-
<span class='ivar'>@actions</span> <span class='op'><<</span> <span class='id identifier rubyid_action'>action</span>
|
1066
|
-
<span class='kw'>end</span>
|
1067
|
-
<span class='kw'>end</span></pre>
|
1068
|
-
</td>
|
1069
|
-
</tr>
|
1070
|
-
</table>
|
1071
|
-
</div>
|
1072
|
-
|
1073
|
-
<div class="method_details ">
|
1074
|
-
<h3 class="signature " id="add_content-instance_method">
|
1075
|
-
|
1076
|
-
#<strong>add_content</strong>(index = -1,, &block) ⇒ <tt>Object</tt>
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
</h3><div class="docstring">
|
1083
|
-
<div class="discussion">
|
1084
|
-
|
1085
|
-
<p>DSL method Adds a content block that will be executed after all previous ones. It is safe to use this method even if <code>content</code> has never been called You can use dyny here.</p>
|
1086
|
-
|
1087
|
-
|
1088
|
-
</div>
|
1089
|
-
</div>
|
1090
|
-
<div class="tags">
|
1091
|
-
|
1092
|
-
|
1093
|
-
</div><table class="source_code">
|
1094
|
-
<tr>
|
1095
|
-
<td>
|
1096
|
-
<pre class="lines">
|
1097
|
-
|
1098
|
-
|
1099
|
-
141
|
1100
|
-
142
|
1101
|
-
143
|
1102
|
-
144
|
1103
|
-
145</pre>
|
1104
|
-
</td>
|
1105
|
-
<td>
|
1106
|
-
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 141</span>
|
1107
|
-
|
1108
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_add_content'>add_content</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span> <span class='op'>=</span> <span class='op'>-</span><span class='int'>1</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
1109
|
-
<span class='id identifier rubyid_fail'>fail</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>`content` expects a block in </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'>.</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
|
1110
|
-
<span class='ivar'>@content_blocks</span> <span class='op'>||=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
1111
|
-
<span class='ivar'>@content_blocks</span><span class='period'>.</span><span class='id identifier rubyid_insert'>insert</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='comma'>,</span> <span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
1034
|
+
<span class='ivar'>@actions</span><span class='period'>.</span><span class='id identifier rubyid_natural_push'>natural_push</span><span class='lparen'>(</span><span class='id identifier rubyid_action_name'>action_name</span><span class='comma'>,</span> <span class='id identifier rubyid_block'>block</span><span class='comma'>,</span> <span class='label'>before:</span><span class='rparen'>)</span>
|
1112
1035
|
<span class='kw'>end</span></pre>
|
1113
1036
|
</td>
|
1114
1037
|
</tr>
|
@@ -1118,7 +1041,7 @@
|
|
1118
1041
|
<div class="method_details ">
|
1119
1042
|
<h3 class="signature " id="before_render-instance_method">
|
1120
1043
|
|
1121
|
-
#<strong>before_render</strong>(&block) ⇒ <tt>Object</tt>
|
1044
|
+
#<strong>before_render</strong>(name = :main, before: nil, **kwargs, &block) ⇒ <tt>Object</tt>
|
1122
1045
|
|
1123
1046
|
|
1124
1047
|
|
@@ -1127,107 +1050,69 @@
|
|
1127
1050
|
</h3><div class="docstring">
|
1128
1051
|
<div class="discussion">
|
1129
1052
|
|
1130
|
-
<p>DSL method</p>
|
1053
|
+
<p>DSL method Adds or overrides a before_render block. You can use controller.redirect_to to redirect away and halt the before_render/content chain</p>
|
1131
1054
|
|
1132
1055
|
|
1133
1056
|
</div>
|
1134
1057
|
</div>
|
1135
1058
|
<div class="tags">
|
1059
|
+
<p class="tag_title">Parameters:</p>
|
1060
|
+
<ul class="param">
|
1136
1061
|
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_before_render'>before_render</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
1152
|
-
<span class='ivar'>@before_render_block</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span>
|
1153
|
-
<span class='kw'>end</span></pre>
|
1154
|
-
</td>
|
1155
|
-
</tr>
|
1156
|
-
</table>
|
1062
|
+
<li>
|
1063
|
+
|
1064
|
+
<span class='name'>name</span>
|
1065
|
+
|
1066
|
+
|
1067
|
+
<span class='type'>(<tt>Symbol</tt>, <tt>String</tt>)</span>
|
1068
|
+
|
1069
|
+
|
1070
|
+
<em class="default">(defaults to: <tt>:main</tt>)</em>
|
1071
|
+
|
1072
|
+
|
1073
|
+
—
|
1074
|
+
<div class='inline'>
|
1075
|
+
<p>The name of the before_render block, defaults to <code>:main</code></p>
|
1157
1076
|
</div>
|
1158
|
-
|
1159
|
-
|
1160
|
-
<h3 class="signature " id="comp_class_for-instance_method">
|
1161
|
-
|
1162
|
-
#<strong>comp_class_for</strong> ⇒ <tt>Object</tt>
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1077
|
+
|
1078
|
+
</li>
|
1167
1079
|
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1080
|
+
<li>
|
1081
|
+
|
1082
|
+
<span class='name'>before</span>
|
1083
|
+
|
1084
|
+
|
1085
|
+
<span class='type'>(<tt>nil</tt>, <tt>Symbol</tt>, <tt>String</tt>)</span>
|
1086
|
+
|
1087
|
+
|
1088
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1089
|
+
|
1090
|
+
|
1091
|
+
—
|
1092
|
+
<div class='inline'>
|
1093
|
+
<p>If nil, the block will be added to the bottom of the before_render chain. Otherwise, pass the name of another block.</p>
|
1181
1094
|
</div>
|
1182
|
-
|
1095
|
+
|
1096
|
+
</li>
|
1183
1097
|
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 115</span>
|
1197
|
-
|
1198
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_comp_class_for'>comp_class_for</span><span class='lparen'>(</span><span class='op'>...</span><span class='rparen'>)</span>
|
1199
|
-
<span class='const'><span class='object_link'><a href="../Compony.html" title="Compony (module)">Compony</a></span></span><span class='period'>.</span><span class='id identifier rubyid_comp_class_for'><span class='object_link'><a href="../Compony.html#comp_class_for-class_method" title="Compony.comp_class_for (method)">comp_class_for</a></span></span><span class='lparen'>(</span><span class='op'>...</span><span class='rparen'>)</span>
|
1200
|
-
<span class='kw'>end</span></pre>
|
1201
|
-
</td>
|
1202
|
-
</tr>
|
1203
|
-
</table>
|
1098
|
+
<li>
|
1099
|
+
|
1100
|
+
<span class='name'>block</span>
|
1101
|
+
|
1102
|
+
|
1103
|
+
<span class='type'>(<tt>Proc</tt>)</span>
|
1104
|
+
|
1105
|
+
|
1106
|
+
|
1107
|
+
—
|
1108
|
+
<div class='inline'>
|
1109
|
+
<p>The block that should be run as part of the before_render pipeline. Will run in the component’s context.</p>
|
1204
1110
|
</div>
|
1205
|
-
|
1206
|
-
|
1207
|
-
<h3 class="signature " id="comp_class_for!-instance_method">
|
1208
|
-
|
1209
|
-
#<strong>comp_class_for!</strong> ⇒ <tt>Object</tt>
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
1213
|
-
|
1111
|
+
|
1112
|
+
</li>
|
1214
1113
|
|
1215
|
-
</
|
1216
|
-
<div class="discussion">
|
1217
|
-
|
1218
|
-
<div class="note todo">
|
1219
|
-
<strong>TODO:</strong>
|
1220
|
-
<div class='inline'>
|
1221
|
-
<p>deprecate (check for usages beforehand)</p>
|
1222
|
-
</div>
|
1223
|
-
</div>
|
1224
|
-
|
1225
|
-
|
1114
|
+
</ul>
|
1226
1115
|
|
1227
|
-
</div>
|
1228
|
-
</div>
|
1229
|
-
<div class="tags">
|
1230
|
-
|
1231
1116
|
|
1232
1117
|
</div><table class="source_code">
|
1233
1118
|
<tr>
|
@@ -1235,15 +1120,17 @@
|
|
1235
1120
|
<pre class="lines">
|
1236
1121
|
|
1237
1122
|
|
1238
|
-
120
|
1239
1123
|
121
|
1240
|
-
122
|
1124
|
+
122
|
1125
|
+
123
|
1126
|
+
124</pre>
|
1241
1127
|
</td>
|
1242
1128
|
<td>
|
1243
|
-
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line
|
1129
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 121</span>
|
1244
1130
|
|
1245
|
-
<span class='kw'>def</span> <span class='id identifier
|
1246
|
-
<span class='
|
1131
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_before_render'>before_render</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='symbol'>:main</span><span class='comma'>,</span> <span class='label'>before:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_kwargs'>kwargs</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
1132
|
+
<span class='id identifier rubyid_fail'>fail</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>`before_render` expects a block in </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'>.</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
|
1133
|
+
<span class='ivar'>@before_render_blocks</span><span class='period'>.</span><span class='id identifier rubyid_natural_push'>natural_push</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_block'>block</span><span class='comma'>,</span> <span class='label'>before:</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_kwargs'>kwargs</span><span class='rparen'>)</span>
|
1247
1134
|
<span class='kw'>end</span></pre>
|
1248
1135
|
</td>
|
1249
1136
|
</tr>
|
@@ -1276,12 +1163,12 @@
|
|
1276
1163
|
<pre class="lines">
|
1277
1164
|
|
1278
1165
|
|
1279
|
-
105
|
1280
1166
|
106
|
1281
|
-
107
|
1167
|
+
107
|
1168
|
+
108</pre>
|
1282
1169
|
</td>
|
1283
1170
|
<td>
|
1284
|
-
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line
|
1171
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 106</span>
|
1285
1172
|
|
1286
1173
|
<span class='kw'>def</span> <span class='id identifier rubyid_comp_cst'>comp_cst</span>
|
1287
1174
|
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_demodulize'>demodulize</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
|
@@ -1317,12 +1204,12 @@
|
|
1317
1204
|
<pre class="lines">
|
1318
1205
|
|
1319
1206
|
|
1320
|
-
110
|
1321
1207
|
111
|
1322
|
-
112
|
1208
|
+
112
|
1209
|
+
113</pre>
|
1323
1210
|
</td>
|
1324
1211
|
<td>
|
1325
|
-
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line
|
1212
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 111</span>
|
1326
1213
|
|
1327
1214
|
<span class='kw'>def</span> <span class='id identifier rubyid_comp_name'>comp_name</span>
|
1328
1215
|
<span class='id identifier rubyid_comp_cst'>comp_cst</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_underscore'>underscore</span>
|
@@ -1335,7 +1222,7 @@
|
|
1335
1222
|
<div class="method_details ">
|
1336
1223
|
<h3 class="signature " id="content-instance_method">
|
1337
1224
|
|
1338
|
-
#<strong>content</strong>(&block) ⇒ <tt>Object</tt>
|
1225
|
+
#<strong>content</strong>(name = :main, before: nil, **kwargs, &block) ⇒ <tt>Object</tt>
|
1339
1226
|
|
1340
1227
|
|
1341
1228
|
|
@@ -1344,13 +1231,85 @@
|
|
1344
1231
|
</h3><div class="docstring">
|
1345
1232
|
<div class="discussion">
|
1346
1233
|
|
1347
|
-
<p>DSL method
|
1234
|
+
<p>DSL method Adds or overrides a content block.</p>
|
1348
1235
|
|
1349
1236
|
|
1350
1237
|
</div>
|
1351
1238
|
</div>
|
1352
1239
|
<div class="tags">
|
1240
|
+
<p class="tag_title">Parameters:</p>
|
1241
|
+
<ul class="param">
|
1242
|
+
|
1243
|
+
<li>
|
1244
|
+
|
1245
|
+
<span class='name'>name</span>
|
1246
|
+
|
1247
|
+
|
1248
|
+
<span class='type'>(<tt>Symbol</tt>, <tt>String</tt>)</span>
|
1249
|
+
|
1250
|
+
|
1251
|
+
<em class="default">(defaults to: <tt>:main</tt>)</em>
|
1252
|
+
|
1253
|
+
|
1254
|
+
—
|
1255
|
+
<div class='inline'>
|
1256
|
+
<p>The name of the content block, defaults to <code>:main</code></p>
|
1257
|
+
</div>
|
1258
|
+
|
1259
|
+
</li>
|
1260
|
+
|
1261
|
+
<li>
|
1262
|
+
|
1263
|
+
<span class='name'>before</span>
|
1264
|
+
|
1265
|
+
|
1266
|
+
<span class='type'>(<tt>nil</tt>, <tt>Symbol</tt>, <tt>String</tt>)</span>
|
1267
|
+
|
1268
|
+
|
1269
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1270
|
+
|
1271
|
+
|
1272
|
+
—
|
1273
|
+
<div class='inline'>
|
1274
|
+
<p>If nil, the block will be added to the bottom of the content chain. Otherwise, pass the name of another block.</p>
|
1275
|
+
</div>
|
1276
|
+
|
1277
|
+
</li>
|
1278
|
+
|
1279
|
+
<li>
|
1280
|
+
|
1281
|
+
<span class='name'>kwargs</span>
|
1282
|
+
|
1283
|
+
|
1284
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
1285
|
+
|
1286
|
+
|
1287
|
+
|
1288
|
+
—
|
1289
|
+
<div class='inline'>
|
1290
|
+
<p>If hidden is true, the content will not be rendered by default, allowing you to nest it in another content block.</p>
|
1291
|
+
</div>
|
1292
|
+
|
1293
|
+
</li>
|
1294
|
+
|
1295
|
+
<li>
|
1296
|
+
|
1297
|
+
<span class='name'>block</span>
|
1298
|
+
|
1299
|
+
|
1300
|
+
<span class='type'>(<tt>Proc</tt>)</span>
|
1301
|
+
|
1302
|
+
|
1303
|
+
|
1304
|
+
—
|
1305
|
+
<div class='inline'>
|
1306
|
+
<p>The block that should be run as part of the content pipeline. Will run in the component’s context. You can use Dyny here.</p>
|
1307
|
+
</div>
|
1308
|
+
|
1309
|
+
</li>
|
1353
1310
|
|
1311
|
+
</ul>
|
1312
|
+
|
1354
1313
|
|
1355
1314
|
</div><table class="source_code">
|
1356
1315
|
<tr>
|
@@ -1366,9 +1325,9 @@
|
|
1366
1325
|
<td>
|
1367
1326
|
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 132</span>
|
1368
1327
|
|
1369
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_content'>content</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
1328
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_content'>content</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='symbol'>:main</span><span class='comma'>,</span> <span class='label'>before:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_kwargs'>kwargs</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
1370
1329
|
<span class='id identifier rubyid_fail'>fail</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>`content` expects a block in </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'>.</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
|
1371
|
-
<span class='ivar'>@content_blocks</span>
|
1330
|
+
<span class='ivar'>@content_blocks</span><span class='period'>.</span><span class='id identifier rubyid_natural_push'>natural_push</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_block'>block</span><span class='comma'>,</span> <span class='label'>before:</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_kwargs'>kwargs</span><span class='rparen'>)</span>
|
1372
1331
|
<span class='kw'>end</span></pre>
|
1373
1332
|
</td>
|
1374
1333
|
</tr>
|
@@ -1401,12 +1360,12 @@
|
|
1401
1360
|
<pre class="lines">
|
1402
1361
|
|
1403
1362
|
|
1404
|
-
95
|
1405
1363
|
96
|
1406
|
-
97
|
1364
|
+
97
|
1365
|
+
98</pre>
|
1407
1366
|
</td>
|
1408
1367
|
<td>
|
1409
|
-
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line
|
1368
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 96</span>
|
1410
1369
|
|
1411
1370
|
<span class='kw'>def</span> <span class='id identifier rubyid_family_cst'>family_cst</span>
|
1412
1371
|
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_module_parent'>module_parent</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_demodulize'>demodulize</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
|
@@ -1442,12 +1401,12 @@
|
|
1442
1401
|
<pre class="lines">
|
1443
1402
|
|
1444
1403
|
|
1445
|
-
100
|
1446
1404
|
101
|
1447
|
-
102
|
1405
|
+
102
|
1406
|
+
103</pre>
|
1448
1407
|
</td>
|
1449
1408
|
<td>
|
1450
|
-
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line
|
1409
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 101</span>
|
1451
1410
|
|
1452
1411
|
<span class='kw'>def</span> <span class='id identifier rubyid_family_name'>family_name</span>
|
1453
1412
|
<span class='id identifier rubyid_family_cst'>family_cst</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_underscore'>underscore</span>
|
@@ -1483,12 +1442,12 @@
|
|
1483
1442
|
<pre class="lines">
|
1484
1443
|
|
1485
1444
|
|
1486
|
-
61
|
1487
1445
|
62
|
1488
|
-
63
|
1446
|
+
63
|
1447
|
+
64</pre>
|
1489
1448
|
</td>
|
1490
1449
|
<td>
|
1491
|
-
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line
|
1450
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 62</span>
|
1492
1451
|
|
1493
1452
|
<span class='kw'>def</span> <span class='id identifier rubyid_id'>id</span>
|
1494
1453
|
<span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_family_name'>family_name</span><span class='embexpr_end'>}</span><span class='tstring_content'>_</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_comp_name'>comp_name</span><span class='embexpr_end'>}</span><span class='tstring_content'>_</span><span class='embexpr_beg'>#{</span><span class='ivar'>@index</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
@@ -1522,12 +1481,12 @@
|
|
1522
1481
|
<pre class="lines">
|
1523
1482
|
|
1524
1483
|
|
1525
|
-
42
|
1526
1484
|
43
|
1527
|
-
44
|
1485
|
+
44
|
1486
|
+
45</pre>
|
1528
1487
|
</td>
|
1529
1488
|
<td>
|
1530
|
-
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line
|
1489
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 43</span>
|
1531
1490
|
|
1532
1491
|
<span class='kw'>def</span> <span class='id identifier rubyid_inspect'>inspect</span>
|
1533
1492
|
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>#<</span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_content'>:</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_hash'>hash</span><span class='embexpr_end'>}</span><span class='tstring_content'>></span><span class='tstring_end'>"</span></span>
|
@@ -1563,12 +1522,12 @@
|
|
1563
1522
|
<pre class="lines">
|
1564
1523
|
|
1565
1524
|
|
1566
|
-
83
|
1567
1525
|
84
|
1568
|
-
85
|
1526
|
+
85
|
1527
|
+
86</pre>
|
1569
1528
|
</td>
|
1570
1529
|
<td>
|
1571
|
-
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line
|
1530
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 84</span>
|
1572
1531
|
|
1573
1532
|
<span class='kw'>def</span> <span class='id identifier rubyid_param_name'>param_name</span><span class='lparen'>(</span><span class='id identifier rubyid_unprefixed_param_name'>unprefixed_param_name</span><span class='rparen'>)</span>
|
1574
1533
|
<span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_path_hash'>path_hash</span><span class='embexpr_end'>}</span><span class='tstring_content'>_</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_unprefixed_param_name'>unprefixed_param_name</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
@@ -1604,16 +1563,16 @@
|
|
1604
1563
|
<pre class="lines">
|
1605
1564
|
|
1606
1565
|
|
1607
|
-
67
|
1608
1566
|
68
|
1609
1567
|
69
|
1610
1568
|
70
|
1611
1569
|
71
|
1612
1570
|
72
|
1613
|
-
73
|
1571
|
+
73
|
1572
|
+
74</pre>
|
1614
1573
|
</td>
|
1615
1574
|
<td>
|
1616
|
-
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line
|
1575
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 68</span>
|
1617
1576
|
|
1618
1577
|
<span class='kw'>def</span> <span class='id identifier rubyid_path'>path</span>
|
1619
1578
|
<span class='kw'>if</span> <span class='id identifier rubyid_root_comp?'>root_comp?</span>
|
@@ -1653,12 +1612,12 @@
|
|
1653
1612
|
<pre class="lines">
|
1654
1613
|
|
1655
1614
|
|
1656
|
-
77
|
1657
1615
|
78
|
1658
|
-
79
|
1616
|
+
79
|
1617
|
+
80</pre>
|
1659
1618
|
</td>
|
1660
1619
|
<td>
|
1661
|
-
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line
|
1620
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 78</span>
|
1662
1621
|
|
1663
1622
|
<span class='kw'>def</span> <span class='id identifier rubyid_path_hash'>path_hash</span>
|
1664
1623
|
<span class='const'>Digest</span><span class='op'>::</span><span class='const'>SHA1</span><span class='period'>.</span><span class='id identifier rubyid_hexdigest'>hexdigest</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='op'>..</span><span class='int'>4</span><span class='rbracket'>]</span>
|
@@ -1716,6 +1675,16 @@
|
|
1716
1675
|
<pre class="lines">
|
1717
1676
|
|
1718
1677
|
|
1678
|
+
140
|
1679
|
+
141
|
1680
|
+
142
|
1681
|
+
143
|
1682
|
+
144
|
1683
|
+
145
|
1684
|
+
146
|
1685
|
+
147
|
1686
|
+
148
|
1687
|
+
149
|
1719
1688
|
150
|
1720
1689
|
151
|
1721
1690
|
152
|
@@ -1736,21 +1705,19 @@
|
|
1736
1705
|
167
|
1737
1706
|
168
|
1738
1707
|
169
|
1739
|
-
170
|
1740
|
-
171
|
1741
|
-
172
|
1742
|
-
173
|
1743
|
-
174
|
1744
|
-
175
|
1745
|
-
176</pre>
|
1708
|
+
170</pre>
|
1746
1709
|
</td>
|
1747
1710
|
<td>
|
1748
|
-
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line
|
1711
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 140</span>
|
1749
1712
|
|
1750
1713
|
<span class='kw'>def</span> <span class='id identifier rubyid_render'>render</span><span class='lparen'>(</span><span class='id identifier rubyid_controller'>controller</span><span class='comma'>,</span> <span class='label'>standalone:</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_locals'>locals</span><span class='rparen'>)</span>
|
1751
|
-
<span class='comment'># Call before_render
|
1752
|
-
</span> <span class='
|
1753
|
-
|
1714
|
+
<span class='comment'># Call before_render hooks (if any) and backfire instance variables back to the component
|
1715
|
+
</span> <span class='ivar'>@before_render_blocks</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_element'>element</span><span class='op'>|</span>
|
1716
|
+
<span class='const'><span class='object_link'><a href="RequestContext.html" title="Compony::RequestContext (class)">RequestContext</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="RequestContext.html#initialize-instance_method" title="Compony::RequestContext#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_controller'>controller</span><span class='comma'>,</span> <span class='label'>locals:</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_evaluate_with_backfire'><span class='object_link'><a href="RequestContext.html#evaluate_with_backfire-instance_method" title="Compony::RequestContext#evaluate_with_backfire (method)">evaluate_with_backfire</a></span></span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_payload'>payload</span><span class='rparen'>)</span>
|
1717
|
+
<span class='comment'># Stop if a `before_render` block issued a body (e.g. through redirecting)
|
1718
|
+
</span> <span class='kw'>break</span> <span class='kw'>unless</span> <span class='id identifier rubyid_controller'>controller</span><span class='period'>.</span><span class='id identifier rubyid_response_body'>response_body</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
1719
|
+
<span class='kw'>end</span>
|
1720
|
+
|
1754
1721
|
<span class='comment'># Render, unless before_render has already issued a body (e.g. through redirecting).
|
1755
1722
|
</span> <span class='kw'>if</span> <span class='id identifier rubyid_controller'>controller</span><span class='period'>.</span><span class='id identifier rubyid_response_body'>response_body</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
1756
1723
|
<span class='id identifier rubyid_fail'>fail</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'> must define `content` or set a response body in `before_render`</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='ivar'>@content_blocks</span><span class='period'>.</span><span class='id identifier rubyid_none?'>none?</span>
|
@@ -1761,9 +1728,9 @@
|
|
1761
1728
|
<span class='tstring_content'> if Compony.content_before_root_comp_block && standalone
|
1762
1729
|
</span><span class='tstring_content'> Compony::RequestContext.new(component, controller, helpers: self, locals: render_locals).evaluate(&Compony.content_before_root_comp_block)
|
1763
1730
|
</span><span class='tstring_content'> end
|
1764
|
-
</span><span class='tstring_content'> content_blocks.each do |
|
1731
|
+
</span><span class='tstring_content'> content_blocks.reject{ |el| el.hidden }.each do |element|
|
1765
1732
|
</span><span class='tstring_content'> # Instanciate and evaluate a fresh RequestContext in order to use the buffer allocated by the ActionView (needed for `concat` calls)
|
1766
|
-
</span><span class='tstring_content'> Compony::RequestContext.new(component, controller, helpers: self, locals: render_locals).evaluate(&
|
1733
|
+
</span><span class='tstring_content'> Compony::RequestContext.new(component, controller, helpers: self, locals: render_locals).evaluate(&element.payload)
|
1767
1734
|
</span><span class='tstring_content'> end
|
1768
1735
|
</span><span class='tstring_content'> if Compony.content_after_root_comp_block && standalone
|
1769
1736
|
</span><span class='tstring_content'> Compony::RequestContext.new(component, controller, helpers: self, locals: render_locals).evaluate(&Compony.content_after_root_comp_block)
|
@@ -1805,25 +1772,25 @@
|
|
1805
1772
|
<pre class="lines">
|
1806
1773
|
|
1807
1774
|
|
1808
|
-
|
1809
|
-
|
1810
|
-
|
1811
|
-
|
1812
|
-
|
1813
|
-
|
1814
|
-
|
1815
|
-
|
1816
|
-
|
1817
|
-
|
1818
|
-
|
1819
|
-
|
1820
|
-
|
1821
|
-
|
1822
|
-
|
1823
|
-
|
1775
|
+
186
|
1776
|
+
187
|
1777
|
+
188
|
1778
|
+
189
|
1779
|
+
190
|
1780
|
+
191
|
1781
|
+
192
|
1782
|
+
193
|
1783
|
+
194
|
1784
|
+
195
|
1785
|
+
196
|
1786
|
+
197
|
1787
|
+
198
|
1788
|
+
199
|
1789
|
+
200
|
1790
|
+
201</pre>
|
1824
1791
|
</td>
|
1825
1792
|
<td>
|
1826
|
-
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line
|
1793
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 186</span>
|
1827
1794
|
|
1828
1795
|
<span class='kw'>def</span> <span class='id identifier rubyid_render_actions'>render_actions</span><span class='lparen'>(</span><span class='id identifier rubyid_controller'>controller</span><span class='comma'>,</span> <span class='label'>wrapper_class:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='label'>action_class:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
1829
1796
|
<span class='id identifier rubyid_h'>h</span> <span class='op'>=</span> <span class='id identifier rubyid_controller'>controller</span><span class='period'>.</span><span class='id identifier rubyid_helpers'>helpers</span>
|
@@ -1831,7 +1798,7 @@
|
|
1831
1798
|
<span class='id identifier rubyid_button_htmls'>button_htmls</span> <span class='op'>=</span> <span class='ivar'>@actions</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_action'>action</span><span class='op'>|</span>
|
1832
1799
|
<span class='kw'>next</span> <span class='kw'>if</span> <span class='ivar'>@skipped_actions</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_action'>action</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
|
1833
1800
|
<span class='const'><span class='object_link'><a href="../Compony.html" title="Compony (module)">Compony</a></span></span><span class='period'>.</span><span class='id identifier rubyid_with_button_defaults'><span class='object_link'><a href="../Compony.html#with_button_defaults-class_method" title="Compony.with_button_defaults (method)">with_button_defaults</a></span></span><span class='lparen'>(</span><span class='label'>feasibility_action:</span> <span class='id identifier rubyid_action'>action</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rparen'>)</span> <span class='kw'>do</span>
|
1834
|
-
<span class='id identifier rubyid_action_button'>action_button</span> <span class='op'>=</span> <span class='id identifier rubyid_action'>action</span><span class='period'>.</span><span class='id identifier
|
1801
|
+
<span class='id identifier rubyid_action_button'>action_button</span> <span class='op'>=</span> <span class='id identifier rubyid_action'>action</span><span class='period'>.</span><span class='id identifier rubyid_payload'>payload</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_controller'>controller</span><span class='rparen'>)</span>
|
1835
1802
|
<span class='kw'>next</span> <span class='kw'>unless</span> <span class='id identifier rubyid_action_button'>action_button</span>
|
1836
1803
|
<span class='id identifier rubyid_button_html'>button_html</span> <span class='op'>=</span> <span class='id identifier rubyid_action_button'>action_button</span><span class='period'>.</span><span class='id identifier rubyid_render'>render</span><span class='lparen'>(</span><span class='id identifier rubyid_controller'>controller</span><span class='rparen'>)</span>
|
1837
1804
|
<span class='kw'>next</span> <span class='kw'>if</span> <span class='id identifier rubyid_button_html'>button_html</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
|
@@ -1885,12 +1852,12 @@
|
|
1885
1852
|
<pre class="lines">
|
1886
1853
|
|
1887
1854
|
|
1888
|
-
|
1889
|
-
|
1890
|
-
|
1855
|
+
204
|
1856
|
+
205
|
1857
|
+
206</pre>
|
1891
1858
|
</td>
|
1892
1859
|
<td>
|
1893
|
-
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line
|
1860
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 204</span>
|
1894
1861
|
|
1895
1862
|
<span class='kw'>def</span> <span class='id identifier rubyid_resourceful?'>resourceful?</span>
|
1896
1863
|
<span class='kw'>return</span> <span class='kw'>false</span>
|
@@ -1926,13 +1893,13 @@
|
|
1926
1893
|
<pre class="lines">
|
1927
1894
|
|
1928
1895
|
|
1929
|
-
48
|
1930
1896
|
49
|
1931
1897
|
50
|
1932
|
-
51
|
1898
|
+
51
|
1899
|
+
52</pre>
|
1933
1900
|
</td>
|
1934
1901
|
<td>
|
1935
|
-
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line
|
1902
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 49</span>
|
1936
1903
|
|
1937
1904
|
<span class='kw'>def</span> <span class='id identifier rubyid_root_comp'>root_comp</span>
|
1938
1905
|
<span class='kw'>return</span> <span class='kw'>self</span> <span class='kw'>unless</span> <span class='id identifier rubyid_parent_comp'>parent_comp</span>
|
@@ -1982,12 +1949,12 @@
|
|
1982
1949
|
<pre class="lines">
|
1983
1950
|
|
1984
1951
|
|
1985
|
-
55
|
1986
1952
|
56
|
1987
|
-
57
|
1953
|
+
57
|
1954
|
+
58</pre>
|
1988
1955
|
</td>
|
1989
1956
|
<td>
|
1990
|
-
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line
|
1957
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 56</span>
|
1991
1958
|
|
1992
1959
|
<span class='kw'>def</span> <span class='id identifier rubyid_root_comp?'>root_comp?</span>
|
1993
1960
|
<span class='id identifier rubyid_parent_comp'>parent_comp</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
@@ -2023,12 +1990,12 @@
|
|
2023
1990
|
<pre class="lines">
|
2024
1991
|
|
2025
1992
|
|
2026
|
-
|
2027
|
-
|
2028
|
-
|
1993
|
+
181
|
1994
|
+
182
|
1995
|
+
183</pre>
|
2029
1996
|
</td>
|
2030
1997
|
<td>
|
2031
|
-
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line
|
1998
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 181</span>
|
2032
1999
|
|
2033
2000
|
<span class='kw'>def</span> <span class='id identifier rubyid_skip_action'>skip_action</span><span class='lparen'>(</span><span class='id identifier rubyid_action_name'>action_name</span><span class='rparen'>)</span>
|
2034
2001
|
<span class='ivar'>@skipped_actions</span> <span class='op'><<</span> <span class='id identifier rubyid_action_name'>action_name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
|
@@ -2064,14 +2031,14 @@
|
|
2064
2031
|
<pre class="lines">
|
2065
2032
|
|
2066
2033
|
|
2067
|
-
88
|
2068
2034
|
89
|
2069
2035
|
90
|
2070
2036
|
91
|
2071
|
-
92
|
2037
|
+
92
|
2038
|
+
93</pre>
|
2072
2039
|
</td>
|
2073
2040
|
<td>
|
2074
|
-
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line
|
2041
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 89</span>
|
2075
2042
|
|
2076
2043
|
<span class='kw'>def</span> <span class='id identifier rubyid_sub_comp'>sub_comp</span><span class='lparen'>(</span><span class='id identifier rubyid_component_class'>component_class</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_comp_opts'>comp_opts</span><span class='rparen'>)</span>
|
2077
2044
|
<span class='id identifier rubyid_sub'>sub</span> <span class='op'>=</span> <span class='id identifier rubyid_component_class'>component_class</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='label'>index:</span> <span class='ivar'>@sub_comps</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_comp_opts'>comp_opts</span><span class='rparen'>)</span>
|
@@ -2088,7 +2055,7 @@
|
|
2088
2055
|
</div>
|
2089
2056
|
|
2090
2057
|
<div id="footer">
|
2091
|
-
Generated on
|
2058
|
+
Generated on Wed May 29 15:53:00 2024 by
|
2092
2059
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
2093
2060
|
0.9.34 (ruby-3.2.2).
|
2094
2061
|
</div>
|