compony 0.5.9 → 0.6.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +1 -1
- data/README.md +21 -0
- data/VERSION +1 -1
- data/compony.gemspec +3 -3
- data/config/locales/de.yml +13 -0
- data/config/locales/en.yml +13 -0
- data/config/locales/fr.yml +14 -1
- data/doc/ComponentGenerator.html +16 -4
- data/doc/Components.html +3 -3
- data/doc/ComponentsGenerator.html +3 -3
- data/doc/Compony/Component.html +4 -4
- 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 +3 -3
- 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 +4 -4
- data/doc/Compony/ComponentMixins.html +3 -3
- data/doc/Compony/Components/Button.html +3 -3
- data/doc/Compony/Components/Destroy.html +3 -3
- data/doc/Compony/Components/Edit.html +3 -3
- data/doc/Compony/Components/Form.html +3 -3
- data/doc/Compony/Components/Index.html +172 -0
- data/doc/Compony/Components/List.html +2731 -0
- data/doc/Compony/Components/New.html +3 -3
- data/doc/Compony/Components/Show.html +740 -0
- data/doc/Compony/Components/WithForm.html +3 -3
- data/doc/Compony/Components.html +5 -5
- 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 +136 -4
- data/doc/Compony/ModelFields/Association.html +4 -4
- data/doc/Compony/ModelFields/Attachment.html +4 -4
- data/doc/Compony/ModelFields/Base.html +143 -13
- data/doc/Compony/ModelFields/Boolean.html +136 -4
- data/doc/Compony/ModelFields/Color.html +4 -4
- data/doc/Compony/ModelFields/Currency.html +4 -4
- data/doc/Compony/ModelFields/Date.html +4 -4
- data/doc/Compony/ModelFields/Datetime.html +4 -4
- data/doc/Compony/ModelFields/Decimal.html +4 -4
- data/doc/Compony/ModelFields/Email.html +4 -4
- data/doc/Compony/ModelFields/Float.html +4 -4
- data/doc/Compony/ModelFields/Integer.html +83 -5
- data/doc/Compony/ModelFields/Percentage.html +4 -4
- data/doc/Compony/ModelFields/Phone.html +4 -4
- data/doc/Compony/ModelFields/RichText.html +4 -4
- data/doc/Compony/ModelFields/String.html +4 -4
- data/doc/Compony/ModelFields/Text.html +4 -4
- data/doc/Compony/ModelFields/Time.html +4 -4
- data/doc/Compony/ModelFields/Url.html +4 -4
- data/doc/Compony/ModelFields.html +3 -3
- data/doc/Compony/ModelMixin.html +26 -26
- 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 +3 -3
- data/doc/Compony.html +4 -4
- data/doc/ComponyController.html +3 -3
- data/doc/_index.html +25 -4
- data/doc/class_list.html +3 -6
- data/doc/css/full_list.css +3 -3
- data/doc/css/style.css +0 -6
- data/doc/file.README.html +37 -10
- data/doc/file_list.html +2 -5
- data/doc/frames.html +5 -10
- data/doc/index.html +37 -10
- data/doc/js/app.js +264 -294
- data/doc/js/full_list.js +4 -30
- data/doc/method_list.html +423 -114
- data/doc/top-level-namespace.html +3 -3
- data/lib/compony/components/index.rb +33 -0
- data/lib/compony/components/list.rb +418 -0
- data/lib/compony/components/show.rb +116 -0
- data/lib/compony/model_fields/anchormodel.rb +13 -0
- data/lib/compony/model_fields/base.rb +12 -0
- data/lib/compony/model_fields/boolean.rb +13 -0
- data/lib/compony/model_fields/integer.rb +3 -0
- data/lib/compony/model_mixin.rb +5 -0
- data/lib/compony.rb +3 -0
- data/lib/generators/component/component_generator.rb +6 -0
- data/lib/generators/component/templates/index.rb.erb +2 -0
- data/lib/generators/component/templates/list.rb.erb +7 -0
- data/lib/generators/component/templates/show.rb.erb +2 -0
- metadata +10 -1
@@ -0,0 +1,740 @@
|
|
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
|
+
Class: Compony::Components::Show
|
8
|
+
|
9
|
+
— 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::Components::Show";
|
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 (S)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../../Compony.html" title="Compony (module)">Compony</a></span></span> » <span class='title'><span class='object_link'><a href="../Components.html" title="Compony::Components (module)">Components</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">Show</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>Class: Compony::Components::Show
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
72
|
+
<span class="inheritName"><span class='object_link'><a href="../Component.html" title="Compony::Component (class)">Compony::Component</a></span></span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li>Object</li>
|
76
|
+
|
77
|
+
<li class="next"><span class='object_link'><a href="../Component.html" title="Compony::Component (class)">Compony::Component</a></span></li>
|
78
|
+
|
79
|
+
<li class="next">Compony::Components::Show</li>
|
80
|
+
|
81
|
+
</ul>
|
82
|
+
<a href="#" class="inheritanceTree">show all</a>
|
83
|
+
|
84
|
+
</dd>
|
85
|
+
</dl>
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
<dl>
|
93
|
+
<dt>Includes:</dt>
|
94
|
+
<dd><span class='object_link'><a href="../ComponentMixins/Resourceful.html" title="Compony::ComponentMixins::Resourceful (module)">Compony::ComponentMixins::Resourceful</a></span></dd>
|
95
|
+
</dl>
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
<dl>
|
103
|
+
<dt>Defined in:</dt>
|
104
|
+
<dd>lib/compony/components/show.rb</dd>
|
105
|
+
</dl>
|
106
|
+
|
107
|
+
</div>
|
108
|
+
|
109
|
+
<h2>Overview</h2><div class="docstring">
|
110
|
+
<div class="discussion">
|
111
|
+
|
112
|
+
<p>This component is used for the Rails show paradigm.</p>
|
113
|
+
|
114
|
+
|
115
|
+
</div>
|
116
|
+
</div>
|
117
|
+
<div class="tags">
|
118
|
+
|
119
|
+
|
120
|
+
</div>
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
<h2>Instance Attribute Summary</h2>
|
127
|
+
|
128
|
+
<h3 class="inherited">Attributes included from <span class='object_link'><a href="../ComponentMixins/Resourceful.html" title="Compony::ComponentMixins::Resourceful (module)">Compony::ComponentMixins::Resourceful</a></span></h3>
|
129
|
+
<p class="inherited"><span class='object_link'><a href="../ComponentMixins/Resourceful.html#data-instance_method" title="Compony::ComponentMixins::Resourceful#data (method)">#data</a></span>, <span class='object_link'><a href="../ComponentMixins/Resourceful.html#global_after_assign_attributes_block-instance_method" title="Compony::ComponentMixins::Resourceful#global_after_assign_attributes_block (method)">#global_after_assign_attributes_block</a></span>, <span class='object_link'><a href="../ComponentMixins/Resourceful.html#global_after_load_data_block-instance_method" title="Compony::ComponentMixins::Resourceful#global_after_load_data_block (method)">#global_after_load_data_block</a></span>, <span class='object_link'><a href="../ComponentMixins/Resourceful.html#global_assign_attributes_block-instance_method" title="Compony::ComponentMixins::Resourceful#global_assign_attributes_block (method)">#global_assign_attributes_block</a></span>, <span class='object_link'><a href="../ComponentMixins/Resourceful.html#global_load_data_block-instance_method" title="Compony::ComponentMixins::Resourceful#global_load_data_block (method)">#global_load_data_block</a></span>, <span class='object_link'><a href="../ComponentMixins/Resourceful.html#global_store_data_block-instance_method" title="Compony::ComponentMixins::Resourceful#global_store_data_block (method)">#global_store_data_block</a></span></p>
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
<h3 class="inherited">Attributes inherited from <span class='object_link'><a href="../Component.html" title="Compony::Component (class)">Compony::Component</a></span></h3>
|
134
|
+
<p class="inherited"><span class='object_link'><a href="../Component.html#comp_opts-instance_method" title="Compony::Component#comp_opts (method)">#comp_opts</a></span>, <span class='object_link'><a href="../Component.html#content_blocks-instance_method" title="Compony::Component#content_blocks (method)">#content_blocks</a></span>, <span class='object_link'><a href="../Component.html#parent_comp-instance_method" title="Compony::Component#parent_comp (method)">#parent_comp</a></span></p>
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
<h2>
|
139
|
+
Instance Method Summary
|
140
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
141
|
+
</h2>
|
142
|
+
|
143
|
+
<ul class="summary">
|
144
|
+
|
145
|
+
<li class="public ">
|
146
|
+
<span class="summary_signature">
|
147
|
+
|
148
|
+
<a href="#all_field_columns-instance_method" title="#all_field_columns (instance method)">#<strong>all_field_columns</strong>(data) ⇒ Object </a>
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
</span>
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
<span class="summary_desc"><div class='inline'>
|
163
|
+
<p>DSL method Goes through the fields of the given data and adds a field column for every field found.</p>
|
164
|
+
</div></span>
|
165
|
+
|
166
|
+
</li>
|
167
|
+
|
168
|
+
|
169
|
+
<li class="public ">
|
170
|
+
<span class="summary_signature">
|
171
|
+
|
172
|
+
<a href="#column-instance_method" title="#column (instance method)">#<strong>column</strong>(name, label: nil, class: nil, link_opts: {}, link_to_component: :show, &block) ⇒ Object </a>
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
</span>
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
<span class="summary_desc"><div class='inline'>
|
187
|
+
<p>Adds a column.</p>
|
188
|
+
</div></span>
|
189
|
+
|
190
|
+
</li>
|
191
|
+
|
192
|
+
|
193
|
+
<li class="public ">
|
194
|
+
<span class="summary_signature">
|
195
|
+
|
196
|
+
<a href="#columns-instance_method" title="#columns (instance method)">#<strong>columns</strong>(*col_names) ⇒ Object </a>
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
</span>
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
<span class="summary_desc"><div class='inline'>
|
211
|
+
<p>DSL method Adds multiple columns that have identical kwargs, e.g.</p>
|
212
|
+
</div></span>
|
213
|
+
|
214
|
+
</li>
|
215
|
+
|
216
|
+
|
217
|
+
<li class="public ">
|
218
|
+
<span class="summary_signature">
|
219
|
+
|
220
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(skip_columns: []) ⇒ Show </a>
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
</span>
|
225
|
+
|
226
|
+
|
227
|
+
<span class="note title constructor">constructor</span>
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
<span class="summary_desc"><div class='inline'>
|
237
|
+
<p>A new instance of Show.</p>
|
238
|
+
</div></span>
|
239
|
+
|
240
|
+
</li>
|
241
|
+
|
242
|
+
|
243
|
+
<li class="public ">
|
244
|
+
<span class="summary_signature">
|
245
|
+
|
246
|
+
<a href="#skip_column-instance_method" title="#skip_column (instance method)">#<strong>skip_column</strong>(name) ⇒ Object </a>
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
</span>
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
<span class="summary_desc"><div class='inline'>
|
261
|
+
<p>DSL method Marks a column as skipped.</p>
|
262
|
+
</div></span>
|
263
|
+
|
264
|
+
</li>
|
265
|
+
|
266
|
+
|
267
|
+
</ul>
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="../ComponentMixins/Resourceful.html" title="Compony::ComponentMixins::Resourceful (module)">Compony::ComponentMixins::Resourceful</a></span></h3>
|
280
|
+
<p class="inherited"><span class='object_link'><a href="../ComponentMixins/Resourceful.html#after_assign_attributes-instance_method" title="Compony::ComponentMixins::Resourceful#after_assign_attributes (method)">#after_assign_attributes</a></span>, <span class='object_link'><a href="../ComponentMixins/Resourceful.html#after_load_data-instance_method" title="Compony::ComponentMixins::Resourceful#after_load_data (method)">#after_load_data</a></span>, <span class='object_link'><a href="../ComponentMixins/Resourceful.html#assign_attributes-instance_method" title="Compony::ComponentMixins::Resourceful#assign_attributes (method)">#assign_attributes</a></span>, <span class='object_link'><a href="../ComponentMixins/Resourceful.html#data_class-instance_method" title="Compony::ComponentMixins::Resourceful#data_class (method)">#data_class</a></span>, <span class='object_link'><a href="../ComponentMixins/Resourceful.html#load_data-instance_method" title="Compony::ComponentMixins::Resourceful#load_data (method)">#load_data</a></span>, <span class='object_link'><a href="../ComponentMixins/Resourceful.html#resourceful%3F-instance_method" title="Compony::ComponentMixins::Resourceful#resourceful? (method)">#resourceful?</a></span>, <span class='object_link'><a href="../ComponentMixins/Resourceful.html#resourceful_sub_comp-instance_method" title="Compony::ComponentMixins::Resourceful#resourceful_sub_comp (method)">#resourceful_sub_comp</a></span>, <span class='object_link'><a href="../ComponentMixins/Resourceful.html#store_data-instance_method" title="Compony::ComponentMixins::Resourceful#store_data (method)">#store_data</a></span></p>
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="../Component.html" title="Compony::Component (class)">Compony::Component</a></span></h3>
|
292
|
+
<p class="inherited"><span class='object_link'><a href="../Component.html#action-instance_method" title="Compony::Component#action (method)">#action</a></span>, <span class='object_link'><a href="../Component.html#before_render-instance_method" title="Compony::Component#before_render (method)">#before_render</a></span>, <span class='object_link'><a href="../Component.html#comp_cst-class_method" title="Compony::Component.comp_cst (method)">comp_cst</a></span>, <span class='object_link'><a href="../Component.html#comp_name-class_method" title="Compony::Component.comp_name (method)">comp_name</a></span>, <span class='object_link'><a href="../Component.html#content-instance_method" title="Compony::Component#content (method)">#content</a></span>, <span class='object_link'><a href="../Component.html#family_cst-class_method" title="Compony::Component.family_cst (method)">family_cst</a></span>, <span class='object_link'><a href="../Component.html#family_name-class_method" title="Compony::Component.family_name (method)">family_name</a></span>, <span class='object_link'><a href="../Component.html#id-instance_method" title="Compony::Component#id (method)">#id</a></span>, <span class='object_link'><a href="../Component.html#inspect-instance_method" title="Compony::Component#inspect (method)">#inspect</a></span>, <span class='object_link'><a href="../Component.html#param_name-instance_method" title="Compony::Component#param_name (method)">#param_name</a></span>, <span class='object_link'><a href="../Component.html#path-instance_method" title="Compony::Component#path (method)">#path</a></span>, <span class='object_link'><a href="../Component.html#path_hash-instance_method" title="Compony::Component#path_hash (method)">#path_hash</a></span>, <span class='object_link'><a href="../Component.html#remove_content-instance_method" title="Compony::Component#remove_content (method)">#remove_content</a></span>, <span class='object_link'><a href="../Component.html#remove_content!-instance_method" title="Compony::Component#remove_content! (method)">#remove_content!</a></span>, <span class='object_link'><a href="../Component.html#render-instance_method" title="Compony::Component#render (method)">#render</a></span>, <span class='object_link'><a href="../Component.html#render_actions-instance_method" title="Compony::Component#render_actions (method)">#render_actions</a></span>, <span class='object_link'><a href="../Component.html#resourceful%3F-instance_method" title="Compony::Component#resourceful? (method)">#resourceful?</a></span>, <span class='object_link'><a href="../Component.html#root_comp-instance_method" title="Compony::Component#root_comp (method)">#root_comp</a></span>, <span class='object_link'><a href="../Component.html#root_comp%3F-instance_method" title="Compony::Component#root_comp? (method)">#root_comp?</a></span>, <span class='object_link'><a href="../Component.html#setup-class_method" title="Compony::Component.setup (method)">setup</a></span>, <span class='object_link'><a href="../Component.html#skip_action-instance_method" title="Compony::Component#skip_action (method)">#skip_action</a></span>, <span class='object_link'><a href="../Component.html#sub_comp-instance_method" title="Compony::Component#sub_comp (method)">#sub_comp</a></span></p>
|
293
|
+
<div id="constructor_details" class="method_details_list">
|
294
|
+
<h2>Constructor Details</h2>
|
295
|
+
|
296
|
+
<div class="method_details first">
|
297
|
+
<h3 class="signature first" id="initialize-instance_method">
|
298
|
+
|
299
|
+
#<strong>initialize</strong>(skip_columns: []) ⇒ <tt><span class='object_link'><a href="" title="Compony::Components::Show (class)">Show</a></span></tt>
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
</h3><div class="docstring">
|
306
|
+
<div class="discussion">
|
307
|
+
|
308
|
+
<p>Returns a new instance of Show.</p>
|
309
|
+
|
310
|
+
|
311
|
+
</div>
|
312
|
+
</div>
|
313
|
+
<div class="tags">
|
314
|
+
<p class="tag_title">Parameters:</p>
|
315
|
+
<ul class="param">
|
316
|
+
|
317
|
+
<li>
|
318
|
+
|
319
|
+
<span class='name'>skip_columns</span>
|
320
|
+
|
321
|
+
|
322
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
323
|
+
|
324
|
+
|
325
|
+
<em class="default">(defaults to: <tt>[]</tt>)</em>
|
326
|
+
|
327
|
+
|
328
|
+
—
|
329
|
+
<div class='inline'>
|
330
|
+
<p>Column names to be skipped in the case where this component is nested and therefore instanciated by a parent comp.</p>
|
331
|
+
</div>
|
332
|
+
|
333
|
+
</li>
|
334
|
+
|
335
|
+
</ul>
|
336
|
+
|
337
|
+
|
338
|
+
</div><table class="source_code">
|
339
|
+
<tr>
|
340
|
+
<td>
|
341
|
+
<pre class="lines">
|
342
|
+
|
343
|
+
|
344
|
+
63
|
345
|
+
64
|
346
|
+
65
|
347
|
+
66
|
348
|
+
67</pre>
|
349
|
+
</td>
|
350
|
+
<td>
|
351
|
+
<pre class="code"><span class="info file"># File 'lib/compony/components/show.rb', line 63</span>
|
352
|
+
|
353
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='op'>*</span><span class='comma'>,</span> <span class='label'>skip_columns:</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='op'>**</span><span class='rparen'>)</span>
|
354
|
+
<span class='ivar'>@columns</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../NaturalOrdering.html" title="Compony::NaturalOrdering (class)">NaturalOrdering</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
355
|
+
<span class='ivar'>@skipped_columns</span> <span class='op'>=</span> <span class='id identifier rubyid_skip_columns'>skip_columns</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:to_sym</span><span class='rparen'>)</span>
|
356
|
+
<span class='kw'>super</span><span class='lparen'>(</span><span class='op'>*</span><span class='comma'>,</span> <span class='op'>**</span><span class='rparen'>)</span>
|
357
|
+
<span class='kw'>end</span></pre>
|
358
|
+
</td>
|
359
|
+
</tr>
|
360
|
+
</table>
|
361
|
+
</div>
|
362
|
+
|
363
|
+
</div>
|
364
|
+
|
365
|
+
|
366
|
+
<div id="instance_method_details" class="method_details_list">
|
367
|
+
<h2>Instance Method Details</h2>
|
368
|
+
|
369
|
+
|
370
|
+
<div class="method_details first">
|
371
|
+
<h3 class="signature first" id="all_field_columns-instance_method">
|
372
|
+
|
373
|
+
#<strong>all_field_columns</strong>(data) ⇒ <tt>Object</tt>
|
374
|
+
|
375
|
+
|
376
|
+
|
377
|
+
|
378
|
+
|
379
|
+
</h3><div class="docstring">
|
380
|
+
<div class="discussion">
|
381
|
+
|
382
|
+
<p>DSL method Goes through the fields of the given data and adds a field column for every field found.</p>
|
383
|
+
|
384
|
+
|
385
|
+
</div>
|
386
|
+
</div>
|
387
|
+
<div class="tags">
|
388
|
+
<p class="tag_title">Parameters:</p>
|
389
|
+
<ul class="param">
|
390
|
+
|
391
|
+
<li>
|
392
|
+
|
393
|
+
<span class='name'>data</span>
|
394
|
+
|
395
|
+
|
396
|
+
<span class='type'>(<tt>ApplicationModel</tt>)</span>
|
397
|
+
|
398
|
+
|
399
|
+
|
400
|
+
—
|
401
|
+
<div class='inline'>
|
402
|
+
<p>Compony-enriched model that will be queried for fields.</p>
|
403
|
+
</div>
|
404
|
+
|
405
|
+
</li>
|
406
|
+
|
407
|
+
</ul>
|
408
|
+
|
409
|
+
|
410
|
+
</div><table class="source_code">
|
411
|
+
<tr>
|
412
|
+
<td>
|
413
|
+
<pre class="lines">
|
414
|
+
|
415
|
+
|
416
|
+
111
|
417
|
+
112
|
418
|
+
113</pre>
|
419
|
+
</td>
|
420
|
+
<td>
|
421
|
+
<pre class="code"><span class="info file"># File 'lib/compony/components/show.rb', line 111</span>
|
422
|
+
|
423
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_all_field_columns'>all_field_columns</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
|
424
|
+
<span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_fields'>fields</span><span class='period'>.</span><span class='id identifier rubyid_each_key'>each_key</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_field_name'>field_name</span><span class='op'>|</span> <span class='id identifier rubyid_column'>column</span><span class='lparen'>(</span><span class='id identifier rubyid_field_name'>field_name</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
425
|
+
<span class='kw'>end</span></pre>
|
426
|
+
</td>
|
427
|
+
</tr>
|
428
|
+
</table>
|
429
|
+
</div>
|
430
|
+
|
431
|
+
<div class="method_details ">
|
432
|
+
<h3 class="signature " id="column-instance_method">
|
433
|
+
|
434
|
+
#<strong>column</strong>(name, label: nil, class: nil, link_opts: {}, link_to_component: :show, &block) ⇒ <tt>Object</tt>
|
435
|
+
|
436
|
+
|
437
|
+
|
438
|
+
|
439
|
+
|
440
|
+
</h3><div class="docstring">
|
441
|
+
<div class="discussion">
|
442
|
+
|
443
|
+
<p>Adds a column. The term column is for consistency with the List component and columns are typically model fields / attributes.</p>
|
444
|
+
|
445
|
+
|
446
|
+
</div>
|
447
|
+
</div>
|
448
|
+
<div class="tags">
|
449
|
+
<p class="tag_title">Parameters:</p>
|
450
|
+
<ul class="param">
|
451
|
+
|
452
|
+
<li>
|
453
|
+
|
454
|
+
<span class='name'>name</span>
|
455
|
+
|
456
|
+
|
457
|
+
<span class='type'>(<tt>String</tt>, <tt>Symbol</tt>)</span>
|
458
|
+
|
459
|
+
|
460
|
+
|
461
|
+
—
|
462
|
+
<div class='inline'>
|
463
|
+
<p>The technical name of the attribute this column will be for.</p>
|
464
|
+
</div>
|
465
|
+
|
466
|
+
</li>
|
467
|
+
|
468
|
+
<li>
|
469
|
+
|
470
|
+
<span class='name'>label</span>
|
471
|
+
|
472
|
+
|
473
|
+
<span class='type'>(<tt>nil</tt>, <tt>String</tt>)</span>
|
474
|
+
|
475
|
+
|
476
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
477
|
+
|
478
|
+
|
479
|
+
—
|
480
|
+
<div class='inline'>
|
481
|
+
<p>The human displayed label for this attribte. If nil, will consider <code>name</code> to be a field name and load the field’s label.</p>
|
482
|
+
</div>
|
483
|
+
|
484
|
+
</li>
|
485
|
+
|
486
|
+
<li>
|
487
|
+
|
488
|
+
<span class='name'>class</span>
|
489
|
+
|
490
|
+
|
491
|
+
<span class='type'>(<tt>nil</tt>, <tt>String</tt>)</span>
|
492
|
+
|
493
|
+
|
494
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
495
|
+
|
496
|
+
|
497
|
+
—
|
498
|
+
<div class='inline'>
|
499
|
+
<p>Extra CSS classes for the column’s value.</p>
|
500
|
+
</div>
|
501
|
+
|
502
|
+
</li>
|
503
|
+
|
504
|
+
<li>
|
505
|
+
|
506
|
+
<span class='name'>link_opts</span>
|
507
|
+
|
508
|
+
|
509
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
510
|
+
|
511
|
+
|
512
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
513
|
+
|
514
|
+
|
515
|
+
—
|
516
|
+
<div class='inline'>
|
517
|
+
<p>Options to pass to the <code>link_to</code> helper. Only used in the case of a field column that will produce a link (e.g. accociation).</p>
|
518
|
+
</div>
|
519
|
+
|
520
|
+
</li>
|
521
|
+
|
522
|
+
<li>
|
523
|
+
|
524
|
+
<span class='name'>link_to_component</span>
|
525
|
+
|
526
|
+
|
527
|
+
<span class='type'>(<tt>Symbol</tt>)</span>
|
528
|
+
|
529
|
+
|
530
|
+
<em class="default">(defaults to: <tt>:show</tt>)</em>
|
531
|
+
|
532
|
+
|
533
|
+
—
|
534
|
+
<div class='inline'>
|
535
|
+
<p>In the case a link is produced (e.g. association), defines the component the link points to. Detaults to <code>:show</code>.</p>
|
536
|
+
</div>
|
537
|
+
|
538
|
+
</li>
|
539
|
+
|
540
|
+
<li>
|
541
|
+
|
542
|
+
<span class='name'>block</span>
|
543
|
+
|
544
|
+
|
545
|
+
<span class='type'>(<tt>Block</tt>)</span>
|
546
|
+
|
547
|
+
|
548
|
+
|
549
|
+
—
|
550
|
+
<div class='inline'>
|
551
|
+
<p>Custom code to run in order to provide the displayed value. Will be given the current record.</p>
|
552
|
+
</div>
|
553
|
+
|
554
|
+
</li>
|
555
|
+
|
556
|
+
</ul>
|
557
|
+
|
558
|
+
|
559
|
+
</div><table class="source_code">
|
560
|
+
<tr>
|
561
|
+
<td>
|
562
|
+
<pre class="lines">
|
563
|
+
|
564
|
+
|
565
|
+
76
|
566
|
+
77
|
567
|
+
78
|
568
|
+
79
|
569
|
+
80
|
570
|
+
81
|
571
|
+
82
|
572
|
+
83
|
573
|
+
84
|
574
|
+
85
|
575
|
+
86
|
576
|
+
87
|
577
|
+
88
|
578
|
+
89
|
579
|
+
90
|
580
|
+
91</pre>
|
581
|
+
</td>
|
582
|
+
<td>
|
583
|
+
<pre class="code"><span class="info file"># File 'lib/compony/components/show.rb', line 76</span>
|
584
|
+
|
585
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_column'>column</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='label'>label:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>class:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>link_opts:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='label'>link_to_component:</span> <span class='symbol'>:show</span><span class='comma'>,</span> <span class='op'>**</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
586
|
+
<span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
|
587
|
+
<span class='kw'>unless</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
|
588
|
+
<span class='comment'># Assume field column
|
589
|
+
</span> <span class='id identifier rubyid_field'>field</span> <span class='op'>=</span> <span class='id identifier rubyid_data_class'>data_class</span><span class='period'>.</span><span class='id identifier rubyid_fields'>fields</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</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'>"</span><span class='tstring_content'>Field </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'> was not found for data class </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_data_class'>data_class</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
590
|
+
<span class='id identifier rubyid_block'>block</span> <span class='op'>=</span> <span class='id identifier rubyid_proc'>proc</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_record'>record</span><span class='op'>|</span>
|
591
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_controller'>controller</span><span class='period'>.</span><span class='id identifier rubyid_current_ability'>current_ability</span><span class='period'>.</span><span class='id identifier rubyid_permitted_attributes'>permitted_attributes</span><span class='lparen'>(</span><span class='symbol'>:show</span><span class='comma'>,</span> <span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_field'>field</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rparen'>)</span>
|
592
|
+
<span class='kw'>next</span> <span class='id identifier rubyid_field'>field</span><span class='period'>.</span><span class='id identifier rubyid_value_for'>value_for</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='comma'>,</span> <span class='label'>link_to_component:</span><span class='comma'>,</span> <span class='label'>controller:</span><span class='comma'>,</span> <span class='label'>link_opts:</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
|
593
|
+
<span class='kw'>else</span>
|
594
|
+
<span class='const'>Rails</span><span class='period'>.</span><span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span> <span class='lbrace'>{</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Skipping show col </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_field'>field</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'> because the current user is not allowed to perform show on </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_data'>data</span><span class='embexpr_end'>}</span><span class='tstring_content'>.</span><span class='tstring_end'>"</span></span> <span class='rbrace'>}</span>
|
595
|
+
<span class='kw'>nil</span>
|
596
|
+
<span class='kw'>end</span>
|
597
|
+
<span class='kw'>end</span>
|
598
|
+
<span class='kw'>end</span>
|
599
|
+
<span class='ivar'>@columns</span><span class='period'>.</span><span class='id identifier rubyid_natural_push'>natural_push</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_block'>block</span><span class='comma'>,</span> <span class='label'>label:</span> <span class='id identifier rubyid_label'>label</span> <span class='op'>||</span> <span class='id identifier rubyid_field'>field</span><span class='period'>.</span><span class='id identifier rubyid_label'>label</span><span class='comma'>,</span> <span class='label'>class:</span><span class='comma'>,</span> <span class='op'>**</span><span class='rparen'>)</span>
|
600
|
+
<span class='kw'>end</span></pre>
|
601
|
+
</td>
|
602
|
+
</tr>
|
603
|
+
</table>
|
604
|
+
</div>
|
605
|
+
|
606
|
+
<div class="method_details ">
|
607
|
+
<h3 class="signature " id="columns-instance_method">
|
608
|
+
|
609
|
+
#<strong>columns</strong>(*col_names) ⇒ <tt>Object</tt>
|
610
|
+
|
611
|
+
|
612
|
+
|
613
|
+
|
614
|
+
|
615
|
+
</h3><div class="docstring">
|
616
|
+
<div class="discussion">
|
617
|
+
|
618
|
+
<p>DSL method Adds multiple columns that have identical kwargs, e.g. <code>class</code> (see <code>column</code>). Typically only used for bulk-adding model fields.</p>
|
619
|
+
|
620
|
+
|
621
|
+
</div>
|
622
|
+
</div>
|
623
|
+
<div class="tags">
|
624
|
+
<p class="tag_title">Parameters:</p>
|
625
|
+
<ul class="param">
|
626
|
+
|
627
|
+
<li>
|
628
|
+
|
629
|
+
<span class='name'>col_names</span>
|
630
|
+
|
631
|
+
|
632
|
+
<span class='type'>(<tt>String</tt>)</span>
|
633
|
+
|
634
|
+
|
635
|
+
|
636
|
+
—
|
637
|
+
<div class='inline'>
|
638
|
+
<p>Names of the fields in <code>@data</code> that are to be added as attributes.</p>
|
639
|
+
</div>
|
640
|
+
|
641
|
+
</li>
|
642
|
+
|
643
|
+
</ul>
|
644
|
+
|
645
|
+
|
646
|
+
</div><table class="source_code">
|
647
|
+
<tr>
|
648
|
+
<td>
|
649
|
+
<pre class="lines">
|
650
|
+
|
651
|
+
|
652
|
+
96
|
653
|
+
97
|
654
|
+
98</pre>
|
655
|
+
</td>
|
656
|
+
<td>
|
657
|
+
<pre class="code"><span class="info file"># File 'lib/compony/components/show.rb', line 96</span>
|
658
|
+
|
659
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_columns'>columns</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_col_names'>col_names</span><span class='comma'>,</span> <span class='op'>**</span><span class='rparen'>)</span>
|
660
|
+
<span class='id identifier rubyid_col_names'>col_names</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_col_name'>col_name</span><span class='op'>|</span> <span class='id identifier rubyid_column'>column</span><span class='lparen'>(</span><span class='id identifier rubyid_col_name'>col_name</span><span class='comma'>,</span> <span class='op'>**</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
661
|
+
<span class='kw'>end</span></pre>
|
662
|
+
</td>
|
663
|
+
</tr>
|
664
|
+
</table>
|
665
|
+
</div>
|
666
|
+
|
667
|
+
<div class="method_details ">
|
668
|
+
<h3 class="signature " id="skip_column-instance_method">
|
669
|
+
|
670
|
+
#<strong>skip_column</strong>(name) ⇒ <tt>Object</tt>
|
671
|
+
|
672
|
+
|
673
|
+
|
674
|
+
|
675
|
+
|
676
|
+
</h3><div class="docstring">
|
677
|
+
<div class="discussion">
|
678
|
+
|
679
|
+
<p>DSL method Marks a column as skipped. Useful only when inheriting from a component that provides too many columns. When nesting components and a column of a child <code>Show</code> component is to be skipped, use the constructor’s <code>skip_columns</code> argument instead.</p>
|
680
|
+
|
681
|
+
|
682
|
+
</div>
|
683
|
+
</div>
|
684
|
+
<div class="tags">
|
685
|
+
<p class="tag_title">Parameters:</p>
|
686
|
+
<ul class="param">
|
687
|
+
|
688
|
+
<li>
|
689
|
+
|
690
|
+
<span class='name'>name</span>
|
691
|
+
|
692
|
+
|
693
|
+
<span class='type'>(<tt>String</tt>)</span>
|
694
|
+
|
695
|
+
|
696
|
+
|
697
|
+
—
|
698
|
+
<div class='inline'>
|
699
|
+
<p>Name of the column to be skipped.</p>
|
700
|
+
</div>
|
701
|
+
|
702
|
+
</li>
|
703
|
+
|
704
|
+
</ul>
|
705
|
+
|
706
|
+
|
707
|
+
</div><table class="source_code">
|
708
|
+
<tr>
|
709
|
+
<td>
|
710
|
+
<pre class="lines">
|
711
|
+
|
712
|
+
|
713
|
+
104
|
714
|
+
105
|
715
|
+
106</pre>
|
716
|
+
</td>
|
717
|
+
<td>
|
718
|
+
<pre class="code"><span class="info file"># File 'lib/compony/components/show.rb', line 104</span>
|
719
|
+
|
720
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_skip_column'>skip_column</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
|
721
|
+
<span class='ivar'>@skipped_columns</span> <span class='op'><<</span> <span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
|
722
|
+
<span class='kw'>end</span></pre>
|
723
|
+
</td>
|
724
|
+
</tr>
|
725
|
+
</table>
|
726
|
+
</div>
|
727
|
+
|
728
|
+
</div>
|
729
|
+
|
730
|
+
</div>
|
731
|
+
|
732
|
+
<div id="footer">
|
733
|
+
Generated on Fri Sep 5 14:00:25 2025 by
|
734
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
735
|
+
0.9.34 (ruby-3.3.5).
|
736
|
+
</div>
|
737
|
+
|
738
|
+
</div>
|
739
|
+
</body>
|
740
|
+
</html>
|