compony 0.11.14 → 0.12.0

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.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +30 -0
  3. data/Gemfile.lock +1 -1
  4. data/VERSION +1 -1
  5. data/compony.gemspec +3 -3
  6. data/config/locales/de.yml +1 -1
  7. data/config/locales/en.yml +1 -1
  8. data/config/locales/es.yml +1 -1
  9. data/config/locales/fr.yml +1 -1
  10. data/doc/ComponentGenerator.html +1 -1
  11. data/doc/Components.html +1 -1
  12. data/doc/ComponentsGenerator.html +1 -1
  13. data/doc/Compony/Component.html +1 -1
  14. data/doc/Compony/ComponentMixins/Default/Labelling.html +1 -1
  15. data/doc/Compony/ComponentMixins/Default/Standalone/ResourcefulVerbDsl.html +1 -1
  16. data/doc/Compony/ComponentMixins/Default/Standalone/StandaloneDsl.html +1 -1
  17. data/doc/Compony/ComponentMixins/Default/Standalone/VerbDsl.html +1 -1
  18. data/doc/Compony/ComponentMixins/Default/Standalone.html +1 -1
  19. data/doc/Compony/ComponentMixins/Default.html +1 -1
  20. data/doc/Compony/ComponentMixins/Resourceful.html +1 -1
  21. data/doc/Compony/ComponentMixins.html +1 -1
  22. data/doc/Compony/Components/Buttons/CssButton.html +12 -1
  23. data/doc/Compony/Components/Buttons/Link.html +239 -16
  24. data/doc/Compony/Components/Buttons.html +1 -1
  25. data/doc/Compony/Components/Destroy.html +1 -1
  26. data/doc/Compony/Components/Edit.html +1 -1
  27. data/doc/Compony/Components/Form.html +83 -83
  28. data/doc/Compony/Components/Index.html +1 -1
  29. data/doc/Compony/Components/List.html +1 -1
  30. data/doc/Compony/Components/New.html +1 -1
  31. data/doc/Compony/Components/Show.html +1 -1
  32. data/doc/Compony/Components/WithForm.html +1 -1
  33. data/doc/Compony/Components.html +1 -1
  34. data/doc/Compony/ControllerMixin.html +1 -1
  35. data/doc/Compony/Engine.html +1 -1
  36. data/doc/Compony/Intent.html +1 -1
  37. data/doc/Compony/ManageIntentsDsl.html +1 -1
  38. data/doc/Compony/MethodAccessibleHash.html +1 -1
  39. data/doc/Compony/ModelFields/Anchormodel.html +1 -1
  40. data/doc/Compony/ModelFields/Association.html +1 -1
  41. data/doc/Compony/ModelFields/Attachment.html +13 -11
  42. data/doc/Compony/ModelFields/Base.html +1 -1
  43. data/doc/Compony/ModelFields/Boolean.html +1 -1
  44. data/doc/Compony/ModelFields/Color.html +1 -1
  45. data/doc/Compony/ModelFields/Currency.html +1 -1
  46. data/doc/Compony/ModelFields/Date.html +1 -1
  47. data/doc/Compony/ModelFields/Datetime.html +1 -1
  48. data/doc/Compony/ModelFields/Decimal.html +1 -1
  49. data/doc/Compony/ModelFields/Email.html +1 -1
  50. data/doc/Compony/ModelFields/Float.html +1 -1
  51. data/doc/Compony/ModelFields/Integer.html +1 -1
  52. data/doc/Compony/ModelFields/Percentage.html +1 -1
  53. data/doc/Compony/ModelFields/Phone.html +1 -1
  54. data/doc/Compony/ModelFields/RichText.html +1 -1
  55. data/doc/Compony/ModelFields/String.html +1 -1
  56. data/doc/Compony/ModelFields/Text.html +1 -1
  57. data/doc/Compony/ModelFields/Time.html +1 -1
  58. data/doc/Compony/ModelFields/Url.html +1 -1
  59. data/doc/Compony/ModelFields.html +1 -1
  60. data/doc/Compony/ModelMixin.html +1 -1
  61. data/doc/Compony/NaturalOrdering.html +1 -1
  62. data/doc/Compony/RequestContext.html +1 -1
  63. data/doc/Compony/Version.html +1 -1
  64. data/doc/Compony/ViewHelpers.html +1 -1
  65. data/doc/Compony/VirtualModel.html +1 -1
  66. data/doc/Compony.html +1 -1
  67. data/doc/ComponyController.html +1 -1
  68. data/doc/_index.html +1 -1
  69. data/doc/file.CHANGELOG.html +32 -9
  70. data/doc/file.README.html +1 -1
  71. data/doc/file.basic_component.html +1 -1
  72. data/doc/file.cookbook.html +1 -1
  73. data/doc/file.destroy.html +1 -1
  74. data/doc/file.dsl_reference.html +1 -1
  75. data/doc/file.edit.html +1 -1
  76. data/doc/file.example.html +1 -1
  77. data/doc/file.example_advanced.html +1 -1
  78. data/doc/file.feasibility.html +1 -1
  79. data/doc/file.form.html +1 -1
  80. data/doc/file.generators.html +1 -1
  81. data/doc/file.glossary.html +1 -1
  82. data/doc/file.gotchas.html +1 -1
  83. data/doc/file.index.html +1 -1
  84. data/doc/file.inheritance.html +1 -1
  85. data/doc/file.installation.html +1 -1
  86. data/doc/file.integrations.html +32 -2
  87. data/doc/file.intents.html +8 -4
  88. data/doc/file.internal_datastructures.html +1 -1
  89. data/doc/file.list.html +3 -1
  90. data/doc/file.maintaining.html +1 -1
  91. data/doc/file.model_fields.html +1 -1
  92. data/doc/file.nesting.html +1 -1
  93. data/doc/file.new.html +1 -1
  94. data/doc/file.ownership.html +1 -1
  95. data/doc/file.patterns.html +1 -1
  96. data/doc/file.pre_built_components.html +1 -1
  97. data/doc/file.resourceful.html +1 -1
  98. data/doc/file.show.html +1 -1
  99. data/doc/file.standalone.html +1 -1
  100. data/doc/file.virtual_models.html +1 -1
  101. data/doc/file.with_form.html +1 -1
  102. data/doc/guide/intents.md +6 -3
  103. data/doc/guide/pre_built_components/list.md +4 -0
  104. data/doc/index.html +1 -1
  105. data/doc/integrations.md +46 -1
  106. data/doc/method_list.html +69 -53
  107. data/doc/top-level-namespace.html +1 -1
  108. data/lib/compony/components/buttons/link.rb +37 -2
  109. data/lib/compony/components/form.rb +2 -6
  110. data/lib/compony/model_fields/attachment.rb +7 -6
  111. data/spec/compony/components/buttons/link_spec.rb +73 -0
  112. data/spec/compony/model_fields/attachment_spec.rb +41 -0
  113. data/spec/requests/users_crud_spec.rb +7 -0
  114. metadata +3 -1
