compony 0.5.1 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/README.md +33 -0
- data/VERSION +1 -1
- data/compony.gemspec +4 -4
- data/config/routes.rb +9 -6
- data/doc/ComponentGenerator.html +3 -3
- data/doc/Components.html +3 -3
- data/doc/ComponentsGenerator.html +3 -3
- data/doc/Compony/Component.html +3 -3
- data/doc/Compony/ComponentMixins/Default/Labelling.html +3 -3
- data/doc/Compony/ComponentMixins/Default/Standalone/ResourcefulVerbDsl.html +3 -3
- data/doc/Compony/ComponentMixins/Default/Standalone/StandaloneDsl.html +40 -28
- data/doc/Compony/ComponentMixins/Default/Standalone/VerbDsl.html +3 -3
- data/doc/Compony/ComponentMixins/Default/Standalone.html +3 -3
- data/doc/Compony/ComponentMixins/Default.html +3 -3
- data/doc/Compony/ComponentMixins/Resourceful.html +3 -3
- data/doc/Compony/ComponentMixins.html +3 -3
- data/doc/Compony/Components/Button.html +11 -7
- data/doc/Compony/Components/Destroy.html +3 -3
- data/doc/Compony/Components/Edit.html +3 -3
- data/doc/Compony/Components/Form.html +148 -77
- data/doc/Compony/Components/New.html +3 -3
- data/doc/Compony/Components/WithForm.html +3 -3
- data/doc/Compony/Components.html +3 -3
- data/doc/Compony/ControllerMixin.html +3 -3
- data/doc/Compony/Engine.html +3 -3
- data/doc/Compony/MethodAccessibleHash.html +3 -3
- data/doc/Compony/ModelFields/Anchormodel.html +3 -3
- data/doc/Compony/ModelFields/Association.html +4 -4
- data/doc/Compony/ModelFields/Attachment.html +3 -3
- data/doc/Compony/ModelFields/Base.html +3 -3
- data/doc/Compony/ModelFields/Boolean.html +3 -3
- data/doc/Compony/ModelFields/Color.html +3 -3
- data/doc/Compony/ModelFields/Currency.html +3 -3
- data/doc/Compony/ModelFields/Date.html +3 -3
- data/doc/Compony/ModelFields/Datetime.html +3 -3
- data/doc/Compony/ModelFields/Decimal.html +3 -3
- data/doc/Compony/ModelFields/Email.html +3 -3
- data/doc/Compony/ModelFields/Float.html +3 -3
- data/doc/Compony/ModelFields/Integer.html +3 -3
- data/doc/Compony/ModelFields/Percentage.html +3 -3
- data/doc/Compony/ModelFields/Phone.html +3 -3
- data/doc/Compony/ModelFields/RichText.html +3 -3
- data/doc/Compony/ModelFields/String.html +3 -3
- data/doc/Compony/ModelFields/Text.html +3 -3
- data/doc/Compony/ModelFields/Time.html +3 -3
- data/doc/Compony/ModelFields/Url.html +3 -3
- data/doc/Compony/ModelFields.html +3 -3
- data/doc/Compony/ModelMixin.html +3 -3
- data/doc/Compony/NaturalOrdering.html +3 -3
- data/doc/Compony/RequestContext.html +3 -3
- data/doc/Compony/Version.html +3 -3
- data/doc/Compony/ViewHelpers.html +32 -14
- data/doc/Compony.html +4 -4
- data/doc/ComponyController.html +3 -3
- data/doc/_index.html +4 -4
- data/doc/class_list.html +6 -3
- data/doc/css/full_list.css +3 -3
- data/doc/css/style.css +6 -0
- data/doc/file.README.html +36 -3
- data/doc/file_list.html +5 -2
- data/doc/frames.html +10 -5
- data/doc/index.html +36 -3
- data/doc/js/app.js +294 -264
- data/doc/js/full_list.js +30 -4
- data/doc/method_list.html +152 -141
- data/doc/top-level-namespace.html +3 -3
- data/lib/compony/component_mixins/default/standalone/standalone_dsl.rb +7 -1
- data/lib/compony/components/button.rb +5 -3
- data/lib/compony/components/form.rb +9 -1
- data/lib/compony/model_fields/association.rb +1 -1
- data/lib/compony/view_helpers.rb +12 -4
- data/lib/compony.rb +1 -1
- metadata +3 -3
data/doc/index.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
File: README
|
8
8
|
|
9
|
-
— Documentation by YARD 0.9.
|
9
|
+
— 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 -> verb -> 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'>'</span><span class='tstring_content'>/:lang</span><span class='tstring_end'>'</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'>'</span><span class='tstring_content'>:lang</span><span class='tstring_end'>'</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'>'</span><span class='tstring_content'>/welcome</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='label'>scope:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>(:lang)</span><span class='tstring_end'>'</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'>'</span><span class='tstring_content'>(:lang)</span><span class='tstring_end'>'</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'>'</span><span class='tstring_content'>welcome</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='label'>to:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>compony#your_component</span><span class='tstring_end'>'</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>
|
@@ -1061,6 +1089,7 @@ The number 8 has the binary form 1000. Enter a number and press ENTER: [8]
|
|
1061
1089
|
<p>Examples:</p>
|
1062
1090
|
|
1063
1091
|
<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'># "View all users" -> 'users/index'
|
1092
|
+
</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
|
1064
1093
|
</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'># "All" -> 'users/index'
|
1065
1094
|
</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'># "View John Doe" -> 'users/show/1'
|
1066
1095
|
</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'># "Delete John Doe" -> 'users/destroy/1'
|
@@ -1421,6 +1450,8 @@ my_button = Compony.button(:index, :users, enabled: -> { |controller| control
|
|
1421
1450
|
<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>
|
1422
1451
|
</li><li>
|
1423
1452
|
<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>
|
1453
|
+
</li><li>
|
1454
|
+
<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>
|
1424
1455
|
</li></ul>
|
1425
1456
|
|
1426
1457
|
<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>
|
@@ -1652,6 +1683,8 @@ my_button = Compony.button(:index, :users, enabled: -> { |controller| control
|
|
1652
1683
|
<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
1684
|
</li><li>
|
1654
1685
|
<p>Feasibility for links is not yet implemented.</p>
|
1686
|
+
</li><li>
|
1687
|
+
<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
1688
|
</li></ul>
|
1656
1689
|
|
1657
1690
|
<h1 id="label-Acknowledgements">Acknowledgements</h1>
|
@@ -1662,9 +1695,9 @@ my_button = Compony.button(:index, :users, enabled: -> { |controller| control
|
|
1662
1695
|
</div></div>
|
1663
1696
|
|
1664
1697
|
<div id="footer">
|
1665
|
-
Generated on
|
1698
|
+
Generated on Fri Dec 20 13:46:31 2024 by
|
1666
1699
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1667
|
-
0.9.
|
1700
|
+
0.9.37 (ruby-3.3.5).
|
1668
1701
|
</div>
|
1669
1702
|
|
1670
1703
|
</div>
|