compony 0.5.0 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -0
  3. data/README.md +31 -0
  4. data/VERSION +1 -1
  5. data/compony.gemspec +4 -4
  6. data/config/routes.rb +9 -6
  7. data/doc/ComponentGenerator.html +3 -3
  8. data/doc/Components.html +3 -3
  9. data/doc/ComponentsGenerator.html +3 -3
  10. data/doc/Compony/Component.html +3 -3
  11. data/doc/Compony/ComponentMixins/Default/Labelling.html +3 -3
  12. data/doc/Compony/ComponentMixins/Default/Standalone/ResourcefulVerbDsl.html +3 -3
  13. data/doc/Compony/ComponentMixins/Default/Standalone/StandaloneDsl.html +40 -28
  14. data/doc/Compony/ComponentMixins/Default/Standalone/VerbDsl.html +3 -3
  15. data/doc/Compony/ComponentMixins/Default/Standalone.html +3 -3
  16. data/doc/Compony/ComponentMixins/Default.html +3 -3
  17. data/doc/Compony/ComponentMixins/Resourceful.html +3 -3
  18. data/doc/Compony/ComponentMixins.html +3 -3
  19. data/doc/Compony/Components/Button.html +3 -3
  20. data/doc/Compony/Components/Destroy.html +3 -3
  21. data/doc/Compony/Components/Edit.html +3 -3
  22. data/doc/Compony/Components/Form.html +3 -3
  23. data/doc/Compony/Components/New.html +3 -3
  24. data/doc/Compony/Components/WithForm.html +3 -3
  25. data/doc/Compony/Components.html +3 -3
  26. data/doc/Compony/ControllerMixin.html +3 -3
  27. data/doc/Compony/Engine.html +3 -3
  28. data/doc/Compony/MethodAccessibleHash.html +3 -3
  29. data/doc/Compony/ModelFields/Anchormodel.html +3 -3
  30. data/doc/Compony/ModelFields/Association.html +4 -4
  31. data/doc/Compony/ModelFields/Attachment.html +3 -3
  32. data/doc/Compony/ModelFields/Base.html +3 -3
  33. data/doc/Compony/ModelFields/Boolean.html +3 -3
  34. data/doc/Compony/ModelFields/Color.html +3 -3
  35. data/doc/Compony/ModelFields/Currency.html +3 -3
  36. data/doc/Compony/ModelFields/Date.html +3 -3
  37. data/doc/Compony/ModelFields/Datetime.html +3 -3
  38. data/doc/Compony/ModelFields/Decimal.html +3 -3
  39. data/doc/Compony/ModelFields/Email.html +3 -3
  40. data/doc/Compony/ModelFields/Float.html +3 -3
  41. data/doc/Compony/ModelFields/Integer.html +3 -3
  42. data/doc/Compony/ModelFields/Percentage.html +3 -3
  43. data/doc/Compony/ModelFields/Phone.html +3 -3
  44. data/doc/Compony/ModelFields/RichText.html +3 -3
  45. data/doc/Compony/ModelFields/String.html +3 -3
  46. data/doc/Compony/ModelFields/Text.html +3 -3
  47. data/doc/Compony/ModelFields/Time.html +3 -3
  48. data/doc/Compony/ModelFields/Url.html +3 -3
  49. data/doc/Compony/ModelFields.html +3 -3
  50. data/doc/Compony/ModelMixin.html +25 -25
  51. data/doc/Compony/NaturalOrdering.html +3 -3
  52. data/doc/Compony/RequestContext.html +3 -3
  53. data/doc/Compony/Version.html +3 -3
  54. data/doc/Compony/ViewHelpers.html +3 -3
  55. data/doc/Compony.html +3 -3
  56. data/doc/ComponyController.html +3 -3
  57. data/doc/_index.html +4 -4
  58. data/doc/class_list.html +6 -3
  59. data/doc/css/full_list.css +3 -3
  60. data/doc/css/style.css +6 -0
  61. data/doc/file.README.html +33 -3
  62. data/doc/file_list.html +5 -2
  63. data/doc/frames.html +10 -5
  64. data/doc/index.html +33 -3
  65. data/doc/js/app.js +294 -264
  66. data/doc/js/full_list.js +30 -4
  67. data/doc/method_list.html +5 -2
  68. data/doc/top-level-namespace.html +3 -3
  69. data/lib/compony/component_mixins/default/standalone/standalone_dsl.rb +7 -1
  70. data/lib/compony/model_fields/association.rb +1 -1
  71. data/lib/compony/model_mixin.rb +5 -1
  72. metadata +3 -3
data/doc/index.html CHANGED
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  File: README
8
8
 
9
- &mdash; Documentation by YARD 0.9.34
9
+ &mdash; Documentation by YARD 0.9.37
10
10
 