@@ -222,7 +222,7 @@
222
222
  </div>
223
223
 
224
224
  <div id="footer">
225
- Generated on Wed Oct 7 10:48:21 2026 by
225
+ Generated on Wed Nov 25 14:15:20 2026 by
226
226
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
227
227
  0.9.34 (ruby-3.4.9).
228
228
  </div>
@@ -222,7 +222,7 @@
222
222
  </div>
223
223
 
224
224
  <div id="footer">
225
- Generated on Wed Oct 7 10:48:21 2026 by
225
+ Generated on Wed Nov 25 14:15:21 2026 by
226
226
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
227
227
  0.9.34 (ruby-3.4.9).
228
228
  </div>
@@ -144,7 +144,7 @@
144
144
  </div>
145
145
 
146
146
  <div id="footer">
147
- Generated on Wed Oct 7 10:48:21 2026 by
147
+ Generated on Wed Nov 25 14:15:21 2026 by
148
148
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
149
149
  0.9.34 (ruby-3.4.9).
150
150
  </div>
@@ -230,7 +230,7 @@
230
230
  </div>
231
231
 
232
232
  <div id="footer">
233
- Generated on Wed Oct 7 10:48:21 2026 by
233
+ Generated on Wed Nov 25 14:15:21 2026 by
234
234
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
235
235
  0.9.34 (ruby-3.4.9).
236
236
  </div>
@@ -144,7 +144,7 @@
144
144
  </div>
145
145
 
146
146
  <div id="footer">
147
- Generated on Wed Oct 7 10:48:21 2026 by
147
+ Generated on Wed Nov 25 14:15:21 2026 by
148
148
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
149
149
  0.9.34 (ruby-3.4.9).
150
150
  </div>
@@ -222,7 +222,7 @@
222
222
  </div>
223
223
 
224
224
  <div id="footer">
225
- Generated on Wed Oct 7 10:48:21 2026 by
225
+ Generated on Wed Nov 25 14:15:21 2026 by
226
226
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
227
227
  0.9.34 (ruby-3.4.9).
228
228
  </div>
@@ -222,7 +222,7 @@
222
222
  </div>
223
223
 
224
224
  <div id="footer">
225
- Generated on Wed Oct 7 10:48:21 2026 by
225
+ Generated on Wed Nov 25 14:15:21 2026 by
226
226
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
227
227
  0.9.34 (ruby-3.4.9).
228
228
  </div>
@@ -291,7 +291,7 @@
291
291
  </div>
292
292
 
293
293
  <div id="footer">
