compony 0.5.2 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -0
  3. data/CHANGELOG.md +15 -0
  4. data/Gemfile.lock +6 -6
  5. data/README.md +38 -0
  6. data/VERSION +1 -1
  7. data/app/controllers/compony_controller.rb +4 -0
  8. data/compony.gemspec +4 -4
  9. data/doc/ComponentGenerator.html +1 -1
  10. data/doc/Components.html +1 -1
  11. data/doc/ComponentsGenerator.html +1 -1
  12. data/doc/Compony/Component.html +1 -1
  13. data/doc/Compony/ComponentMixins/Default/Labelling.html +1 -1
  14. data/doc/Compony/ComponentMixins/Default/Standalone/ResourcefulVerbDsl.html +1 -1
  15. data/doc/Compony/ComponentMixins/Default/Standalone/StandaloneDsl.html +96 -27
  16. data/doc/Compony/ComponentMixins/Default/Standalone/VerbDsl.html +1 -1
  17. data/doc/Compony/ComponentMixins/Default/Standalone.html +1 -1
  18. data/doc/Compony/ComponentMixins/Default.html +1 -1
  19. data/doc/Compony/ComponentMixins/Resourceful.html +1 -1
  20. data/doc/Compony/ComponentMixins.html +1 -1
  21. data/doc/Compony/Components/Button.html +9 -5
  22. data/doc/Compony/Components/Destroy.html +1 -1
  23. data/doc/Compony/Components/Edit.html +1 -1
  24. data/doc/Compony/Components/Form.html +289 -135
  25. data/doc/Compony/Components/New.html +1 -1
  26. data/doc/Compony/Components/WithForm.html +1 -1
  27. data/doc/Compony/Components.html +1 -1
  28. data/doc/Compony/ControllerMixin.html +1 -1
  29. data/doc/Compony/Engine.html +1 -1
  30. data/doc/Compony/MethodAccessibleHash.html +1 -1
  31. data/doc/Compony/ModelFields/Anchormodel.html +1 -1
  32. data/doc/Compony/ModelFields/Association.html +1 -1
  33. data/doc/Compony/ModelFields/Attachment.html +1 -1
  34. data/doc/Compony/ModelFields/Base.html +1 -1
  35. data/doc/Compony/ModelFields/Boolean.html +1 -1
  36. data/doc/Compony/ModelFields/Color.html +1 -1
  37. data/doc/Compony/ModelFields/Currency.html +1 -1
  38. data/doc/Compony/ModelFields/Date.html +1 -1
  39. data/doc/Compony/ModelFields/Datetime.html +1 -1
  40. data/doc/Compony/ModelFields/Decimal.html +1 -1
  41. data/doc/Compony/ModelFields/Email.html +1 -1
  42. data/doc/Compony/ModelFields/Float.html +1 -1
  43. data/doc/Compony/ModelFields/Integer.html +1 -1
  44. data/doc/Compony/ModelFields/Percentage.html +1 -1
  45. data/doc/Compony/ModelFields/Phone.html +1 -1
  46. data/doc/Compony/ModelFields/RichText.html +1 -1
  47. data/doc/Compony/ModelFields/String.html +1 -1
  48. data/doc/Compony/ModelFields/Text.html +1 -1
  49. data/doc/Compony/ModelFields/Time.html +1 -1
  50. data/doc/Compony/ModelFields/Url.html +1 -1
  51. data/doc/Compony/ModelFields.html +1 -1
  52. data/doc/Compony/ModelMixin.html +25 -25
  53. data/doc/Compony/NaturalOrdering.html +1 -1
  54. data/doc/Compony/RequestContext.html +1 -1
  55. data/doc/Compony/Version.html +1 -1
  56. data/doc/Compony/ViewHelpers.html +30 -12
  57. data/doc/Compony.html +4 -4
  58. data/doc/ComponyController.html +1 -1
  59. data/doc/_index.html +1 -1
  60. data/doc/file.README.html +39 -1
  61. data/doc/index.html +39 -1
  62. data/doc/method_list.html +65 -41
  63. data/doc/top-level-namespace.html +1 -1
  64. data/lib/compony/component_mixins/default/standalone/standalone_dsl.rb +18 -10
  65. data/lib/compony/components/button.rb +5 -3
  66. data/lib/compony/components/form.rb +57 -32
  67. data/lib/compony/model_mixin.rb +19 -13
  68. data/lib/compony/view_helpers.rb +12 -4
  69. data/lib/compony.rb +3 -3
  70. metadata +3 -9
data/doc/file.README.html CHANGED
@@ -624,6 +624,8 @@
624
624
  </li><li>
625
625
  <p><code>skip_authentication!</code> which disables authentication, in case you provided some. You need to implement <code>authorize</code> regardless.</p>
626
626
  </li><li>
627
+ <p><code>skip_forgery_protection!</code> which disables CSRF protection for the controller action generated for this standalone configuration.</p>
628
+ </li><li>
627
629
  <p><code>layout</code> which takes the file name of a Rails layout and defaults to <code>layouts/application</code>. Use this to have your Rails application look differently depending on the component.</p>
628
630
  </li><li>
629
631
  <p><code>verb</code> which takes an HTTP verb as a symbol, one of: <code>%i[get head post put delete connect options trace patch]</code>. <code>verb</code> can be called up to once per verb. Inside each <code>verb</code> call, you can call (in the non-resourceful case):</p>
@@ -1089,6 +1091,7 @@ The number 8 has the binary form 1000. Enter a number and press ENTER: [8]
1089
1091
  <p>Examples:</p>
1090
1092
 
