compony 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/README.md +10 -0
- data/VERSION +1 -1
- data/compony.gemspec +3 -3
- data/doc/ComponentGenerator.html +1 -1
- data/doc/Components.html +1 -1
- data/doc/ComponentsGenerator.html +1 -1
- data/doc/Compony/Component.html +244 -56
- 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 +2 -2
- data/doc/Compony/Components/Destroy.html +14 -14
- data/doc/Compony/Components/Edit.html +18 -18
- data/doc/Compony/Components/Form.html +86 -86
- data/doc/Compony/Components/New.html +14 -14
- data/doc/Compony/Components/WithForm.html +2 -2
- 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 +14 -6
- data/doc/Compony/RequestContext.html +16 -4
- data/doc/Compony/Version.html +1 -1
- data/doc/Compony/ViewHelpers.html +1 -1
- data/doc/Compony.html +1 -1
- data/doc/ComponyController.html +1 -1
- data/doc/_index.html +1 -1
- data/doc/file.README.html +10 -1
- data/doc/index.html +10 -1
- data/doc/method_list.html +16 -0
- data/doc/top-level-namespace.html +1 -1
- data/lib/compony/component.rb +25 -2
- data/lib/compony/components/destroy.rb +9 -1
- data/lib/compony/components/edit.rb +4 -0
- data/lib/compony/components/form.rb +16 -5
- data/lib/compony/components/new.rb +1 -0
- data/lib/compony/natural_ordering.rb +6 -2
- data/lib/compony/request_context.rb +8 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 06e0173c3d9173301367b1775e1fec05c0ea40a77f5738fcd8639ec7e3e327f0
|
|
4
|
+
data.tar.gz: 51ba73e024c5ad97f7a8a935c91b01d06b382ca0870fc95b5e011a9c50726029
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 89574a221ec8f0bf76e62efc7d378d35b9607d42288d96f2c8e2cee05fac06b415e1d7f2b00f60f58e2775588e942c40cfb7c3dd4f1081b0784a07b0c45bbed5
|
|
7
|
+
data.tar.gz: a05cc34c77c8c921f51b282f754e4c46bcf5ee469d63d448427c72caa08a757bc81e3a31bb8c3db61b268abd8dfbed27b8d6b42c21e230b269cf4ac4cb178f71
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
# 0.3.2
|
|
2
|
+
|
|
3
|
+
- Add label content block to edit component
|
|
4
|
+
- Introduce `remove_content!` and make its non-bang pendant tolerate missing blocks
|
|
5
|
+
|
|
6
|
+
# 0.3.1
|
|
7
|
+
|
|
8
|
+
- In `NaturalOrdering`, tolerate omitting payload only if it's an override
|
|
9
|
+
- In `content`, tolerate omitting block if it's an override
|
|
10
|
+
- Instanciate a fresh ActionView `output_buffer` when rendering nested content to prevent double render errors
|
|
11
|
+
- Reshape `Destroy` and `Form` components to provide more fine-grained content blocks that can be selectively overridden
|
|
12
|
+
- Implement `remove_content` which allows removing a previously defined content block (useful for usage in subclasses)
|
|
13
|
+
|
|
1
14
|
# 0.3.0
|
|
2
15
|
|
|
3
16
|
- Internals:
|
data/README.md
CHANGED
|
@@ -513,6 +513,16 @@ The output is:
|
|
|
513
513
|
<div class="card card-body"><h1>Hello</h1><p>Welcome to my site.</p></div>
|
|
514
514
|
```
|
|
515
515
|
|
|
516
|
+
##### Removing content blocks
|
|
517
|
+
|
|
518
|
+
If a component's parent class defines a content block that is undesired in a subclass component, the content block can be removed as follows:
|
|
519
|
+
|
|
520
|
+
```ruby
|
|
521
|
+
setup do
|
|
522
|
+
remove_content :some_content_defined_in_parent # This component will now behave as if this content block was never declared in its parent.
|
|
523
|
+
end
|
|
524
|
+
```
|
|
525
|
+
|
|
516
526
|
#### Redirecting away / Intercepting rendering
|
|
517
527
|
|
|
518
528
|
Immediately before the `content` block(s) are evaluated, another chain of blocks is evaluated if present: `before_render`. If on of these blocks creates a reponse body in the Rails controller, the subsequent `before_render` blocks and all `content` blocks are skipped.
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.3.
|
|
1
|
+
0.3.2
|
data/compony.gemspec
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
# This file is auto-generated via: 'rake gemspec'.
|
|
3
3
|
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
|
5
|
-
# stub: compony 0.3.
|
|
5
|
+
# stub: compony 0.3.2 ruby lib
|
|
6
6
|
|
|
7
7
|
Gem::Specification.new do |s|
|
|
8
8
|
s.name = "compony".freeze
|
|
9
|
-
s.version = "0.3.
|
|
9
|
+
s.version = "0.3.2".freeze
|
|
10
10
|
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
|
12
12
|
s.require_paths = ["lib".freeze]
|
|
13
13
|
s.authors = ["Sandro Kalbermatter".freeze, "contributors".freeze]
|
|
14
|
-
s.date = "2024-
|
|
14
|
+
s.date = "2024-06-01"
|
|
15
15
|
s.files = [".gitignore".freeze, ".ruby-version".freeze, ".yardopts".freeze, "CHANGELOG.md".freeze, "Gemfile".freeze, "Gemfile.lock".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "TODO.md".freeze, "VERSION".freeze, "app/controllers/compony_controller.rb".freeze, "compony.gemspec".freeze, "config/locales/de.yml".freeze, "config/locales/en.yml".freeze, "config/locales/fr.yml".freeze, "config/routes.rb".freeze, "doc/ComponentGenerator.html".freeze, "doc/Components.html".freeze, "doc/ComponentsGenerator.html".freeze, "doc/Compony.html".freeze, "doc/Compony/Component.html".freeze, "doc/Compony/ComponentMixins.html".freeze, "doc/Compony/ComponentMixins/Default.html".freeze, "doc/Compony/ComponentMixins/Default/Labelling.html".freeze, "doc/Compony/ComponentMixins/Default/Standalone.html".freeze, "doc/Compony/ComponentMixins/Default/Standalone/ResourcefulVerbDsl.html".freeze, "doc/Compony/ComponentMixins/Default/Standalone/StandaloneDsl.html".freeze, "doc/Compony/ComponentMixins/Default/Standalone/VerbDsl.html".freeze, "doc/Compony/ComponentMixins/Resourceful.html".freeze, "doc/Compony/Components.html".freeze, "doc/Compony/Components/Button.html".freeze, "doc/Compony/Components/Destroy.html".freeze, "doc/Compony/Components/Edit.html".freeze, "doc/Compony/Components/Form.html".freeze, "doc/Compony/Components/New.html".freeze, "doc/Compony/Components/WithForm.html".freeze, "doc/Compony/ControllerMixin.html".freeze, "doc/Compony/Engine.html".freeze, "doc/Compony/MethodAccessibleHash.html".freeze, "doc/Compony/ModelFields.html".freeze, "doc/Compony/ModelFields/Anchormodel.html".freeze, "doc/Compony/ModelFields/Association.html".freeze, "doc/Compony/ModelFields/Attachment.html".freeze, "doc/Compony/ModelFields/Base.html".freeze, "doc/Compony/ModelFields/Boolean.html".freeze, "doc/Compony/ModelFields/Color.html".freeze, "doc/Compony/ModelFields/Currency.html".freeze, "doc/Compony/ModelFields/Date.html".freeze, "doc/Compony/ModelFields/Datetime.html".freeze, "doc/Compony/ModelFields/Decimal.html".freeze, "doc/Compony/ModelFields/Email.html".freeze, "doc/Compony/ModelFields/Float.html".freeze, "doc/Compony/ModelFields/Integer.html".freeze, "doc/Compony/ModelFields/Percentage.html".freeze, "doc/Compony/ModelFields/Phone.html".freeze, "doc/Compony/ModelFields/RichText.html".freeze, "doc/Compony/ModelFields/String.html".freeze, "doc/Compony/ModelFields/Text.html".freeze, "doc/Compony/ModelFields/Time.html".freeze, "doc/Compony/ModelFields/Url.html".freeze, "doc/Compony/ModelMixin.html".freeze, "doc/Compony/NaturalOrdering.html".freeze, "doc/Compony/RequestContext.html".freeze, "doc/Compony/Version.html".freeze, "doc/Compony/ViewHelpers.html".freeze, "doc/ComponyController.html".freeze, "doc/_index.html".freeze, "doc/class_list.html".freeze, "doc/css/common.css".freeze, "doc/css/full_list.css".freeze, "doc/css/style.css".freeze, "doc/file.README.html".freeze, "doc/file_list.html".freeze, "doc/frames.html".freeze, "doc/imgs/intro-example-destroy.png".freeze, "doc/imgs/intro-example-edit.png".freeze, "doc/imgs/intro-example-index.png".freeze, "doc/imgs/intro-example-new.png".freeze, "doc/imgs/intro-example-show.png".freeze, "doc/index.html".freeze, "doc/js/app.js".freeze, "doc/js/full_list.js".freeze, "doc/js/jquery.js".freeze, "doc/method_list.html".freeze, "doc/resourceful_lifecycle.graphml".freeze, "doc/resourceful_lifecycle.pdf".freeze, "doc/resourceful_lifecycle.png".freeze, "doc/top-level-namespace.html".freeze, "lib/compony.rb".freeze, "lib/compony/component.rb".freeze, "lib/compony/component_mixins/default/labelling.rb".freeze, "lib/compony/component_mixins/default/standalone.rb".freeze, "lib/compony/component_mixins/default/standalone/resourceful_verb_dsl.rb".freeze, "lib/compony/component_mixins/default/standalone/standalone_dsl.rb".freeze, "lib/compony/component_mixins/default/standalone/verb_dsl.rb".freeze, "lib/compony/component_mixins/resourceful.rb".freeze, "lib/compony/components/button.rb".freeze, "lib/compony/components/destroy.rb".freeze, "lib/compony/components/edit.rb".freeze, "lib/compony/components/form.rb".freeze, "lib/compony/components/new.rb".freeze, "lib/compony/components/with_form.rb".freeze, "lib/compony/controller_mixin.rb".freeze, "lib/compony/engine.rb".freeze, "lib/compony/method_accessible_hash.rb".freeze, "lib/compony/model_fields/anchormodel.rb".freeze, "lib/compony/model_fields/association.rb".freeze, "lib/compony/model_fields/attachment.rb".freeze, "lib/compony/model_fields/base.rb".freeze, "lib/compony/model_fields/boolean.rb".freeze, "lib/compony/model_fields/color.rb".freeze, "lib/compony/model_fields/currency.rb".freeze, "lib/compony/model_fields/date.rb".freeze, "lib/compony/model_fields/datetime.rb".freeze, "lib/compony/model_fields/decimal.rb".freeze, "lib/compony/model_fields/email.rb".freeze, "lib/compony/model_fields/float.rb".freeze, "lib/compony/model_fields/integer.rb".freeze, "lib/compony/model_fields/percentage.rb".freeze, "lib/compony/model_fields/phone.rb".freeze, "lib/compony/model_fields/rich_text.rb".freeze, "lib/compony/model_fields/string.rb".freeze, "lib/compony/model_fields/text.rb".freeze, "lib/compony/model_fields/time.rb".freeze, "lib/compony/model_fields/url.rb".freeze, "lib/compony/model_mixin.rb".freeze, "lib/compony/natural_ordering.rb".freeze, "lib/compony/request_context.rb".freeze, "lib/compony/version.rb".freeze, "lib/compony/view_helpers.rb".freeze, "lib/generators/component/USAGE".freeze, "lib/generators/component/component_generator.rb".freeze, "lib/generators/component/templates/component.rb.erb".freeze, "lib/generators/component/templates/destroy.rb.erb".freeze, "lib/generators/component/templates/edit.rb.erb".freeze, "lib/generators/component/templates/form.rb.erb".freeze, "lib/generators/component/templates/new.rb.erb".freeze, "lib/generators/components/USAGE".freeze, "lib/generators/components/components_generator.rb".freeze, "logo.svg".freeze]
|
|
16
16
|
s.required_ruby_version = Gem::Requirement.new(">= 3.0.0".freeze)
|
|
17
17
|
s.rubygems_version = "3.5.9".freeze
|
data/doc/ComponentGenerator.html
CHANGED
|
@@ -221,7 +221,7 @@
|
|
|
221
221
|
</div>
|
|
222
222
|
|
|
223
223
|
<div id="footer">
|
|
224
|
-
Generated on
|
|
224
|
+
Generated on Sat Jun 1 14:22:43 2024 by
|
|
225
225
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
226
226
|
0.9.34 (ruby-3.2.2).
|
|
227
227
|
</div>
|
data/doc/Components.html
CHANGED
|
@@ -193,7 +193,7 @@
|
|
|
193
193
|
</div>
|
|
194
194
|
|
|
195
195
|
<div id="footer">
|
|
196
|
-
Generated on
|
|
196
|
+
Generated on Sat Jun 1 14:22:43 2024 by
|
|
197
197
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
198
198
|
0.9.34 (ruby-3.2.2).
|
|
199
199
|
</div>
|
data/doc/Compony/Component.html
CHANGED
|
@@ -557,6 +557,54 @@
|
|
|
557
557
|
<p>Returns a hash for the path.</p>
|
|
558
558
|
</div></span>
|
|
559
559
|
|
|
560
|
+
</li>
|
|
561
|
+
|
|
562
|
+
|
|
563
|
+
<li class="public ">
|
|
564
|
+
<span class="summary_signature">
|
|
565
|
+
|
|
566
|
+
<a href="#remove_content-instance_method" title="#remove_content (instance method)">#<strong>remove_content</strong>(name) ⇒ Object </a>
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
</span>
|
|
571
|
+
|
|
572
|
+
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
|
|
579
|
+
|
|
580
|
+
<span class="summary_desc"><div class='inline'>
|
|
581
|
+
<p>DSL method Removes a content block.</p>
|
|
582
|
+
</div></span>
|
|
583
|
+
|
|
584
|
+
</li>
|
|
585
|
+
|
|
586
|
+
|
|
587
|
+
<li class="public ">
|
|
588
|
+
<span class="summary_signature">
|
|
589
|
+
|
|
590
|
+
<a href="#remove_content!-instance_method" title="#remove_content! (instance method)">#<strong>remove_content!</strong>(name) ⇒ Object </a>
|
|
591
|
+
|
|
592
|
+
|
|
593
|
+
|
|
594
|
+
</span>
|
|
595
|
+
|
|
596
|
+
|
|
597
|
+
|
|
598
|
+
|
|
599
|
+
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
|
|
603
|
+
|
|
604
|
+
<span class="summary_desc"><div class='inline'>
|
|
605
|
+
<p>DSL method Removes a content block and fails if the content block was not found.</p>
|
|
606
|
+
</div></span>
|
|
607
|
+
|
|
560
608
|
</li>
|
|
561
609
|
|
|
562
610
|
|
|
@@ -1023,12 +1071,12 @@
|
|
|
1023
1071
|
<pre class="lines">
|
|
1024
1072
|
|
|
1025
1073
|
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1074
|
+
198
|
|
1075
|
+
199
|
|
1076
|
+
200</pre>
|
|
1029
1077
|
</td>
|
|
1030
1078
|
<td>
|
|
1031
|
-
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line
|
|
1079
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 198</span>
|
|
1032
1080
|
|
|
1033
1081
|
<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>
|
|
1034
1082
|
<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>
|
|
@@ -1320,14 +1368,20 @@
|
|
|
1320
1368
|
132
|
|
1321
1369
|
133
|
|
1322
1370
|
134
|
|
1323
|
-
135
|
|
1371
|
+
135
|
|
1372
|
+
136
|
|
1373
|
+
137
|
|
1374
|
+
138</pre>
|
|
1324
1375
|
</td>
|
|
1325
1376
|
<td>
|
|
1326
1377
|
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 132</span>
|
|
1327
1378
|
|
|
1328
1379
|
<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>
|
|
1329
|
-
<span class='
|
|
1330
|
-
<span class='
|
|
1380
|
+
<span class='comment'># A block is required here, but if this is an override (e.g. to hide another content block), we can tolerate the missing block.
|
|
1381
|
+
</span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_block_given?'>block_given?</span> <span class='op'>&&</span> <span class='ivar'>@content_blocks</span><span class='period'>.</span><span class='id identifier rubyid_find'>find</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_b'>b</span><span class='op'>|</span> <span class='id identifier rubyid_b'>b</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span> <span class='op'>==</span> <span class='id identifier rubyid_name'>name</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
|
1382
|
+
<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>
|
|
1383
|
+
<span class='kw'>end</span>
|
|
1384
|
+
<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='op'>||</span> <span class='symbol'>:missing</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>
|
|
1331
1385
|
<span class='kw'>end</span></pre>
|
|
1332
1386
|
</td>
|
|
1333
1387
|
</tr>
|
|
@@ -1628,9 +1682,9 @@
|
|
|
1628
1682
|
</div>
|
|
1629
1683
|
|
|
1630
1684
|
<div class="method_details ">
|
|
1631
|
-
<h3 class="signature " id="
|
|
1685
|
+
<h3 class="signature " id="remove_content-instance_method">
|
|
1632
1686
|
|
|
1633
|
-
#<strong>
|
|
1687
|
+
#<strong>remove_content</strong>(name) ⇒ <tt>Object</tt>
|
|
1634
1688
|
|
|
1635
1689
|
|
|
1636
1690
|
|
|
@@ -1639,7 +1693,7 @@
|
|
|
1639
1693
|
</h3><div class="docstring">
|
|
1640
1694
|
<div class="discussion">
|
|
1641
1695
|
|
|
1642
|
-
<p>
|
|
1696
|
+
<p>DSL method Removes a content block. Use this in subclasses if a content block defined in the parent should be removed from the child.</p>
|
|
1643
1697
|
|
|
1644
1698
|
|
|
1645
1699
|
</div>
|
|
@@ -1650,18 +1704,16 @@
|
|
|
1650
1704
|
|
|
1651
1705
|
<li>
|
|
1652
1706
|
|
|
1653
|
-
<span class='name'>
|
|
1707
|
+
<span class='name'>name</span>
|
|
1654
1708
|
|
|
1655
1709
|
|
|
1656
|
-
<span class='type'>(<tt>
|
|
1710
|
+
<span class='type'>(<tt>Symbol</tt>, <tt>String</tt>)</span>
|
|
1657
1711
|
|
|
1658
1712
|
|
|
1659
|
-
<em class="default">(defaults to: <tt>false</tt>)</em>
|
|
1660
|
-
|
|
1661
1713
|
|
|
1662
1714
|
—
|
|
1663
1715
|
<div class='inline'>
|
|
1664
|
-
<p>
|
|
1716
|
+
<p>Name of the content block that should be removed</p>
|
|
1665
1717
|
</div>
|
|
1666
1718
|
|
|
1667
1719
|
</li>
|
|
@@ -1675,9 +1727,6 @@
|
|
|
1675
1727
|
<pre class="lines">
|
|
1676
1728
|
|
|
1677
1729
|
|
|
1678
|
-
140
|
|
1679
|
-
141
|
|
1680
|
-
142
|
|
1681
1730
|
143
|
|
1682
1731
|
144
|
|
1683
1732
|
145
|
|
@@ -1686,18 +1735,134 @@
|
|
|
1686
1735
|
148
|
|
1687
1736
|
149
|
|
1688
1737
|
150
|
|
1689
|
-
151
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1738
|
+
151</pre>
|
|
1739
|
+
</td>
|
|
1740
|
+
<td>
|
|
1741
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 143</span>
|
|
1742
|
+
|
|
1743
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_remove_content'>remove_content</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
|
|
1744
|
+
<span class='id identifier rubyid_existing_index'>existing_index</span> <span class='op'>=</span> <span class='ivar'>@content_blocks</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_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span> <span class='rbrace'>}</span>
|
|
1745
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_existing_index'>existing_index</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
|
1746
|
+
<span class='kw'>return</span> <span class='kw'>false</span>
|
|
1747
|
+
<span class='kw'>else</span>
|
|
1748
|
+
<span class='ivar'>@content_blocks</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>
|
|
1749
|
+
<span class='kw'>return</span> <span class='kw'>true</span>
|
|
1750
|
+
<span class='kw'>end</span>
|
|
1751
|
+
<span class='kw'>end</span></pre>
|
|
1752
|
+
</td>
|
|
1753
|
+
</tr>
|
|
1754
|
+
</table>
|
|
1755
|
+
</div>
|
|
1756
|
+
|
|
1757
|
+
<div class="method_details ">
|
|
1758
|
+
<h3 class="signature " id="remove_content!-instance_method">
|
|
1759
|
+
|
|
1760
|
+
#<strong>remove_content!</strong>(name) ⇒ <tt>Object</tt>
|
|
1761
|
+
|
|
1762
|
+
|
|
1763
|
+
|
|
1764
|
+
|
|
1765
|
+
|
|
1766
|
+
</h3><div class="docstring">
|
|
1767
|
+
<div class="discussion">
|
|
1768
|
+
|
|
1769
|
+
<p>DSL method Removes a content block and fails if the content block was not found.</p>
|
|
1770
|
+
|
|
1771
|
+
|
|
1772
|
+
</div>
|
|
1773
|
+
</div>
|
|
1774
|
+
<div class="tags">
|
|
1775
|
+
<p class="tag_title">Parameters:</p>
|
|
1776
|
+
<ul class="param">
|
|
1777
|
+
|
|
1778
|
+
<li>
|
|
1779
|
+
|
|
1780
|
+
<span class='name'>name</span>
|
|
1781
|
+
|
|
1782
|
+
|
|
1783
|
+
<span class='type'>(<tt>Symbol</tt>, <tt>String</tt>)</span>
|
|
1784
|
+
|
|
1785
|
+
|
|
1786
|
+
|
|
1787
|
+
—
|
|
1788
|
+
<div class='inline'>
|
|
1789
|
+
<p>Name of the content block that should be removed</p>
|
|
1790
|
+
</div>
|
|
1791
|
+
|
|
1792
|
+
</li>
|
|
1793
|
+
|
|
1794
|
+
</ul>
|
|
1795
|
+
|
|
1796
|
+
|
|
1797
|
+
</div><table class="source_code">
|
|
1798
|
+
<tr>
|
|
1799
|
+
<td>
|
|
1800
|
+
<pre class="lines">
|
|
1801
|
+
|
|
1802
|
+
|
|
1694
1803
|
156
|
|
1695
1804
|
157
|
|
1696
|
-
158
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1805
|
+
158</pre>
|
|
1806
|
+
</td>
|
|
1807
|
+
<td>
|
|
1808
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 156</span>
|
|
1809
|
+
|
|
1810
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_remove_content!'>remove_content!</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
|
|
1811
|
+
<span class='id identifier rubyid_remove_content'>remove_content</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</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'>Content block </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'> not found for removal 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>
|
|
1812
|
+
<span class='kw'>end</span></pre>
|
|
1813
|
+
</td>
|
|
1814
|
+
</tr>
|
|
1815
|
+
</table>
|
|
1816
|
+
</div>
|
|
1817
|
+
|
|
1818
|
+
<div class="method_details ">
|
|
1819
|
+
<h3 class="signature " id="render-instance_method">
|
|
1820
|
+
|
|
1821
|
+
#<strong>render</strong>(controller, standalone: false, **locals) ⇒ <tt>Object</tt>
|
|
1822
|
+
|
|
1823
|
+
|
|
1824
|
+
|
|
1825
|
+
|
|
1826
|
+
|
|
1827
|
+
</h3><div class="docstring">
|
|
1828
|
+
<div class="discussion">
|
|
1829
|
+
|
|
1830
|
+
<p>Renders the component using the controller passsed to it and returns it as a string. Do not overwrite.</p>
|
|
1831
|
+
|
|
1832
|
+
|
|
1833
|
+
</div>
|
|
1834
|
+
</div>
|
|
1835
|
+
<div class="tags">
|
|
1836
|
+
<p class="tag_title">Parameters:</p>
|
|
1837
|
+
<ul class="param">
|
|
1838
|
+
|
|
1839
|
+
<li>
|
|
1840
|
+
|
|
1841
|
+
<span class='name'>standalone</span>
|
|
1842
|
+
|
|
1843
|
+
|
|
1844
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
1845
|
+
|
|
1846
|
+
|
|
1847
|
+
<em class="default">(defaults to: <tt>false</tt>)</em>
|
|
1848
|
+
|
|
1849
|
+
|
|
1850
|
+
—
|
|
1851
|
+
<div class='inline'>
|
|
1852
|
+
<p>pass true iff <code>render</code> is called from <code>render_standalone</code></p>
|
|
1853
|
+
</div>
|
|
1854
|
+
|
|
1855
|
+
</li>
|
|
1856
|
+
|
|
1857
|
+
</ul>
|
|
1858
|
+
|
|
1859
|
+
|
|
1860
|
+
</div><table class="source_code">
|
|
1861
|
+
<tr>
|
|
1862
|
+
<td>
|
|
1863
|
+
<pre class="lines">
|
|
1864
|
+
|
|
1865
|
+
|
|
1701
1866
|
163
|
|
1702
1867
|
164
|
|
1703
1868
|
165
|
|
@@ -1705,10 +1870,33 @@
|
|
|
1705
1870
|
167
|
|
1706
1871
|
168
|
|
1707
1872
|
169
|
|
1708
|
-
170
|
|
1873
|
+
170
|
|
1874
|
+
171
|
|
1875
|
+
172
|
|
1876
|
+
173
|
|
1877
|
+
174
|
|
1878
|
+
175
|
|
1879
|
+
176
|
|
1880
|
+
177
|
|
1881
|
+
178
|
|
1882
|
+
179
|
|
1883
|
+
180
|
|
1884
|
+
181
|
|
1885
|
+
182
|
|
1886
|
+
183
|
|
1887
|
+
184
|
|
1888
|
+
185
|
|
1889
|
+
186
|
|
1890
|
+
187
|
|
1891
|
+
188
|
|
1892
|
+
189
|
|
1893
|
+
190
|
|
1894
|
+
191
|
|
1895
|
+
192
|
|
1896
|
+
193</pre>
|
|
1709
1897
|
</td>
|
|
1710
1898
|
<td>
|
|
1711
|
-
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line
|
|
1899
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 163</span>
|
|
1712
1900
|
|
|
1713
1901
|
<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>
|
|
1714
1902
|
<span class='comment'># Call before_render hooks (if any) and backfire instance variables back to the component
|
|
@@ -1772,25 +1960,25 @@
|
|
|
1772
1960
|
<pre class="lines">
|
|
1773
1961
|
|
|
1774
1962
|
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1963
|
+
209
|
|
1964
|
+
210
|
|
1965
|
+
211
|
|
1966
|
+
212
|
|
1967
|
+
213
|
|
1968
|
+
214
|
|
1969
|
+
215
|
|
1970
|
+
216
|
|
1971
|
+
217
|
|
1972
|
+
218
|
|
1973
|
+
219
|
|
1974
|
+
220
|
|
1975
|
+
221
|
|
1976
|
+
222
|
|
1977
|
+
223
|
|
1978
|
+
224</pre>
|
|
1791
1979
|
</td>
|
|
1792
1980
|
<td>
|
|
1793
|
-
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line
|
|
1981
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 209</span>
|
|
1794
1982
|
|
|
1795
1983
|
<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>
|
|
1796
1984
|
<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>
|
|
@@ -1852,12 +2040,12 @@
|
|
|
1852
2040
|
<pre class="lines">
|
|
1853
2041
|
|
|
1854
2042
|
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
2043
|
+
227
|
|
2044
|
+
228
|
|
2045
|
+
229</pre>
|
|
1858
2046
|
</td>
|
|
1859
2047
|
<td>
|
|
1860
|
-
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line
|
|
2048
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 227</span>
|
|
1861
2049
|
|
|
1862
2050
|
<span class='kw'>def</span> <span class='id identifier rubyid_resourceful?'>resourceful?</span>
|
|
1863
2051
|
<span class='kw'>return</span> <span class='kw'>false</span>
|
|
@@ -1990,12 +2178,12 @@
|
|
|
1990
2178
|
<pre class="lines">
|
|
1991
2179
|
|
|
1992
2180
|
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
2181
|
+
204
|
|
2182
|
+
205
|
|
2183
|
+
206</pre>
|
|
1996
2184
|
</td>
|
|
1997
2185
|
<td>
|
|
1998
|
-
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line
|
|
2186
|
+
<pre class="code"><span class="info file"># File 'lib/compony/component.rb', line 204</span>
|
|
1999
2187
|
|
|
2000
2188
|
<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>
|
|
2001
2189
|
<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>
|
|
@@ -2055,7 +2243,7 @@
|
|
|
2055
2243
|
</div>
|
|
2056
2244
|
|
|
2057
2245
|
<div id="footer">
|
|
2058
|
-
Generated on
|
|
2246
|
+
Generated on Sat Jun 1 14:22:43 2024 by
|
|
2059
2247
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
2060
2248
|
0.9.34 (ruby-3.2.2).
|
|
2061
2249
|
</div>
|
|
@@ -396,7 +396,7 @@
|
|
|
396
396
|
</div>
|
|
397
397
|
|
|
398
398
|
<div id="footer">
|
|
399
|
-
Generated on
|
|
399
|
+
Generated on Sat Jun 1 14:22:42 2024 by
|
|
400
400
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
401
401
|
0.9.34 (ruby-3.2.2).
|
|
402
402
|
</div>
|
|
@@ -529,7 +529,7 @@
|
|
|
529
529
|
</div>
|
|
530
530
|
|
|
531
531
|
<div id="footer">
|
|
532
|
-
Generated on
|
|
532
|
+
Generated on Sat Jun 1 14:22:43 2024 by
|
|
533
533
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
534
534
|
0.9.34 (ruby-3.2.2).
|
|
535
535
|
</div>
|
|
@@ -578,7 +578,7 @@
|
|
|
578
578
|
</div>
|
|
579
579
|
|
|
580
580
|
<div id="footer">
|
|
581
|
-
Generated on
|
|
581
|
+
Generated on Sat Jun 1 14:22:43 2024 by
|
|
582
582
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
583
583
|
0.9.34 (ruby-3.2.2).
|
|
584
584
|
</div>
|
|
@@ -567,7 +567,7 @@
|
|
|
567
567
|
</div>
|
|
568
568
|
|
|
569
569
|
<div id="footer">
|
|
570
|
-
Generated on
|
|
570
|
+
Generated on Sat Jun 1 14:22:43 2024 by
|
|
571
571
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
572
572
|
0.9.34 (ruby-3.2.2).
|
|
573
573
|
</div>
|
|
@@ -682,7 +682,7 @@
|
|
|
682
682
|
</div>
|
|
683
683
|
|
|
684
684
|
<div id="footer">
|
|
685
|
-
Generated on
|
|
685
|
+
Generated on Sat Jun 1 14:22:42 2024 by
|
|
686
686
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
687
687
|
0.9.34 (ruby-3.2.2).
|
|
688
688
|
</div>
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
</div>
|
|
117
117
|
|
|
118
118
|
<div id="footer">
|
|
119
|
-
Generated on
|
|
119
|
+
Generated on Sat Jun 1 14:22:42 2024 by
|
|
120
120
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
121
121
|
0.9.34 (ruby-3.2.2).
|
|
122
122
|
</div>
|
|
@@ -1183,7 +1183,7 @@
|
|
|
1183
1183
|
</div>
|
|
1184
1184
|
|
|
1185
1185
|
<div id="footer">
|
|
1186
|
-
Generated on
|
|
1186
|
+
Generated on Sat Jun 1 14:22:42 2024 by
|
|
1187
1187
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
1188
1188
|
0.9.34 (ruby-3.2.2).
|
|
1189
1189
|
</div>
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
</div>
|
|
117
117
|
|
|
118
118
|
<div id="footer">
|
|
119
|
-
Generated on
|
|
119
|
+
Generated on Sat Jun 1 14:22:42 2024 by
|
|
120
120
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
121
121
|
0.9.34 (ruby-3.2.2).
|
|
122
122
|
</div>
|