294
- Generated on Wed Oct 7 10:48:21 2026 by
294
+ Generated on Wed Nov 25 14:15:21 2026 by
295
295
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
296
296
  0.9.34 (ruby-3.4.9).
297
297
  </div>
@@ -222,7 +222,7 @@
222
222
  </div>
223
223
 
224
224
  <div id="footer">
225
- Generated on Wed Oct 7 10:48:21 2026 by
225
+ Generated on Wed Nov 25 14:15:21 2026 by
226
226
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
227
227
  0.9.34 (ruby-3.4.9).
228
228
  </div>
@@ -144,7 +144,7 @@
144
144
  </div>
145
145
 
146
146
  <div id="footer">
147
- Generated on Wed Oct 7 10:48:21 2026 by
147
+ Generated on Wed Nov 25 14:15:21 2026 by
148
148
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
149
149
  0.9.34 (ruby-3.4.9).
150
150
  </div>
@@ -144,7 +144,7 @@
144
144
  </div>
145
145
 
146
146
  <div id="footer">
147
- Generated on Wed Oct 7 10:48:21 2026 by
147
+ Generated on Wed Nov 25 14:15:20 2026 by
148
148
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
149
149
  0.9.34 (ruby-3.4.9).
150
150
  </div>
@@ -144,7 +144,7 @@
144
144
  </div>
145
145
 
146
146
  <div id="footer">
147
- Generated on Wed Oct 7 10:48:21 2026 by
147
+ Generated on Wed Nov 25 14:15:20 2026 by
148
148
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
149
149
  0.9.34 (ruby-3.4.9).
150
150
  </div>
@@ -230,7 +230,7 @@
230
230
  </div>
231
231
 
232
232
  <div id="footer">
233
- Generated on Wed Oct 7 10:48:21 2026 by
233
+ Generated on Wed Nov 25 14:15:20 2026 by
234
234
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
235
235
  0.9.34 (ruby-3.4.9).
236
236
  </div>
@@ -116,7 +116,7 @@
116
116
  </div>
117
117
 
118
118
  <div id="footer">
119
- Generated on Wed Oct 7 10:48:20 2026 by
119
+ Generated on Wed Nov 25 14:15:19 2026 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.4.9).
122
122
  </div>
@@ -519,7 +519,7 @@
519
519
  </div>
520
520
 
521
521
  <div id="footer">
522
- Generated on Wed Oct 7 10:48:20 2026 by
522
+ Generated on Wed Nov 25 14:15:19 2026 by
523
523
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
524
524
  0.9.34 (ruby-3.4.9).
525
525
  </div>
@@ -290,7 +290,7 @@
290
290
  </div>
291
291
 
292
292
  <div id="footer">
293
- Generated on Wed Oct 7 10:48:21 2026 by
293
+ Generated on Wed Nov 25 14:15:20 2026 by
294
294
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
295
295
  0.9.34 (ruby-3.4.9).
296
296
  </div>
@@ -1149,7 +1149,7 @@
1149
1149
  </div>
1150
1150
 
1151
1151
  <div id="footer">
1152
- Generated on Wed Oct 7 10:48:21 2026 by
1152
+ Generated on Wed Nov 25 14:15:20 2026 by
1153
1153
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1154
1154
  0.9.34 (ruby-3.4.9).
1155
1155
  </div>
@@ -129,7 +129,7 @@
129
129
  </div>
130
130
 
131
131
  <div id="footer">
132
- Generated on Wed Oct 7 10:48:20 2026 by
132
+ Generated on Wed Nov 25 14:15:19 2026 by
133
133
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
134
134
  0.9.34 (ruby-3.4.9).
135
135
  </div>
@@ -222,7 +222,7 @@
222
222
  </div>
223
223
 
224
224
  <div id="footer">
225
- Generated on Wed Oct 7 10:48:20 2026 by
225
+ Generated on Wed Nov 25 14:15:19 2026 by
226
226
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
227
227
  0.9.34 (ruby-3.4.9).
228
228
  </div>
@@ -228,7 +228,7 @@
228
228
  </div>
229
229
 
230
230
  <div id="footer">
231
- Generated on Wed Oct 7 10:48:20 2026 by
231
+ Generated on Wed Nov 25 14:15:20 2026 by
232
232
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
233
233
  0.9.34 (ruby-3.4.9).
234
234
  </div>
data/doc/Compony.html CHANGED
@@ -1854,7 +1854,7 @@
1854
1854
  </div>
1855
1855
 
1856
1856
  <div id="footer">
1857
- Generated on Wed Oct 7 10:48:20 2026 by
1857
+ Generated on Wed Nov 25 14:15:19 2026 by
1858
1858
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1859
1859
  0.9.34 (ruby-3.4.9).
1860
1860
  </div>
@@ -114,7 +114,7 @@
114
114
  </div>
115
115
 