1091
1093
  <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_compony_link'>compony_link</span><span class='lparen'>(</span><span class='symbol'>:index</span><span class='comma'>,</span> <span class='symbol'>:users</span><span class='rparen'>)</span> <span class='comment'># &quot;View all users&quot; -&gt; &#39;users/index&#39;
1094
+ </span><span class='id identifier rubyid_compony_link'>compony_link</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="Components.html" title="Components (module)">Components</a></span></span><span class='op'>::</span><span class='const'>Users</span><span class='op'>::</span><span class='const'>Index</span><span class='rparen'>)</span> <span class='comment'># same as above
1092
1095
  </span><span class='id identifier rubyid_compony_link'>compony_link</span><span class='lparen'>(</span><span class='symbol'>:index</span><span class='comma'>,</span> <span class='symbol'>:users</span><span class='comma'>,</span> <span class='label'>label_opts:</span> <span class='lbrace'>{</span> <span class='label'>format:</span> <span class='symbol'>:short</span> <span class='rbrace'>}</span><span class='rparen'>)</span> <span class='comment'># &quot;All&quot; -&gt; &#39;users/index&#39;
1093
1096
  </span><span class='id identifier rubyid_compony_link'>compony_link</span><span class='lparen'>(</span><span class='symbol'>:show</span><span class='comma'>,</span> <span class='const'>User</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='rparen'>)</span> <span class='comment'># &quot;View John Doe&quot; -&gt; &#39;users/show/1&#39;
1094
1097
  </span><span class='id identifier rubyid_compony_link'>compony_link</span><span class='lparen'>(</span><span class='symbol'>:destroy</span><span class='comma'>,</span> <span class='const'>User</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='comma'>,</span> <span class='label'>method:</span> <span class='symbol'>:delete</span><span class='rparen'>)</span> <span class='comment'># &quot;Delete John Doe&quot; -&gt; &#39;users/destroy/1&#39;