11
11
  </title>
12
12
 
@@ -702,6 +702,34 @@
702
702
  <p>If you want to redirect depending on params, state, time etc. <strong>independently of the HTTP verb</strong>, use <code>before_render</code>, as this is more convenient than writing a standalone -&gt; verb -&gt; respond tree.</p>
703
703
  </li></ul>
704
704
 
705
+ <h3 id="label-Path+constraints">Path constraints</h3>
706
+
707
+ <p>When calling <code>standalone</code>, you may specify the keyword <code>constraints</code> that will be passed to the route. For example:</p>
708
+
709
+ <pre class="code ruby"><code class="ruby"><span class='comment'># In your component
710
+ </span><span class='id identifier rubyid_standelone'>standelone</span> <span class='label'>path:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>/:lang</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='label'>constraints:</span> <span class='lbrace'>{</span> <span class='label'>lang:</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>([a-z]{2})?</span><span class='regexp_end'>/i</span></span> <span class='rbrace'>}</span>
711
+
712
+ <span class='comment'># This will automatically lead to a route of this form:
713
+ </span><span class='id identifier rubyid_get'>get</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>:lang</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='label'>constraints:</span> <span class='lbrace'>{</span> <span class='label'>lang:</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>([a-z]{2})?</span><span class='regexp_end'>/i</span></span> <span class='rbrace'>}</span>
714
+ </code></pre>
715
+
716
+ <h3 id="label-Passing+scopes">Passing scopes</h3>
717
+
718
+ <p>When calling <code>standalone</code>, you may specify the keyword <code>scope</code> to wrap the component’s Rails route into a route scope. Additionally, you may specify a hash <code>scope_args</code>, which will be passed as keyword arguments to the <code>scope</code> call in the route:</p>
719
+
720
+ <pre class="code ruby"><code class="ruby"><span class='comment'># In your component
721
+ </span><span class='id identifier rubyid_standalone'>standalone</span> <span class='label'>path:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>/welcome</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='label'>scope:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>(:lang)</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='label'>scope_args:</span> <span class='lbrace'>{</span> <span class='label'>lang:</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>([a-z]{2})?</span><span class='regexp_end'>/i</span></span> <span class='rbrace'>}</span> <span class='kw'>do</span>
722
+ <span class='id identifier rubyid_verb'>verb</span> <span class='symbol'>:get</span> <span class='kw'>do</span>
723
+ <span class='comment'># ....
724
+ </span> <span class='kw'>end</span>
725
+ <span class='kw'>end</span>
726
+
727
+ <span class='comment'># This will automatically lead to a route of this form:
728
+ </span><span class='id identifier rubyid_scope'>scope</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>(:lang)</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='label'>lang:</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>([a-z]{2})?</span><span class='regexp_end'>/i</span></span> <span class='kw'>do</span>
729
+ <span class='id identifier rubyid_get'>get</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>welcome</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='label'>to:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>compony#your_component</span><span class='tstring_end'>&#39;</span></span>
730
+ <span class='kw'>end</span>
731
+ </code></pre>
732
+
705
733
  <h2 id="label-Inheritance">Inheritance</h2>
706
734
 
707
735
  <p>When inheriting from another component class, <code>setup</code> can be called in the child as well in order to overwrite specified configurations. The parent’s <code>setup</code> block will be run first, then the child’s, then the grand-child’s and so on.</p>
@@ -1652,6 +1680,8 @@ my_button = Compony.button(:index, :users, enabled: -&gt; { |controller| control
1652
1680
  <p>The feasibility framework does not yet enforce prevention, but only has effects on buttons. Actions should be structured more explicitly such that prevention becomes as tight as authorization.</p>
1653
1681
  </li><li>
1654
1682
  <p>Feasibility for links is not yet implemented.</p>
1683
+ </li><li>
1684
+ <p>Compony is not compatible with <code>tailwindcss-rails</code>. This is likely due to Tailwind automatically removing any CSS that is not used by the application and the usage detection not picking up Compony components, as their content is not provided in views.</p>
1655
1685
  </li></ul>
1656
1686
 
1657
1687
  <h1 id="label-Acknowledgements">Acknowledgements</h1>
@@ -1662,9 +1692,9 @@ my_button = Compony.button(:index, :users, enabled: -&gt; { |controller| control
1662
1692
  </div></div>
1663
1693
 
1664
1694
  <div id="footer">
1665
- Generated on Mon Sep 16 13:05:26 2024 by
1695
+ Generated on Wed Nov 20 10:54:23 2024 by
1666
1696
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1667
- 0.9.34 (ruby-3.3.5).
1697
+ 0.9.37 (ruby-3.3.5).
1668
1698
  </div>
1669
1699
 
1670
1700
  </div>