compony 0.2.0 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +25 -0
  3. data/Gemfile.lock +3 -3
  4. data/README.md +1397 -33
  5. data/Rakefile +6 -2
  6. data/TODO.md +1 -0
  7. data/VERSION +1 -0
  8. data/app/controllers/compony_controller.rb +3 -1
  9. data/compony.gemspec +7 -7
  10. data/config/locales/fr.yml +33 -0
  11. data/doc/ComponentGenerator.html +231 -0
  12. data/doc/Components.html +105 -0
  13. data/doc/ComponentsGenerator.html +203 -0
  14. data/doc/Compony/Component.html +2098 -0
  15. data/doc/Compony/ComponentMixins/Default/Labelling.html +406 -0
  16. data/doc/Compony/ComponentMixins/Default/Standalone/ResourcefulVerbDsl.html +539 -0
  17. data/doc/Compony/ComponentMixins/Default/Standalone/StandaloneDsl.html +588 -0
  18. data/doc/Compony/ComponentMixins/Default/Standalone/VerbDsl.html +577 -0
  19. data/doc/Compony/ComponentMixins/Default/Standalone.html +692 -0
  20. data/doc/Compony/ComponentMixins/Default.html +126 -0
  21. data/doc/Compony/ComponentMixins/Resourceful.html +1193 -0
  22. data/doc/Compony/ComponentMixins.html +126 -0
  23. data/doc/Compony/Components/Button.html +293 -0
  24. data/doc/Compony/Components/Destroy.html +384 -0
  25. data/doc/Compony/Components/Edit.html +462 -0
  26. data/doc/Compony/Components/Form.html +1112 -0
  27. data/doc/Compony/Components/New.html +462 -0
  28. data/doc/Compony/Components/WithForm.html +528 -0
  29. data/doc/Compony/Components.html +126 -0
  30. data/doc/Compony/ControllerMixin.html +136 -0
  31. data/doc/Compony/Engine.html +133 -0
  32. data/doc/Compony/MethodAccessibleHash.html +453 -0
  33. data/doc/Compony/ModelFields/Anchormodel.html +383 -0
  34. data/doc/Compony/ModelFields/Association.html +613 -0
  35. data/doc/Compony/ModelFields/Attachment.html +305 -0
  36. data/doc/Compony/ModelFields/Base.html +1066 -0
  37. data/doc/Compony/ModelFields/Boolean.html +232 -0
  38. data/doc/Compony/ModelFields/Color.html +299 -0
  39. data/doc/Compony/ModelFields/Currency.html +232 -0
  40. data/doc/Compony/ModelFields/Date.html +232 -0
  41. data/doc/Compony/ModelFields/Datetime.html +232 -0
  42. data/doc/Compony/ModelFields/Decimal.html +154 -0
  43. data/doc/Compony/ModelFields/Email.html +240 -0
  44. data/doc/Compony/ModelFields/Float.html +154 -0
  45. data/doc/Compony/ModelFields/Integer.html +154 -0
  46. data/doc/Compony/ModelFields/Percentage.html +232 -0
  47. data/doc/Compony/ModelFields/Phone.html +301 -0
  48. data/doc/Compony/ModelFields/RichText.html +232 -0
  49. data/doc/Compony/ModelFields/String.html +154 -0
  50. data/doc/Compony/ModelFields/Text.html +154 -0
  51. data/doc/Compony/ModelFields/Time.html +154 -0
  52. data/doc/Compony/ModelFields/Url.html +240 -0
  53. data/doc/Compony/ModelFields.html +126 -0
  54. data/doc/Compony/ModelMixin.html +524 -0
  55. data/doc/Compony/RequestContext.html +791 -0
  56. data/doc/Compony/Version.html +139 -0
  57. data/doc/Compony/ViewHelpers.html +443 -0
  58. data/doc/Compony.html +2156 -0
  59. data/doc/ComponyController.html +124 -0
  60. data/doc/_index.html +569 -0
  61. data/doc/class_list.html +51 -0
  62. data/doc/css/common.css +1 -0
  63. data/doc/css/full_list.css +58 -0
  64. data/doc/css/style.css +497 -0
  65. data/doc/file.README.html +1565 -0
  66. data/doc/file_list.html +56 -0
  67. data/doc/frames.html +17 -0
  68. data/doc/imgs/intro-example-destroy.png +0 -0
  69. data/doc/imgs/intro-example-edit.png +0 -0
  70. data/doc/imgs/intro-example-index.png +0 -0
  71. data/doc/imgs/intro-example-new.png +0 -0
  72. data/doc/imgs/intro-example-show.png +0 -0
  73. data/doc/index.html +1565 -0
  74. data/doc/js/app.js +314 -0
  75. data/doc/js/full_list.js +216 -0
  76. data/doc/js/jquery.js +4 -0
  77. data/doc/method_list.html +1435 -0
  78. data/doc/resourceful_lifecycle.png +0 -0
  79. data/doc/top-level-namespace.html +112 -0
  80. data/lib/compony/component.rb +2 -1
  81. data/lib/compony/component_mixins/default/standalone/resourceful_verb_dsl.rb +1 -1
  82. data/lib/compony/component_mixins/default/standalone/standalone_dsl.rb +14 -3
  83. data/lib/compony/component_mixins/default/standalone/verb_dsl.rb +14 -5
  84. data/lib/compony/component_mixins/default/standalone.rb +10 -3
  85. data/lib/compony/components/form.rb +6 -1
  86. data/lib/compony/components/with_form.rb +14 -1
  87. data/lib/compony/model_fields/anchormodel.rb +0 -22
  88. data/lib/compony/model_mixin.rb +12 -2
  89. data/lib/compony/version.rb +1 -7
  90. data/logo.svg +133 -0
  91. metadata +83 -6