@@ -1449,6 +1452,8 @@ my_button = Compony.button(:index, :users, enabled: -&gt; { |controller| control
1449
1452
  <p>Optional: <code>schema_line</code> takes a single Schemacop line. Use this for custom whitelisting of an argument, e.g. if you have an input that does not have a corresponding model field.</p>
1450
1453
  </li><li>
1451
1454
  <p>Optional: <code>schema</code> allows you to instead fully define your own custom Schemacop V3 schema manually. Note that this disables all of the above schema calls.</p>
1455
+ </li><li>
1456
+ <p>Optional: <code>disable!</code> causes generated inputs to be disabled. Alternatively, <code>disabled: true</code> can be passed to the initializer to achieve the same result.</p>
1452
1457
  </li></ul>
1453
1458
 
1454
1459
  <p>The <code>form_fields</code> block acts much like a content block and you will use Dyny there. Two additional methods are made available exclusively inside the block:</p>
@@ -1515,6 +1520,39 @@ my_button = Compony.button(:index, :users, enabled: -&gt; { |controller| control
1515
1520
  cannot :set_password, User # This prohibits setting and changing passwords of any user
1516
1521
  </code></pre>
1517
1522
 
1523
+ <h4 id="label-Dealing+with+multilingual+fields">Dealing with multilingual fields</h4>
1524
+
1525
+ <p>When using Gems such as <code>mobility</code>, Compony provides support for multilingual fields. For instance, assuming that a model has the attribute <code>label</code> translated in English and German, making <code>label</code> a virtual attribute reading either <code>label_en</code> and <code>label_de</code>, depending on the user’s language, Compony automatically generates a multilingual field if the following is used:</p>
1526
+
1527
+ <p>In the model:</p>
1528
+
1529
+ <pre class="code ruby"><code class="ruby"><span class='kw'>class</span> <span class='const'>Foo</span> <span class='op'>&lt;</span> <span class='const'>ApplicationRecord</span>
1530
+ <span class='comment'># No need to write:
1531
+ </span> <span class='id identifier rubyid_field'>field</span> <span class='symbol'>:label</span><span class='comma'>,</span> <span class='symbol'>:string</span><span class='comma'>,</span> <span class='label'>virtual:</span> <span class='kw'>true</span>
1532
+ <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_available_locales'>available_locales</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_locale'>locale</span><span class='op'>|</span>
1533
+ <span class='id identifier rubyid_field'>field</span> <span class='symbol'>:&quot;label_</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_locale'>locale</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='symbol'>:string</span>
1534
+ <span class='kw'>end</span>
1535
+
1536
+ <span class='comment'># Instead, write this, which is equivalent:
1537
+ </span> <span class='id identifier rubyid_field'>field</span> <span class='symbol'>:label</span><span class='comma'>,</span> <span class='symbol'>:string</span><span class='comma'>,</span> <span class='label'>multilang:</span> <span class='kw'>true</span>
1538
+ <span class='kw'>end</span>
1539
+ </code></pre>
1540
+
1541
+ <p>In the same mindset, you can simplify your form as follows to generate one input per language:</p>
1542
+
1543
+ <pre class="code ruby"><code class="ruby"><span class='kw'>class</span> <span class='const'><span class='object_link'><a href="Components.html" title="Components (module)">Components</a></span></span><span class='op'>::</span><span class='const'>Foos</span><span class='op'>::</span><span class='const'>Form</span> <span class='op'>&lt;</span> <span class='const'><span class='object_link'><a href="Compony.html" title="Compony (module)">Compony</a></span></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/Form.html" title="Compony::Components::Form (class)">Form</a></span></span>
1544
+ <span class='id identifier rubyid_setup'>setup</span> <span class='kw'>do</span>
1545
+ <span class='id identifier rubyid_form_fields'>form_fields</span> <span class='kw'>do</span>
1546
+ <span class='comment'># Since `field` only generates an input, you must loop over them and render them as you wish, e.g. with &quot;concat&quot;:
1547
+ </span> <span class='id identifier rubyid_field'>field</span><span class='lparen'>(</span><span class='symbol'>:label</span><span class='comma'>,</span> <span class='label'>multilang:</span> <span class='kw'>true</span><span class='rparen'>)</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_inp'>inp</span><span class='op'>|</span> <span class='id identifier rubyid_concat'>concat</span> <span class='id identifier rubyid_inp'>inp</span> <span class='rbrace'>}</span>
1548
+ <span class='kw'>end</span>
1549
+
1550
+ <span class='comment'># Don&#39;t forget to mark `schema_field` as multilingual as well, which will accept label_en and label_de:
1551
+ </span> <span class='id identifier rubyid_schema_field'>schema_field</span> <span class='symbol'>:label</span><span class='comma'>,</span> <span class='label'>multilang:</span> <span class='kw'>true</span>
1552
+ <span class='kw'>end</span>
1553
+ <span class='kw'>end</span>
1554
+ </code></pre>
1555
+
1518
1556
  <h3 id="label-New">New</h3>
1519
1557
 
1520
1558
  <p>This component is the Compony equivalent to a typical Rails controller’s <code>new</code> and <code>create</code> actions.</p>
@@ -1692,7 +1730,7 @@ my_button = Compony.button(:index, :users, enabled: -&gt; { |controller| control
1692
1730
  </div></div>
1693
1731
 
1694
1732
  <div id="footer">
1695
- Generated on Wed Nov 20 10:54:24 2024 by
1733
+ Generated on Fri Feb 14 13:24:11 2025 by
1696
1734
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1697
1735
  0.9.37 (ruby-3.3.5).
1698
1736
  </div>
data/doc/index.html CHANGED
@@ -624,6 +624,8 @@
624
624
  </li><li>
625
625
  <p><code>skip_authentication!</code> which disables authentication, in case you provided some. You need to implement <code>authorize</code> regardless.</p>
626
626
  </li><li>
627
+ <p><code>skip_forgery_protection!</code> which disables CSRF protection for the controller action generated for this standalone configuration.</p>
628
+ </li><li>
627
629
  <p><code>layout</code> which takes the file name of a Rails layout and defaults to <code>layouts/application</code>. Use this to have your Rails application look differently depending on the component.</p>
628
630
  </li><li>
629
631
  <p><code>verb</code> which takes an HTTP verb as a symbol, one of: <code>%i[get head post put delete connect options trace patch]</code>. <code>verb</code> can be called up to once per verb. Inside each <code>verb</code> call, you can call (in the non-resourceful case):</p>
@@ -1089,6 +1091,7 @@ The number 8 has the binary form 1000. Enter a number and press ENTER: [8]
1089
1091
  <p>Examples:</p>
1090
1092
 
1091
1093
  <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_compony_link'>compony_link</span><span class='lparen'>(</span><span class='symbol'>:index</span><span class='comma'>,</span> <span class='symbol'>:users</span><span class='rparen'>)</span> <span class='comment'># &quot;View all users&quot; -&gt; &#39;users/index&#39;
1094
+ </span><span class='id identifier rubyid_compony_link'>compony_link</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="Components.html" title="Components (module)">Components</a></span></span><span class='op'>::</span><span class='const'>Users</span><span class='op'>::</span><span class='const'>Index</span><span class='rparen'>)</span> <span class='comment'># same as above
1092
1095
  </span><span class='id identifier rubyid_compony_link'>compony_link</span><span class='lparen'>(</span><span class='symbol'>:index</span><span class='comma'>,</span> <span class='symbol'>:users</span><span class='comma'>,</span> <span class='label'>label_opts:</span> <span class='lbrace'>{</span> <span class='label'>format:</span> <span class='symbol'>:short</span> <span class='rbrace'>}</span><span class='rparen'>)</span> <span class='comment'># &quot;All&quot; -&gt; &#39;users/index&#39;
1093
1096
  </span><span class='id identifier rubyid_compony_link'>compony_link</span><span class='lparen'>(</span><span class='symbol'>:show</span><span class='comma'>,</span> <span class='const'>User</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='rparen'>)</span> <span class='comment'># &quot;View John Doe&quot; -&gt; &#39;users/show/1&#39;
1094
1097
  </span><span class='id identifier rubyid_compony_link'>compony_link</span><span class='lparen'>(</span><span class='symbol'>:destroy</span><span class='comma'>,</span> <span class='const'>User</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='comma'>,</span> <span class='label'>method:</span> <span class='symbol'>:delete</span><span class='rparen'>)</span> <span class='comment'># &quot;Delete John Doe&quot; -&gt; &#39;users/destroy/1&#39;
@@ -1449,6 +1452,8 @@ my_button = Compony.button(:index, :users, enabled: -&gt; { |controller| control
1449
1452
  <p>Optional: <code>schema_line</code> takes a single Schemacop line. Use this for custom whitelisting of an argument, e.g. if you have an input that does not have a corresponding model field.</p>
1450
1453
  </li><li>
1451
1454
  <p>Optional: <code>schema</code> allows you to instead fully define your own custom Schemacop V3 schema manually. Note that this disables all of the above schema calls.</p>
1455
+ </li><li>
1456
+ <p>Optional: <code>disable!</code> causes generated inputs to be disabled. Alternatively, <code>disabled: true</code> can be passed to the initializer to achieve the same result.</p>
1452
1457
  </li></ul>
1453
1458
 
1454
1459
  <p>The <code>form_fields</code> block acts much like a content block and you will use Dyny there. Two additional methods are made available exclusively inside the block:</p>
@@ -1515,6 +1520,39 @@ my_button = Compony.button(:index, :users, enabled: -&gt; { |controller| control
1515
1520
  cannot :set_password, User # This prohibits setting and changing passwords of any user
1516
1521
  </code></pre>
1517
1522
 
1523
+ <h4 id="label-Dealing+with+multilingual+fields">Dealing with multilingual fields</h4>
1524
+
1525
+ <p>When using Gems such as <code>mobility</code>, Compony provides support for multilingual fields. For instance, assuming that a model has the attribute <code>label</code> translated in English and German, making <code>label</code> a virtual attribute reading either <code>label_en</code> and <code>label_de</code>, depending on the user’s language, Compony automatically generates a multilingual field if the following is used:</p>
1526
+
1527
+ <p>In the model:</p>
1528
+
1529
+ <pre class="code ruby"><code class="ruby"><span class='kw'>class</span> <span class='const'>Foo</span> <span class='op'>&lt;</span> <span class='const'>ApplicationRecord</span>
1530
+ <span class='comment'># No need to write:
1531
+ </span> <span class='id identifier rubyid_field'>field</span> <span class='symbol'>:label</span><span class='comma'>,</span> <span class='symbol'>:string</span><span class='comma'>,</span> <span class='label'>virtual:</span> <span class='kw'>true</span>
1532
+ <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_available_locales'>available_locales</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_locale'>locale</span><span class='op'>|</span>
1533
+ <span class='id identifier rubyid_field'>field</span> <span class='symbol'>:&quot;label_</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_locale'>locale</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='symbol'>:string</span>
1534
+ <span class='kw'>end</span>
1535
+
1536
+ <span class='comment'># Instead, write this, which is equivalent:
1537
+ </span> <span class='id identifier rubyid_field'>field</span> <span class='symbol'>:label</span><span class='comma'>,</span> <span class='symbol'>:string</span><span class='comma'>,</span> <span class='label'>multilang:</span> <span class='kw'>true</span>
1538
+ <span class='kw'>end</span>
1539
+ </code></pre>
1540
+
1541
+ <p>In the same mindset, you can simplify your form as follows to generate one input per language:</p>
1542
+
1543
+ <pre class="code ruby"><code class="ruby"><span class='kw'>class</span> <span class='const'><span class='object_link'><a href="Components.html" title="Components (module)">Components</a></span></span><span class='op'>::</span><span class='const'>Foos</span><span class='op'>::</span><span class='const'>Form</span> <span class='op'>&lt;</span> <span class='const'><span class='object_link'><a href="Compony.html" title="Compony (module)">Compony</a></span></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/Form.html" title="Compony::Components::Form (class)">Form</a></span></span>
1544
+ <span class='id identifier rubyid_setup'>setup</span> <span class='kw'>do</span>
1545
+ <span class='id identifier rubyid_form_fields'>form_fields</span> <span class='kw'>do</span>
1546
+ <span class='comment'># Since `field` only generates an input, you must loop over them and render them as you wish, e.g. with &quot;concat&quot;:
1547
+ </span> <span class='id identifier rubyid_field'>field</span><span class='lparen'>(</span><span class='symbol'>:label</span><span class='comma'>,</span> <span class='label'>multilang:</span> <span class='kw'>true</span><span class='rparen'>)</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_inp'>inp</span><span class='op'>|</span> <span class='id identifier rubyid_concat'>concat</span> <span class='id identifier rubyid_inp'>inp</span> <span class='rbrace'>}</span>
1548
+ <span class='kw'>end</span>
1549
+
1550
+ <span class='comment'># Don&#39;t forget to mark `schema_field` as multilingual as well, which will accept label_en and label_de:
1551
+ </span> <span class='id identifier rubyid_schema_field'>schema_field</span> <span class='symbol'>:label</span><span class='comma'>,</span> <span class='label'>multilang:</span> <span class='kw'>true</span>
1552
+ <span class='kw'>end</span>
1553
+ <span class='kw'>end</span>
1554
+ </code></pre>
1555
+
1518
1556
  <h3 id="label-New">New</h3>
1519
1557
 
1520
1558
  <p>This component is the Compony equivalent to a typical Rails controller’s <code>new</code> and <code>create</code> actions.</p>
@@ -1692,7 +1730,7 @@ my_button = Compony.button(:index, :users, enabled: -&gt; { |controller| control
1692
1730
  </div></div>
1693
1731
 
1694
1732
  <div id="footer">
1695
- Generated on Wed Nov 20 10:54:23 2024 by
1733
+ Generated on Fri Feb 14 13:24:10 2025 by
1696
1734
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1697
1735
  0.9.37 (ruby-3.3.5).
1698
1736
  </div>
data/doc/method_list.html CHANGED
@@ -392,6 +392,14 @@
392
392
 
393
393
 
394
394
  <li class="even ">
395
+ <div class="item">
396
+ <span class='object_link'><a href="Compony/Components/Form.html#disable!-instance_method" title="Compony::Components::Form#disable! (method)">#disable!</a></span>
397
+ <small>Compony::Components::Form</small>
398
+ </div>
399
+ </li>
400
+
401
+
402
+ <li class="odd ">
395
403
  <div class="item">
396
404
  <span class='object_link'><a href="Compony/RequestContext.html#evaluate_with_backfire-instance_method" title="Compony::RequestContext#evaluate_with_backfire (method)">#evaluate_with_backfire</a></span>
397
405
  <small>Compony::RequestContext</small>
@@ -399,7 +407,7 @@
399
407
  </li>
400
408
 
401
409
 
402
- <li class="odd ">
410
+ <li class="even ">
403
411
  <div class="item">
404
412
  <span class='object_link'><a href="Compony/ModelFields/Base.html#extra_attrs-instance_method" title="Compony::ModelFields::Base#extra_attrs (method)">#extra_attrs</a></span>
405
413
  <small>Compony::ModelFields::Base</small>
@@ -407,7 +415,7 @@
407
415
  </li>
408
416
 
409
417
 
410
- <li class="even ">
418
+ <li class="odd ">
411
419
  <div class="item">
412
420
  <span class='object_link'><a href="Compony/Components/Form.html#f-instance_method" title="Compony::Components::Form#f (method)">#f</a></span>
413
421
  <small>Compony::Components::Form</small>
@@ -415,7 +423,7 @@
415
423
  </li>
416
424
 
417
425
 
418
- <li class="odd ">
426
+ <li class="even ">
419
427
  <div class="item">
420
428
  <span class='object_link'><a href="Compony/Component.html#family_cst-class_method" title="Compony::Component.family_cst (method)">family_cst</a></span>
421
429
  <small>Compony::Component</small>
@@ -423,7 +431,7 @@
423
431
  </li>
424
432
 
425
433
 
426
- <li class="even ">
434
+ <li class="odd ">
427
435
  <div class="item">
428
436
  <span class='object_link'><a href="Compony/Component.html#family_cst-instance_method" title="Compony::Component#family_cst (method)">#family_cst</a></span>
429
437
  <small>Compony::Component</small>
@@ -431,7 +439,7 @@
431
439
  </li>
432
440
 
433
441
 
434
- <li class="odd ">
442
+ <li class="even ">
435
443
  <div class="item">
436
444
  <span class='object_link'><a href="Compony/Component.html#family_name-class_method" title="Compony::Component.family_name (method)">family_name</a></span>
437
445
  <small>Compony::Component</small>
@@ -439,7 +447,7 @@
439
447
  </li>
440
448
 
441
449
 
442
- <li class="even ">
450
+ <li class="odd ">
443
451
  <div class="item">
444
452
  <span class='object_link'><a href="Compony/Component.html#family_name-instance_method" title="Compony::Component#family_name (method)">#family_name</a></span>
445
453
  <small>Compony::Component</small>
@@ -447,7 +455,7 @@
447
455
  </li>
448
456
 
449
457
 
450
- <li class="odd ">
458
+ <li class="even ">
451
459
  <div class="item">
452
460
  <span class='object_link'><a href="Compony.html#family_name_for-class_method" title="Compony.family_name_for (method)">family_name_for</a></span>
453
461
  <small>Compony</small>
@@ -455,7 +463,7 @@
455
463
  </li>
456
464
 
457
465
 
458
- <li class="even ">
466
+ <li class="odd ">
459
467
  <div class="item">
460
468
  <span class='object_link'><a href="Compony/ModelMixin.html#feasibility_messages-instance_method" title="Compony::ModelMixin#feasibility_messages (method)">#feasibility_messages</a></span>
461
469
  <small>Compony::ModelMixin</small>
@@ -463,7 +471,7 @@
463
471
  </li>
464
472
 
465
473
 
466
- <li class="odd ">
474
+ <li class="even ">
467
475
  <div class="item">
468
476
  <span class='object_link'><a href="Compony/ModelMixin.html#feasible%3F-instance_method" title="Compony::ModelMixin#feasible? (method)">#feasible?</a></span>
469
477
  <small>Compony::ModelMixin</small>
@@ -471,7 +479,7 @@
471
479
  </li>
472
480
 
473
481
 
474
- <li class="even ">
482
+ <li class="odd ">
475
483
  <div class="item">
476
484
  <span class='object_link'><a href="Compony/ModelMixin.html#field-instance_method" title="Compony::ModelMixin#field (method)">#field</a></span>
477
485
  <small>Compony::ModelMixin</small>
@@ -479,7 +487,7 @@
479
487
  </li>
480
488
 
481
489
 
482
- <li class="odd ">
490
+ <li class="even ">
483
491
  <div class="item">
484
492
  <span class='object_link'><a href="Compony/Components/Form.html#field-instance_method" title="Compony::Components::Form#field (method)">#field</a></span>
485
493
  <small>Compony::Components::Form</small>
@@ -487,7 +495,7 @@
487
495
  </li>
488
496
 
489
497
 
490
- <li class="even ">
498
+ <li class="odd ">
491
499
  <div class="item">
492
500
  <span class='object_link'><a href="Compony/Components/WithForm.html#form_cancancan_action-instance_method" title="Compony::Components::WithForm#form_cancancan_action (method)">#form_cancancan_action</a></span>
493
501
  <small>Compony::Components::WithForm</small>
@@ -495,7 +503,7 @@
495
503
  </li>
496
504
 
497
505
 
498
- <li class="odd ">
506
+ <li class="even ">
499
507
  <div class="item">
500
508
  <span class='object_link'><a href="Compony/Components/WithForm.html#form_comp-instance_method" title="Compony::Components::WithForm#form_comp (method)">#form_comp</a></span>
501
509
  <small>Compony::Components::WithForm</small>
@@ -503,7 +511,7 @@
503
511
  </li>
504
512
 
505
513
 
506
- <li class="even ">
514
+ <li class="odd ">
507
515
  <div class="item">
508
516
  <span class='object_link'><a href="Compony/Components/WithForm.html#form_comp_class-instance_method" title="Compony::Components::WithForm#form_comp_class (method)">#form_comp_class</a></span>
509
517
  <small>Compony::Components::WithForm</small>
@@ -511,7 +519,7 @@
511
519
  </li>
512
520
 
513
521
 
514
- <li class="odd ">
522
+ <li class="even ">
515
523
  <div class="item">
516
524
  <span class='object_link'><a href="Compony/Components/Form.html#form_fields-instance_method" title="Compony::Components::Form#form_fields (method)">#form_fields</a></span>
517
525
  <small>Compony::Components::Form</small>
@@ -519,6 +527,14 @@
519
527
  </li>
520
528
 
521
529
 
530
+ <li class="odd ">
531
+ <div class="item">
532
+ <span class='object_link'><a href="Compony/Components/Form.html#form_params-instance_method" title="Compony::Components::Form#form_params (method)">#form_params</a></span>
533
+ <small>Compony::Components::Form</small>
534
+ </div>
535
+ </li>
536
+
537
+
522
538
  <li class="even ">
523
539
  <div class="item">
524
540
  <span class='object_link'><a href="Compony/ModelMixin.html#full_feasibility_messages-instance_method" title="Compony::ModelMixin#full_feasibility_messages (method)">#full_feasibility_messages</a></span>
@@ -1296,6 +1312,14 @@
1296
1312
 
1297
1313
 
1298
1314
  <li class="odd ">
1315
+ <div class="item">
1316
+ <span class='object_link'><a href="Compony/ComponentMixins/Default/Standalone/StandaloneDsl.html#skip_forgery_protection!-instance_method" title="Compony::ComponentMixins::Default::Standalone::StandaloneDsl#skip_forgery_protection! (method)">#skip_forgery_protection!</a></span>
1317
+ <small>Compony::ComponentMixins::Default::Standalone::StandaloneDsl</small>
1318
+ </div>
1319
+ </li>
1320
+
1321
+
1322
+ <li class="even ">
1299
1323
  <div class="item">
1300
1324
  <span class='object_link'><a href="Compony/ComponentMixins/Default/Standalone.html#standalone-instance_method" title="Compony::ComponentMixins::Default::Standalone#standalone (method)">#standalone</a></span>
1301
1325
  <small>Compony::ComponentMixins::Default::Standalone</small>
@@ -1303,7 +1327,7 @@
1303
1327
  </li>
1304
1328
 
1305
1329
 
1306
- <li class="even ">
1330
+ <li class="odd ">
1307
1331
  <div class="item">
1308
1332
  <span class='object_link'><a href="Compony/ComponentMixins/Default/Standalone.html#standalone_access_permitted_for%3F-instance_method" title="Compony::ComponentMixins::Default::Standalone#standalone_access_permitted_for? (method)">#standalone_access_permitted_for?</a></span>
1309
1333
  <small>Compony::ComponentMixins::Default::Standalone</small>
@@ -1311,7 +1335,7 @@
1311
1335
  </li>
1312
1336
 
1313
1337
 
1314
- <li class="odd ">
1338
+ <li class="even ">
1315
1339
  <div class="item">
1316
1340
  <span class='object_link'><a href="Compony/ComponentMixins/Resourceful.html#store_data-instance_method" title="Compony::ComponentMixins::Resourceful#store_data (method)">#store_data</a></span>
1317
1341
  <small>Compony::ComponentMixins::Resourceful</small>
@@ -1319,7 +1343,7 @@
1319
1343
  </li>
1320
1344
 
1321
1345
 
1322
- <li class="even ">
1346
+ <li class="odd ">
1323
1347
  <div class="item">
1324
1348
  <span class='object_link'><a href="Compony/ComponentMixins/Default/Standalone/ResourcefulVerbDsl.html#store_data-instance_method" title="Compony::ComponentMixins::Default::Standalone::ResourcefulVerbDsl#store_data (method)">#store_data</a></span>
1325
1349
  <small>Compony::ComponentMixins::Default::Standalone::ResourcefulVerbDsl</small>
@@ -1327,7 +1351,7 @@
1327
1351
  </li>
1328
1352
 
1329
1353
 
1330
- <li class="odd ">
1354
+ <li class="even ">
1331
1355
  <div class="item">
1332
1356
  <span class='object_link'><a href="Compony/Component.html#sub_comp-instance_method" title="Compony::Component#sub_comp (method)">#sub_comp</a></span>
1333
1357
  <small>Compony::Component</small>
@@ -1335,7 +1359,7 @@
1335
1359
  </li>
1336
1360
 
1337
1361
 
1338
- <li class="even ">
1362
+ <li class="odd ">
1339
1363
  <div class="item">
1340
1364
  <span class='object_link'><a href="Compony/Components/WithForm.html#submit_path-instance_method" title="Compony::Components::WithForm#submit_path (method)">#submit_path</a></span>
1341
1365
  <small>Compony::Components::WithForm</small>
@@ -1343,7 +1367,7 @@
1343
1367
  </li>
1344
1368
 
1345
1369
 
1346
- <li class="odd ">
1370
+ <li class="even ">
1347
1371
  <div class="item">
1348
1372
  <span class='object_link'><a href="Compony/Components/WithForm.html#submit_verb-instance_method" title="Compony::Components::WithForm#submit_verb (method)">#submit_verb</a></span>
1349
1373
  <small>Compony::Components::WithForm</small>
@@ -1351,7 +1375,7 @@
1351
1375
  </li>
1352
1376
 
1353
1377
 
1354
- <li class="even ">
1378
+ <li class="odd ">
1355
1379
  <div class="item">
1356
1380
  <span class='object_link'><a href="Compony/ComponentMixins/Default/Standalone/VerbDsl.html#to_conf-instance_method" title="Compony::ComponentMixins::Default::Standalone::VerbDsl#to_conf (method)">#to_conf</a></span>
1357
1381
  <small>Compony::ComponentMixins::Default::Standalone::VerbDsl</small>
@@ -1359,7 +1383,7 @@
1359
1383
  </li>
1360
1384
 
1361
1385
 
1362
- <li class="odd ">
1386
+ <li class="even ">
1363
1387
  <div class="item">
1364
1388
  <span class='object_link'><a href="Compony/ComponentMixins/Default/Standalone/StandaloneDsl.html#to_conf-instance_method" title="Compony::ComponentMixins::Default::Standalone::StandaloneDsl#to_conf (method)">#to_conf</a></span>
1365
1389
  <small>Compony::ComponentMixins::Default::Standalone::StandaloneDsl</small>
@@ -1367,7 +1391,7 @@
1367
1391
  </li>
1368
1392
 
1369
1393
 
1370
- <li class="even ">
1394
+ <li class="odd ">
1371
1395
  <div class="item">
1372
1396
  <span class='object_link'><a href="Compony/ComponentMixins/Default/Standalone/ResourcefulVerbDsl.html#to_conf-instance_method" title="Compony::ComponentMixins::Default::Standalone::ResourcefulVerbDsl#to_conf (method)">#to_conf</a></span>
1373
1397
  <small>Compony::ComponentMixins::Default::Standalone::ResourcefulVerbDsl</small>
@@ -1375,7 +1399,7 @@
1375
1399
  </li>
1376
1400
 
1377
1401
 
1378
- <li class="odd ">
1402
+ <li class="even ">
1379
1403
  <div class="item">
1380
1404
  <span class='object_link'><a href="Compony/ModelFields/Base.html#transform_and_join-instance_method" title="Compony::ModelFields::Base#transform_and_join (method)">#transform_and_join</a></span>
1381
1405
  <small>Compony::ModelFields::Base</small>
@@ -1383,7 +1407,7 @@
1383
1407
  </li>
1384
1408
 
1385
1409
 
1386
- <li class="even ">
1410
+ <li class="odd ">
1387
1411
  <div class="item">
1388
1412
  <span class='object_link'><a href="Compony/ModelFields/Url.html#value_for-instance_method" title="Compony::ModelFields::Url#value_for (method)">#value_for</a></span>
1389
1413
  <small>Compony::ModelFields::Url</small>
@@ -1391,7 +1415,7 @@
1391
1415
  </li>
1392
1416
 
1393
1417
 
1394
- <li class="odd ">
1418
+ <li class="even ">
1395
1419
  <div class="item">
1396
1420
  <span class='object_link'><a href="Compony/ModelFields/Base.html#value_for-instance_method" title="Compony::ModelFields::Base#value_for (method)">#value_for</a></span>
1397
1421
  <small>Compony::ModelFields::Base</small>
@@ -1399,7 +1423,7 @@
1399
1423
  </li>
1400
1424
 
1401
1425
 
1402
- <li class="even ">
1426
+ <li class="odd ">
1403
1427
  <div class="item">
1404
1428
  <span class='object_link'><a href="Compony/ModelFields/Date.html#value_for-instance_method" title="Compony::ModelFields::Date#value_for (method)">#value_for</a></span>
1405
1429
  <small>Compony::ModelFields::Date</small>
@@ -1407,7 +1431,7 @@
1407
1431
  </li>
1408
1432
 
1409
1433
 
1410
- <li class="odd ">
1434
+ <li class="even ">
1411
1435
  <div class="item">
1412
1436
  <span class='object_link'><a href="Compony/ModelFields/Color.html#value_for-instance_method" title="Compony::ModelFields::Color#value_for (method)">#value_for</a></span>
1413
1437
  <small>Compony::ModelFields::Color</small>
@@ -1415,7 +1439,7 @@
1415
1439
  </li>
1416
1440
 
1417
1441
 
1418
- <li class="even ">
1442
+ <li class="odd ">
1419
1443
  <div class="item">
1420
1444
  <span class='object_link'><a href="Compony/ModelFields/Email.html#value_for-instance_method" title="Compony::ModelFields::Email#value_for (method)">#value_for</a></span>
1421
1445
  <small>Compony::ModelFields::Email</small>
@@ -1423,7 +1447,7 @@
1423
1447
  </li>
1424
1448
 
1425
1449
 
1426
- <li class="odd ">
1450
+ <li class="even ">
1427
1451
  <div class="item">
1428
1452
  <span class='object_link'><a href="Compony/ModelFields/Phone.html#value_for-instance_method" title="Compony::ModelFields::Phone#value_for (method)">#value_for</a></span>
1429
1453
  <small>Compony::ModelFields::Phone</small>
@@ -1431,7 +1455,7 @@
1431
1455
  </li>
1432
1456
 
1433
1457
 
1434
- <li class="even ">
1458
+ <li class="odd ">
1435
1459
  <div class="item">
1436
1460
  <span class='object_link'><a href="Compony/ModelFields/Boolean.html#value_for-instance_method" title="Compony::ModelFields::Boolean#value_for (method)">#value_for</a></span>
1437
1461
  <small>Compony::ModelFields::Boolean</small>
@@ -1439,7 +1463,7 @@
1439
1463
  </li>
1440
1464
 
1441
1465
 
1442
- <li class="odd ">
1466
+ <li class="even ">
1443
1467
  <div class="item">
1444
1468
  <span class='object_link'><a href="Compony/ModelFields/Currency.html#value_for-instance_method" title="Compony::ModelFields::Currency#value_for (method)">#value_for</a></span>
1445
1469
  <small>Compony::ModelFields::Currency</small>
@@ -1447,7 +1471,7 @@
1447
1471
  </li>
1448
1472
 
1449
1473
 
1450
- <li class="even ">
1474
+ <li class="odd ">
1451
1475
  <div class="item">
1452
1476
  <span class='object_link'><a href="Compony/ModelFields/Datetime.html#value_for-instance_method" title="Compony::ModelFields::Datetime#value_for (method)">#value_for</a></span>
1453
1477
  <small>Compony::ModelFields::Datetime</small>
@@ -1455,7 +1479,7 @@
1455
1479
  </li>
1456
1480
 
1457
1481
 
1458
- <li class="odd ">
1482
+ <li class="even ">
1459
1483
  <div class="item">
1460
1484
  <span class='object_link'><a href="Compony/ModelFields/Attachment.html#value_for-instance_method" title="Compony::ModelFields::Attachment#value_for (method)">#value_for</a></span>
1461
1485
  <small>Compony::ModelFields::Attachment</small>
@@ -1463,7 +1487,7 @@
1463
1487
  </li>
1464
1488
 
1465
1489
 
1466
- <li class="even ">
1490
+ <li class="odd ">
1467
1491
  <div class="item">
1468
1492
  <span class='object_link'><a href="Compony/ModelFields/Percentage.html#value_for-instance_method" title="Compony::ModelFields::Percentage#value_for (method)">#value_for</a></span>
1469
1493
  <small>Compony::ModelFields::Percentage</small>
@@ -1471,7 +1495,7 @@
1471
1495
  </li>
1472
1496
 
1473
1497
 
1474
- <li class="odd ">
1498
+ <li class="even ">
1475
1499
  <div class="item">
1476
1500
  <span class='object_link'><a href="Compony/ModelFields/Anchormodel.html#value_for-instance_method" title="Compony::ModelFields::Anchormodel#value_for (method)">#value_for</a></span>
1477
1501
  <small>Compony::ModelFields::Anchormodel</small>
@@ -1479,7 +1503,7 @@
1479
1503
  </li>
1480
1504
 
1481
1505
 
1482
- <li class="even ">
1506
+ <li class="odd ">
1483
1507
  <div class="item">
1484
1508
  <span class='object_link'><a href="Compony/ModelFields/Association.html#value_for-instance_method" title="Compony::ModelFields::Association#value_for (method)">#value_for</a></span>
1485
1509
  <small>Compony::ModelFields::Association</small>
@@ -1487,7 +1511,7 @@
1487
1511
  </li>
1488
1512
 
1489
1513
 
1490
- <li class="odd ">
1514
+ <li class="even ">
1491
1515
  <div class="item">
1492
1516
  <span class='object_link'><a href="Compony/ComponentMixins/Default/Standalone/StandaloneDsl.html#verb-instance_method" title="Compony::ComponentMixins::Default::Standalone::StandaloneDsl#verb (method)">#verb</a></span>
1493
1517
  <small>Compony::ComponentMixins::Default::Standalone::StandaloneDsl</small>
@@ -1495,7 +1519,7 @@
1495
1519
  </li>
1496
1520
 
1497
1521
 
1498
- <li class="even ">
1522
+ <li class="odd ">
1499
1523
  <div class="item">
1500
1524
  <span class='object_link'><a href="Compony.html#with_button_defaults-class_method" title="Compony.with_button_defaults (method)">with_button_defaults</a></span>
1501
1525
  <small>Compony</small>
@@ -1503,7 +1527,7 @@
1503
1527
  </li>
1504
1528
 
1505
1529
 
1506
- <li class="odd ">
1530
+ <li class="even ">
1507
1531
  <div class="item">
1508
1532
  <span class='object_link'><a href="Compony/Components/Form.html#with_simpleform-instance_method" title="Compony::Components::Form#with_simpleform (method)">#with_simpleform</a></span>
1509
1533
  <small>Compony::Components::Form</small>
@@ -102,7 +102,7 @@
102
102
  </div>
103
103
 
104
104
  <div id="footer">
105
- Generated on Wed Nov 20 10:54:24 2024 by
105
+ Generated on Fri Feb 14 13:24:11 2025 by
106
106
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
107
107
  0.9.37 (ruby-3.3.5).
108
108
  </div>
@@ -17,6 +17,7 @@ module Compony
17
17
  @scope_args = scope_args
18
18
  @verbs = {}
19
19
  @skip_authentication = false
20
+ @skip_forgery_protection = false
20
21
  @layout = true # can be overriden by false or a string
21
22
  end
22
23
 
@@ -25,16 +26,17 @@ module Compony
25
26
  evaluate(&block)
26
27
  @component = block.binding.eval('self') # Fetches the component holding this DSL call (via the block)
27
28
  return {
28
- name: @name,
29
- path: @path,
30
- constraints: @constraints,
31
- scope: @scope,
32
- scope_args: @scope_args,
33
- verbs: @verbs,
34
- rails_action_name: Compony.rails_action_name(comp_name, family_name, @name),
35
- path_helper_name: Compony.path_helper_name(comp_name, family_name, @name),
36
- skip_authentication: @skip_authentication,
37
- layout: @layout
29
+ name: @name,
30
+ path: @path,
31
+ constraints: @constraints,
32
+ scope: @scope,
33
+ scope_args: @scope_args,
34
+ verbs: @verbs,
35
+ rails_action_name: Compony.rails_action_name(comp_name, family_name, @name),
36
+ path_helper_name: Compony.path_helper_name(comp_name, family_name, @name),
37
+ skip_authentication: @skip_authentication,
38
+ skip_forgery_protection: @skip_forgery_protection,
39
+ layout: @layout
38
40
  }.compact
39
41
  end
40
42
 
@@ -65,6 +67,12 @@ module Compony
65
67
  @skip_authentication = true
66
68
  end
67
69
 
70
+ # DSL
71
+ # Defines that for this component, no forgery protection (CSRF) should be performed.
72
+ def skip_forgery_protection!
73
+ @skip_forgery_protection = true
74
+ end
75
+
68
76
  # DSL
69
77
  # Speficies the Rails layout (under `app/views/layouts`) that should be used to render this component.
70
78
  # Defaults to Rails' default (`layouts/application`) if the method is never called.