116
116
  <div id="footer">
117
- Generated on Wed Oct 7 10:48:21 2026 by
117
+ Generated on Wed Nov 25 14:15:21 2026 by
118
118
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
119
119
  0.9.34 (ruby-3.4.9).
120
120
  </div>
data/doc/_index.html CHANGED
@@ -718,7 +718,7 @@
718
718
  </div>
719
719
 
720
720
  <div id="footer">
721
- Generated on Wed Oct 7 10:48:16 2026 by
721
+ Generated on Wed Nov 25 14:15:16 2026 by
722
722
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
723
723
  0.9.34 (ruby-3.4.9).
724
724
  </div>
@@ -58,6 +58,29 @@
58
58
  </div>
59
59
 
60
60
  <div id="content"><div id='filecontents'>
61
+ <h1 id="0120">0.12.0</h1>
62
+ <ul><li>
63
+ <p>Remove all inline JavaScript, so Compony works under a Content Security Policy whose <code>script-src</code> allows only scripts carrying a nonce (a nonce never allows <code>onclick</code> attributes or <code>javascript:</code> URLs):</p>
64
+ <ul><li>
65
+ <p>The <code>Form</code> component’s submit button is now a real <code>&lt;button type=&quot;submit&quot;&gt;</code> rendered by the button style, instead of a link submitting the form in an <code>onclick</code> handler next to a hidden submit button for Return. The hidden button is gone.</p>
66
+ </li><li>
67
+ <p>Button styles accept <code>type:</code> (e.g. <code>button: { type: :submit }</code>) and then render a <code>&lt;button&gt;</code> of that type instead of a link. A disabled one (class <code>disabled</code>) gets the <code>disabled</code> attribute.</p>
68
+ </li><li>
69
+ <p>Add <code>Buttons::Link#link_or_button(inner_html, **html_opts)</code>, which renders the button’s element: a <code>&lt;button&gt;</code> if <code>type:</code> was given, an <code>&lt;a&gt;</code> without <code>href</code> if no <code>href</code> was given (instead of <code>href=&quot;javascript:void(0)&quot;</code>), a regular link otherwise. A button style given <code>type:</code> that does not render through it raises an error, as it would render a link that cannot submit the form.</p>
70
+ </li><li>
71
+ <p>Existing attachments of a multi-attachment field are listed with a ticked checkbox each instead of a “Remove” link that deleted the entry in an <code>onclick</code> handler. Unticking the box removes the attachment on save, as the removed entry did before. The i18n key <code>compony.model_fields.attachment.remove</code> is replaced by <code>keep_hint</code> (the checkbox’s tooltip).</p>
72
+ </li></ul>
73
+ </li><li>
74
+ <p>Document how to set up Ransack for <code>List</code> filtering and sorting (closes #18): the gem in the Gemfile, the permission-based <code>ransackable_attributes</code> default from <code>Compony::ModelMixin</code>, and what the app still allowlists itself (<code>ransackable_associations</code>, <code>ransackable_scopes</code>, <code>auth_object</code> for its own <code>ransack</code> calls). See <code>doc/integrations.md</code>, “Ransack”.</p>
75
+ </li></ul>
76
+
77
+ <h2 id="steps-to-take">Steps to take</h2>
78
+ <ul><li>
79
+ <p>In every button style that overrides <code>content</code> and calls <code>link_to(@href, ...)</code> itself, render through <code>link_or_button</code> instead, e.g. <code>concat component.link_or_button(capture { span @label }, **@comp_opts)</code>. Otherwise every <code>Form</code> raises when rendering its submit button, and buttons without <code>href</code> keep rendering <code>href=&quot;javascript:void(0)&quot;</code>, which <code>@href</code> still holds for such styles.</p>
80
+ </li><li>
81
+ <p>If you override <code>compony.model_fields.attachment.remove</code> in your locales, translate <code>keep_hint</code> instead.</p>
82
+ </li></ul>
83
+
61
84
  <h1 id="01114">0.11.14</h1>
62
85
  <ul><li>
63
86
  <p>Add <code>Compony.content_locales=</code>, the locales for which <code>multilang: true</code> generates suffixed fields in the model’s <code>field</code>, the form’s <code>field</code> and <code>schema_field</code>. Defaults to <code>I18n.available_locales</code>, so existing apps are unaffected. Set it when the app’s locales differ from the languages its content is stored in, e.g. regional locales such as <code>:&quot;de-CH&quot;</code> with content stored per language. Accepts an array or a callable. See the form guide, “Content locales”.</p>
@@ -173,7 +196,7 @@
173
196
  <p>Fix a bug in intents preventing overriding the feasibility target</p>
174
197
  </li></ul>
175
198
 
176
- <h2 id="steps-to-take">Steps to take</h2>
199
+ <h2 id="steps-to-take-1">Steps to take</h2>
177
200
  <ul><li>
178
201
  <p>Search for <code>resourceful_sub_comp</code> and replace those calls by <code>render_sub_comp</code> while passing <code>@data</code> as the second intent argument.</p>
179
202
  </li></ul>
@@ -214,7 +237,7 @@
214
237
  <p>Rename <code>ExposedIntentsDsl</code> to <code>ManageIntentsDsl</code>, allow passing options and ignore <code>add</code> call if the target component is not defined</p>
215
238
  </li></ul>
216
239
 
217
- <h2 id="steps-to-take-1">Steps to take</h2>
240
+ <h2 id="steps-to-take-2">Steps to take</h2>
218
241
  <ul><li>
219
242
  <p>In your components, replace code like <code>icon :eye</code> by: <code>button(:icon){ :eye }</code> or <code>button(:icon){|_| :eye }</code> (the latter in the resourceful case)</p>
220
243
  </li><li>
@@ -238,7 +261,7 @@
238
261
  </li></ul>
239
262
  </li></ul>
240
263
 
241
- <h2 id="steps-to-take-2">Steps to take</h2>
264
+ <h2 id="steps-to-take-3">Steps to take</h2>
242
265
  <ul><li>
243
266
  <p>Replace code like <code>button: { style: :link }</code> by simply <code>style: :link</code></p>
244
267
  </li><li>
@@ -276,7 +299,7 @@
276
299
  <p>Update documentation</p>
277
300
  </li></ul>
278
301
 
279
- <h2 id="steps-to-take-3">Steps to take</h2>
302
+ <h2 id="steps-to-take-4">Steps to take</h2>
280
303
  <ul><li>
281
304
  <p>Make sure you no longer use the following methods that have been removed:</p>
282
305
  <ul><li>
@@ -336,7 +359,7 @@
336
359
  </li></ul>
337
360
  </li></ul>
338
361
 
339
- <h2 id="steps-to-take-4">Steps to take</h2>
362
+ <h2 id="steps-to-take-5">Steps to take</h2>
340
363
  <ul><li>
341
364
  <p>If using the methods formerly called <code>path</code> or <code>path_hash</code>, rename them to <code>id_path</code> respectively <code>id_path_hash</code>.</p>
342
365
  </li></ul>
@@ -446,7 +469,7 @@
446
469
  <p>Update Gems Compony depends on (this is to ensure all Compony users have versions Compony is frequently tested against)</p>
447
470
  </li></ul>
448
471
 
449
- <h2 id="steps-to-take-5">Steps to take</h2>
472
+ <h2 id="steps-to-take-6">Steps to take</h2>
450
473
  <ul><li>
451
474
  <p>Update your application to Ruby 3.3.5 and Rails 7.2.1. For instance, if you are running an rbenv setup, these would be typical steps involved:</p>
452
475
  </li><li>
@@ -579,7 +602,7 @@
579
602
  <p>Implement nesting of content blocks, as described in README.md -&gt; “Nesting content blocks, calling a content block from another”</p>
580
603
  </li></ul>
581
604
 
582
- <h2 id="steps-to-take-6">Steps to take</h2>
605
+ <h2 id="steps-to-take-7">Steps to take</h2>
583
606
  <ul><li>
584
607
  <p>Search for <code>comp_class_for</code> and <code>comp_class_for!</code> and replace them by <code>Compony.comp_class_for</code> and <code>Compony.comp_class_for!</code></p>
585
608
  </li><li>
@@ -750,7 +773,7 @@
750
773
  <p>Add field type :email</p>
751
774
  </li></ul>
752
775
 
753
- <h2 id="steps-to-take-7">Steps to take</h2>
776
+ <h2 id="steps-to-take-8">Steps to take</h2>
754
777
  <ul><li>
755
778
  <p>When inheriting from components, replace <code>Components::Resourceful::...</code> by <code>Components::...</code></p>
756
779
  </li></ul>
@@ -777,7 +800,7 @@
777
800
  </div></div>
778
801
 
779
802
  <div id="footer">
780
- Generated on Wed Oct 7 10:48:17 2026 by
803
+ Generated on Wed Nov 25 14:15:16 2026 by
781
804
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
782
805
  0.9.34 (ruby-3.4.9).
783
806
  </div>
data/doc/file.README.html CHANGED
@@ -230,7 +230,7 @@
230
230
  </div></div>
231
231
 
232
232
  <div id="footer">
233
- Generated on Wed Oct 7 10:48:16 2026 by
233
+ Generated on Wed Nov 25 14:15:16 2026 by
234
234
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
235
235
  0.9.34 (ruby-3.4.9).
236
236
  </div>
@@ -304,7 +304,7 @@
304
304
  </div></div>
305
305
 
306
306
  <div id="footer">
307
- Generated on Wed Oct 7 10:48:17 2026 by
307
+ Generated on Wed Nov 25 14:15:17 2026 by
308
308
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
309
309
  0.9.34 (ruby-3.4.9).
310
310
  </div>
@@ -179,7 +179,7 @@
179
179
  </div></div>
180
180
 
181
181
  <div id="footer">
182
- Generated on Wed Oct 7 10:48:19 2026 by
182
+ Generated on Wed Nov 25 14:15:19 2026 by
183
183
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
184
184
  0.9.34 (ruby-3.4.9).
185
185
  </div>
@@ -95,7 +95,7 @@
95
95
  </div></div>
96
96
 
97
97
  <div id="footer">
98
- Generated on Wed Oct 7 10:48:18 2026 by
98
+ Generated on Wed Nov 25 14:15:18 2026 by
99
99
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
100
100
  0.9.34 (ruby-3.4.9).
101
101
  </div>
@@ -662,7 +662,7 @@
662
662
  </div></div>
663
663
 
664
664
  <div id="footer">
665
- Generated on Wed Oct 7 10:48:19 2026 by
665
+ Generated on Wed Nov 25 14:15:18 2026 by
666
666
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
667
667
  0.9.34 (ruby-3.4.9).
668
668
  </div>
data/doc/file.edit.html CHANGED
@@ -99,7 +99,7 @@
99
99
  </div></div>
100
100
 
101
101
  <div id="footer">
102
- Generated on Wed Oct 7 10:48:18 2026 by
102
+ Generated on Wed Nov 25 14:15:18 2026 by
103
103
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
104
104
  0.9.34 (ruby-3.4.9).
105
105
  </div>
@@ -281,7 +281,7 @@
281
281
  </div></div>
282
282
 
283
283
  <div id="footer">
284
- Generated on Wed Oct 7 10:48:17 2026 by
284
+ Generated on Wed Nov 25 14:15:17 2026 by
285
285
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
286
286
  0.9.34 (ruby-3.4.9).
287
287
  </div>
@@ -247,7 +247,7 @@
247
247
  </div></div>
248
248
 
249
249
  <div id="footer">
250
- Generated on Wed Oct 7 10:48:17 2026 by
250
+ Generated on Wed Nov 25 14:15:17 2026 by
251
251
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
252
252
  0.9.34 (ruby-3.4.9).
253
253
  </div>
@@ -105,7 +105,7 @@
105
105
  </div></div>
106
106
 
107
107
  <div id="footer">
108
- Generated on Wed Oct 7 10:48:18 2026 by
108
+ Generated on Wed Nov 25 14:15:17 2026 by
109
109
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
110
110
  0.9.34 (ruby-3.4.9).
111
111
  </div>
data/doc/file.form.html CHANGED
@@ -197,7 +197,7 @@
197
197
  </div></div>
198
198
 
199
199
  <div id="footer">
200
- Generated on Wed Oct 7 10:48:18 2026 by
200
+ Generated on Wed Nov 25 14:15:18 2026 by
201
201
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
202
202
  0.9.34 (ruby-3.4.9).
203
203
  </div>
@@ -79,7 +79,7 @@
79
79
  </div></div>
80
80
 
81
81
  <div id="footer">
82
- Generated on Wed Oct 7 10:48:18 2026 by
82
+ Generated on Wed Nov 25 14:15:17 2026 by
83
83
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
84
84
  0.9.34 (ruby-3.4.9).
85
85
  </div>
@@ -207,7 +207,7 @@
207
207
  </div></div>
208
208
 
209
209
  <div id="footer">
210
- Generated on Wed Oct 7 10:48:19 2026 by
210
+ Generated on Wed Nov 25 14:15:18 2026 by
211
211
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
212
212
  0.9.34 (ruby-3.4.9).
213
213
  </div>
@@ -212,7 +212,7 @@
212
212
  </div></div>
213
213
 
214
214
  <div id="footer">
215
- Generated on Wed Oct 7 10:48:19 2026 by
215
+ Generated on Wed Nov 25 14:15:18 2026 by
216
216
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
217
217
  0.9.34 (ruby-3.4.9).
218
218
  </div>
data/doc/file.index.html CHANGED
@@ -125,7 +125,7 @@
125
125
  </div></div>
126
126
 
127
127
  <div id="footer">
128
- Generated on Wed Oct 7 10:48:18 2026 by
128
+ Generated on Wed Nov 25 14:15:18 2026 by
129
129
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
130
130
  0.9.34 (ruby-3.4.9).
131
131
  </div>
@@ -126,7 +126,7 @@
126
126
  </div></div>
127
127
 
128
128
  <div id="footer">
129
- Generated on Wed Oct 7 10:48:17 2026 by
129
+ Generated on Wed Nov 25 14:15:17 2026 by
130
130
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
131
131
  0.9.34 (ruby-3.4.9).
132
132
  </div>
@@ -105,7 +105,7 @@
105
105
  </div></div>
106
106
 
107
107
  <div id="footer">
108
- Generated on Wed Oct 7 10:48:17 2026 by
108
+ Generated on Wed Nov 25 14:15:16 2026 by
109
109
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
110
110
  0.9.34 (ruby-3.4.9).
111
111
  </div>
@@ -142,11 +142,41 @@
142
142
  </tr>
143
143
  <tr>
144
144
  <td><code>ransack</code></td>
145
- <td>List filtering, sorting links and the sort select in <a href="/doc/guide/pre_built_components/list_md.html"><code>List</code></a>. Without it, declare no <code>filter</code>/<code>sort</code> and those UIs stay off.</td>
145
+ <td>List filtering, sorting links and the sort select in <a href="/doc/guide/pre_built_components/list_md.html"><code>List</code></a>. Without it, declare no <code>filter</code>/<code>sort</code> and those UIs stay off. Setup: <a href="#ransack">Ransack</a> below.</td>
146
146
  </tr>
147
147
  </tbody>
148
148
  </table>
149
149
 
150
+ <h3 id="ransack">Ransack</h3>
151
+
152
+ <p>To enable filtering and sorting in <a href="/doc/guide/pre_built_components/list_md.html"><code>List</code></a>, add the gem to the host app’s <code>Gemfile</code>; Compony detects it via <code>defined?(Ransack)</code>, no initializer needed:</p>
153
+
154
+ <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_gem'>gem</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>ransack</span><span class='tstring_end'>&#39;</span></span>
155
+ </code></pre>
156
+
157
+ <p>Ransack only searches and sorts by attributes a model explicitly allows. Compony fills in that allowlist for you: <code>Compony::ModelMixin</code> defines</p>
158
+
159
+ <pre class="code ruby"><code class="ruby"><span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_ransackable_attributes'>ransackable_attributes</span><span class='lparen'>(</span><span class='id identifier rubyid_auth_object'>auth_object</span><span class='rparen'>)</span>
160
+ <span class='id identifier rubyid_auth_object'>auth_object</span><span class='period'>.</span><span class='id identifier rubyid_permitted_attributes'>permitted_attributes</span><span class='lparen'>(</span><span class='symbol'>:read</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:to_s</span><span class='rparen'>)</span>
161
+ <span class='kw'>end</span>
162
+ </code></pre>
163
+
164
+ <p>and <code>List</code> passes <code>auth_object: controller.current_ability</code>. So a user can filter and sort only by the attributes CanCanCan lets them <code>:read</code>. A field’s auto-generated filter therefore needs both a <code>field</code> declaration and read permission on it.</p>
165
+
166
+ <p>What you still provide yourself:</p>
167
+ <ul><li>
168
+ <p><strong><code>ransackable_associations</code></strong> when a filter or sort goes through an association, e.g. <code>filter :customer_name_cont</code>. Compony does not define it, so Ransack refuses such searches until the model allows them:</p>
169
+ </li></ul>
170
+
171
+ <p><code>ruby def self.ransackable_associations(_auth_object = nil) %w[customer] end </code></p>
172
+ <ul><li>
173
+ <p><strong><code>ransackable_scopes</code></strong> when a filter calls a model scope.</p>
174
+ </li><li>
175
+ <p><strong>Your own <code>Model.ransack(...)</code> calls outside <code>List</code></strong> must pass <code>auth_object: current_ability</code>. Without it, Compony’s default calls <code>permitted_attributes</code> on <code>nil</code> and raises <code>NoMethodError</code>. Alternatively, override <code>ransackable_attributes</code> in the model, which also replaces the permission-based default for <code>List</code>.</p>
176
+ </li></ul>
177
+
178
+ <p>Default filter per field type (see <code>ransack_filter_name</code> in <code>lib/compony/model_fields/</code>): <code>&lt;field&gt;_cont</code> (text search), <code>&lt;field&gt;_eq</code> for <code>:integer</code>, a select for <code>:boolean</code> and <code>:anchormodel</code>.</p>
179
+
150
180
  <h2 id="app-side-companions-you-add-these">App-side companions (you add these)</h2>
151
181
 
152
182
  <p>Compony is UI- and auth-agnostic; these are conventional choices in real apps, pulled in by your app, not by Compony.</p>
@@ -208,7 +238,7 @@
208
238
  </div></div>
209
239
 
210
240
  <div id="footer">
211
- Generated on Wed Oct 7 10:48:19 2026 by
241
+ Generated on Wed Nov 25 14:15:19 2026 by
212
242
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
213
243
  0.9.34 (ruby-3.4.9).
214
244
  </div>
@@ -194,7 +194,9 @@ end
194
194
  <ul><li>
195
195
  <p><code>label</code> is a String which will be displayed as the text of the link or button.</p>
196
196
  </li><li>
197
- <p><code>href</code> is the url/path that the button points to. If <code>nil</code>, will change to <code>javascript:void(0)</code>.</p>
197
+ <p><code>href</code> is the url/path that the button points to. If <code>nil</code>, an <code>&lt;a&gt;</code> without <code>href</code> is rendered, which does nothing when clicked.</p>
198
+ </li><li>
199
+ <p><code>type</code> renders a <code>&lt;button&gt;</code> of that type instead of a link, e.g. <code>type: :submit</code> for a button submitting the surrounding form.</p>
198
200
  </li><li>
199
201
  <p><code>method</code> takes a HTTP verb will generate a suitable <code>turbo_method</code> data attribute.</p>
200
202
  </li><li>
@@ -205,11 +207,13 @@ end
205
207
 
206
208
  <p>As implicitely mentioned above, Compony buttons are referenced to by a name called a style (<code>:css_button</code> actually points to <code>Compony::Components::Buttons::CssButton</code>). When rendering an intent, the style can be passed as an argument: <code>render_intent(:show, User.first, style: :link)</code> and the intent will automatically instanciate the desired component class.</p>
207
209
 
208
- <p>Note: it is possible to use a button component to submit a form. In order to achieve this, you must implement a hidden submit button (for handling keyboard Enter and Return), as well as pass <code>onclick: &quot;this.closest(&#39;form&#39;).requestSubmit(); return false;&quot;</code> as an argument. See the pre-built Form component’s implementation for an example.</p>
210
+ <p>To use a button component to submit a form, pass <code>type: :submit</code> (e.g. <code>render_intent(name: :submit, label: &#39;Save&#39;, button: { type: :submit })</code>). This renders a real <code>&lt;button type=&quot;submit&quot;&gt;</code>, which also submits the form on Return and needs no JavaScript. See the pre-built Form component’s <code>submit_button</code> content block for an example.</p>
211
+
212
+ <p>Compony’s buttons render no inline JavaScript (<code>onclick</code> attributes, <code>javascript:</code> URLs), so they keep working under a Content Security Policy that only allows scripts carrying a nonce.</p>
209
213
 
210
214
  <h3 id="adding-your-own-styles">Adding your own styles</h3>
211
215
 
212
- <p>In your application, you will likely want to implement your own button styles. Create a component (e.g. <code>Components::Commons::MyButton</code>) and inherit from <code>Compony::Components::Buttons::Link</code>. Override the method <code>prepare_opts!</code> and don’t forget to call <code>super</code> first. Then, go through any <code>@comp_args</code> that might be of interest to you and mutate <code>@comp_args[:style]</code> and/or <code>@comp_args[:class]</code> to suit your needs. Make sure to handle the class <code>disabled</code>, as intents will set them if the intent is not feasible. Note that if a user is lacking authorization to perform an intent, the intent will not even instanciate the button.</p>
216
+ <p>In your application, you will likely want to implement your own button styles. Create a component (e.g. <code>Components::Commons::MyButton</code>) and inherit from <code>Compony::Components::Buttons::Link</code>. Override the method <code>prepare_opts!</code> and don’t forget to call <code>super</code> first. Then, go through any <code>@comp_args</code> that might be of interest to you and mutate <code>@comp_args[:style]</code> and/or <code>@comp_args[:class]</code> to suit your needs. Make sure to handle the class <code>disabled</code>, as intents will set them if the intent is not feasible. If you also override the <code>content</code> block (e.g. to add an icon), render the element through <code>component.link_or_button(inner_html, **opts)</code> rather than calling <code>link_to(@href, ...)</code> yourself: it renders the <code>&lt;button&gt;</code> for <code>type:</code> and the <code>&lt;a&gt;</code> without <code>href</code>, e.g. <code>concat component.link_or_button(capture { span @label }, **@comp_opts)</code>. A button style given <code>type:</code> that does not render through <code>link_or_button</code> raises an error, as it would otherwise render a link that cannot submit the form. Note that if a user is lacking authorization to perform an intent, the intent will not even instanciate the button.</p>
213
217
 
214
218
  <p>Once your button class is ready, register it in <code>config/initializers/compony.rb</code> with: <code>Compony.register_button_style :my_button, &#39;::Components::Commons::MyButton&#39;</code>. You can also change the default button style there using: <code>Compony.default_button_style = :my_button</code>.</p>
215
219
 
@@ -255,7 +259,7 @@ end
255
259
  </div></div>
256
260
 
257
261
  <div id="footer">
258
- Generated on Wed Oct 7 10:48:18 2026 by
262
+ Generated on Wed Nov 25 14:15:17 2026 by
259
263
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
260
264
  0.9.34 (ruby-3.4.9).
261
265
  </div>