@@ -0,0 +1,406 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Module: Compony::ComponentMixins::Default::Labelling
8
+
9
+ &mdash; Documentation by YARD 0.9.34
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../../../css/style.css" type="text/css" />
14
+
15
+ <link rel="stylesheet" href="../../../css/common.css" type="text/css" />
16
+
17
+ <script type="text/javascript">
18
+ pathId = "Compony::ComponentMixins::Default::Labelling";
19
+ relpath = '../../../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../../../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../../../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../../../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../../../_index.html">Index (L)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../../../Compony.html" title="Compony (module)">Compony</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../../ComponentMixins.html" title="Compony::ComponentMixins (module)">ComponentMixins</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Default.html" title="Compony::ComponentMixins::Default (module)">Default</a></span></span>
41
+ &raquo;
42
+ <span class="title">Labelling</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../../../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Module: Compony::ComponentMixins::Default::Labelling
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+ <dl>
73
+ <dt>Extended by:</dt>
74
+ <dd>ActiveSupport::Concern</dd>
75
+ </dl>
76
+
77
+
78
+
79
+
80
+
81
+
82
+
83
+
84
+ <dl>
85
+ <dt>Defined in:</dt>
86
+ <dd>lib/compony/component_mixins/default/labelling.rb</dd>
87
+ </dl>
88
+
89
+ </div>
90
+
91
+ <h2>Overview</h2><div class="docstring">
92
+ <div class="discussion">
93
+
94
+ <p>api description This module contains all methods for Component that concern labelling and look.</p>
95
+
96
+
97
+ </div>
98
+ </div>
99
+ <div class="tags">
100
+
101
+
102
+ </div>
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+ <h2>
111
+ Instance Method Summary
112
+ <small><a href="#" class="summary_toggle">collapse</a></small>
113
+ </h2>
114
+
115
+ <ul class="summary">
116
+
117
+ <li class="public ">
118
+ <span class="summary_signature">
119
+
120
+ <a href="#color-instance_method" title="#color (instance method)">#<strong>color</strong>(&amp;block) &#x21d2; Object </a>
121
+
122
+
123
+
124
+ </span>
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+ <span class="summary_desc"><div class='inline'>
135
+ <p>DSL method and accessor While this is not used in Compony directly, this is useful if you use a custom button component class that supports colors.</p>
136
+ </div></span>
137
+
138
+ </li>
139
+
140
+
141
+ <li class="public ">
142
+ <span class="summary_signature">
143
+
144
+ <a href="#icon-instance_method" title="#icon (instance method)">#<strong>icon</strong>(&amp;block) &#x21d2; Object </a>
145
+
146
+
147
+
148
+ </span>
149
+
150
+
151
+
152
+
153
+
154
+
155
+
156
+
157
+
158
+ <span class="summary_desc"><div class='inline'>
159
+ <p>DSL method and accessor for an icon.</p>
160
+ </div></span>
161
+
162
+ </li>
163
+
164
+
165
+ <li class="public ">
166
+ <span class="summary_signature">
167
+
168
+ <a href="#label-instance_method" title="#label (instance method)">#<strong>label</strong>(data_or_format = nil, format: :long, &amp;block) &#x21d2; Object </a>
169
+
170
+
171
+
172
+ </span>
173
+
174
+
175
+
176
+
177
+
178
+
179
+
180
+
181
+
182
+ <span class="summary_desc"><div class='inline'>
183
+ <p>DSL method and accessor When assigning via DSL, pass format as first parameter.</p>
184
+ </div></span>
185
+
186
+ </li>
187
+
188
+
189
+ </ul>
190
+
191
+
192
+
193
+
194
+
195
+ <div id="instance_method_details" class="method_details_list">
196
+ <h2>Instance Method Details</h2>
197
+
198
+
199
+ <div class="method_details first">
200
+ <h3 class="signature first" id="color-instance_method">
201
+
202
+ #<strong>color</strong>(&amp;block) &#x21d2; <tt>Object</tt>
203
+
204
+
205
+
206
+
207
+
208
+ </h3><div class="docstring">
209
+ <div class="discussion">
210
+
211
+ <p>DSL method and accessor While this is not used in Compony directly, this is useful if you use a custom button component class that supports colors.</p>
212
+
213
+
214
+ </div>
215
+ </div>
216
+ <div class="tags">
217
+
218
+
219
+ </div><table class="source_code">
220
+ <tr>
221
+ <td>
222
+ <pre class="lines">
223
+
224
+
225
+ 68
226
+ 69
227
+ 70
228
+ 71
229
+ 72
230
+ 73
231
+ 74</pre>
232
+ </td>
233
+ <td>
234
+ <pre class="code"><span class="info file"># File 'lib/compony/component_mixins/default/labelling.rb', line 68</span>
235
+
236
+ <span class='kw'>def</span> <span class='id identifier rubyid_color'>color</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
237
+ <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
238
+ <span class='ivar'>@color_block</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span>
239
+ <span class='kw'>else</span>
240
+ <span class='ivar'>@color_block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span>
241
+ <span class='kw'>end</span>
242
+ <span class='kw'>end</span></pre>
243
+ </td>
244
+ </tr>
245
+ </table>
246
+ </div>
247
+
248
+ <div class="method_details ">
249
+ <h3 class="signature " id="icon-instance_method">
250
+
251
+ #<strong>icon</strong>(&amp;block) &#x21d2; <tt>Object</tt>
252
+
253
+
254
+
255
+
256
+
257
+ </h3><div class="docstring">
258
+ <div class="discussion">
259
+
260
+ <p>DSL method and accessor for an icon. While this is not used in Compony directly, this is useful if your front-end uses an icon library such as fontawesome.</p>
261
+
262
+
263
+ </div>
264
+ </div>
265
+ <div class="tags">
266
+
267
+
268
+ </div><table class="source_code">
269
+ <tr>
270
+ <td>
271
+ <pre class="lines">
272
+
273
+
274
+ 58
275
+ 59
276
+ 60
277
+ 61
278
+ 62
279
+ 63
280
+ 64</pre>
281
+ </td>
282
+ <td>
283
+ <pre class="code"><span class="info file"># File 'lib/compony/component_mixins/default/labelling.rb', line 58</span>
284
+
285
+ <span class='kw'>def</span> <span class='id identifier rubyid_icon'>icon</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
286
+ <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
287
+ <span class='ivar'>@icon_block</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span>
288
+ <span class='kw'>else</span>
289
+ <span class='ivar'>@icon_block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span>
290
+ <span class='kw'>end</span>
291
+ <span class='kw'>end</span></pre>
292
+ </td>
293
+ </tr>
294
+ </table>
295
+ </div>
296
+
297
+ <div class="method_details ">
298
+ <h3 class="signature " id="label-instance_method">
299
+
300
+ #<strong>label</strong>(data_or_format = nil, format: :long, &amp;block) &#x21d2; <tt>Object</tt>
301
+
302
+
303
+
304
+
305
+
306
+ </h3><div class="docstring">
307
+ <div class="discussion">
308
+
309
+ <p>DSL method and accessor When assigning via DSL, pass format as first parameter. When accessing the value, pass format as named parameter (e.g. <code>format: :short</code>). &lt;br/&gt; A component either generates labels without data (e.g. “New user”) or with data (e.g. “Edit John Doe”). This needs to be consistent across all formats. If the block generates labels with data, the label block must take exactly one argument, otherwise none. Label blocks with data are given the data as argument. The block is expected to return the label in the given format. &lt;br/&gt; Examples: - Setting a block with data: <code>label(:short){ |data| &quot;Edit #{data.label}&quot; }</code> - Setting a block without data: <code>label(:short){ &#39;New user&#39; }</code> - Reading a component’s label with data: <code>comp.label(User.first, format: :short)</code> - Reading a component’s label without data: <code>comp.label(format: :short)</code></p>
310
+
311
+
312
+ </div>
313
+ </div>
314
+ <div class="tags">
315
+
316
+
317
+ </div><table class="source_code">
318
+ <tr>
319
+ <td>
320
+ <pre class="lines">
321
+
322
+
323
+ 24
324
+ 25
325
+ 26
326
+ 27
327
+ 28
328
+ 29
329
+ 30
330
+ 31
331
+ 32
332
+ 33
333
+ 34
334
+ 35
335
+ 36
336
+ 37
337
+ 38
338
+ 39
339
+ 40
340
+ 41
341
+ 42
342
+ 43
343
+ 44
344
+ 45
345
+ 46
346
+ 47
347
+ 48
348
+ 49
349
+ 50
350
+ 51
351
+ 52
352
+ 53
353
+ 54</pre>
354
+ </td>
355
+ <td>
356
+ <pre class="code"><span class="info file"># File 'lib/compony/component_mixins/default/labelling.rb', line 24</span>
357
+
358
+ <span class='kw'>def</span> <span class='id identifier rubyid_label'>label</span><span class='lparen'>(</span><span class='id identifier rubyid_data_or_format'>data_or_format</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>format:</span> <span class='symbol'>:long</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
359
+ <span class='id identifier rubyid_format'>format</span> <span class='op'>=</span> <span class='id identifier rubyid_data_or_format'>data_or_format</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
360
+ <span class='id identifier rubyid_format'>format</span> <span class='op'>||=</span> <span class='symbol'>:long</span>
361
+ <span class='id identifier rubyid_format'>format</span> <span class='op'>=</span> <span class='id identifier rubyid_format'>format</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
362
+
363
+ <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
364
+ <span class='comment'># Assignment via DSL
365
+ </span> <span class='kw'>if</span> <span class='id identifier rubyid_format'>format</span> <span class='op'>==</span> <span class='symbol'>:all</span>
366
+ <span class='ivar'>@label_blocks</span><span class='lbracket'>[</span><span class='symbol'>:short</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span>
367
+ <span class='ivar'>@label_blocks</span><span class='lbracket'>[</span><span class='symbol'>:long</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span>
368
+ <span class='kw'>else</span>
369
+ <span class='ivar'>@label_blocks</span><span class='lbracket'>[</span><span class='id identifier rubyid_format'>format</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span>
370
+ <span class='kw'>end</span>
371
+ <span class='kw'>else</span>
372
+ <span class='comment'># Retrieval of the actual label
373
+ </span> <span class='id identifier rubyid_fail'>fail</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Label format :all may only be used for setting a label (with a block), not for retrieving it.</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_format'>format</span> <span class='op'>==</span> <span class='symbol'>:all</span>
374
+ <span class='id identifier rubyid_label_block'>label_block</span> <span class='op'>=</span> <span class='ivar'>@label_blocks</span><span class='lbracket'>[</span><span class='id identifier rubyid_format'>format</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='id identifier rubyid_fail'>fail</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Format </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_format'>format</span><span class='embexpr_end'>}</span><span class='tstring_content'> was not found for </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'>.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
375
+ <span class='kw'>case</span> <span class='id identifier rubyid_label_block'>label_block</span><span class='period'>.</span><span class='id identifier rubyid_arity'>arity</span>
376
+ <span class='kw'>when</span> <span class='int'>0</span>
377
+ <span class='id identifier rubyid_label_block'>label_block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span>
378
+ <span class='kw'>when</span> <span class='int'>1</span>
379
+ <span class='id identifier rubyid_data_or_format'>data_or_format</span> <span class='op'>||=</span> <span class='id identifier rubyid_data'>data</span>
380
+ <span class='kw'>if</span> <span class='id identifier rubyid_data_or_format'>data_or_format</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
381
+ <span class='id identifier rubyid_fail'>fail</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Label block of </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'> takes an argument, but no data was provided and a call to `data` did not return any data either.</span><span class='tstring_end'>&quot;</span></span>
382
+ <span class='kw'>end</span>
383
+ <span class='id identifier rubyid_label_block'>label_block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_data_or_format'>data_or_format</span><span class='rparen'>)</span>
384
+ <span class='kw'>else</span>
385
+ <span class='id identifier rubyid_fail'>fail</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'> has a label block that takes 2 or more arguments, which is unsupported.</span><span class='tstring_end'>&quot;</span></span>
386
+ <span class='kw'>end</span>
387
+ <span class='kw'>end</span>
388
+ <span class='kw'>end</span></pre>
389
+ </td>
390
+ </tr>
391
+ </table>
392
+ </div>
393
+
394
+ </div>
395
+
396
+ </div>
397
+
398
+ <div id="footer">
399
+ Generated on Wed Apr 24 17:14:06 2024 by
400
+ <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
401
+ 0.9.34 (ruby-3.2.2).
402
+ </div>
403
+
404
+ </div>
405
+ </body>
406
+ </html>