view_models 2.0.1 → 3.0.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.
- data/.bundle/config +2 -0
- data/.gitignore +8 -0
- data/.rspec +2 -0
- data/.rvmrc +1 -0
- data/.travis.yml +19 -0
- data/.yardoc/checksums +13 -0
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/Appraisals +15 -0
- data/CHANGELOG +31 -0
- data/Gemfile +13 -0
- data/Gemfile.lock +174 -0
- data/MIT-LICENSE +20 -0
- data/README.textile +199 -0
- data/Rakefile +24 -0
- data/doc/ModulesInRenderHierarchy.html +186 -0
- data/doc/ModulesInRenderHierarchy/ClassMethods.html +188 -0
- data/doc/ViewModels.html +202 -0
- data/doc/ViewModels/Base.html +1342 -0
- data/doc/ViewModels/ContextExtractor.html +406 -0
- data/doc/ViewModels/Extensions.html +128 -0
- data/doc/ViewModels/Extensions/ModelReader.html +255 -0
- data/doc/ViewModels/Extensions/ModelReader/FilteredDelegationInstaller.html +908 -0
- data/doc/ViewModels/Extensions/ModelReader/Options.html +551 -0
- data/doc/ViewModels/Extensions/View.html +303 -0
- data/doc/ViewModels/Helpers.html +129 -0
- data/doc/ViewModels/Helpers/Mapping.html +562 -0
- data/doc/ViewModels/Helpers/Mapping/Collection.html +844 -0
- data/doc/ViewModels/Helpers/View.html +287 -0
- data/doc/ViewModels/PathStore.html +745 -0
- data/doc/ViewModels/RenderOptions.html +126 -0
- data/doc/ViewModels/RenderOptions/Base.html +1187 -0
- data/doc/ViewModels/RenderOptions/Partial.html +231 -0
- data/doc/ViewModels/RenderOptions/Template.html +231 -0
- data/doc/ViewModels/View.html +414 -0
- data/doc/ViewModelsGenerator.html +410 -0
- data/doc/_index.html +317 -0
- data/doc/class_list.html +53 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +328 -0
- data/doc/file.README.html +113 -0
- data/doc/file_list.html +55 -0
- data/doc/frames.html +28 -0
- data/doc/index.html +113 -0
- data/doc/js/app.js +214 -0
- data/doc/js/full_list.js +173 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +628 -0
- data/doc/top-level-namespace.html +114 -0
- data/feature_support/testapp/app/controllers/heroes_controller.rb +6 -0
- data/feature_support/testapp/app/controllers/users_controller.rb +6 -0
- data/feature_support/testapp/app/helpers/application_helper.rb +8 -0
- data/feature_support/testapp/app/models/hero.rb +8 -0
- data/feature_support/testapp/app/models/user.rb +3 -0
- data/feature_support/testapp/app/view_models/hero.rb +8 -0
- data/feature_support/testapp/app/view_models/test.rb +8 -0
- data/feature_support/testapp/app/view_models/user.rb +14 -0
- data/feature_support/testapp/app/views/heroes/show.html.slim +6 -0
- data/feature_support/testapp/app/views/users/_box.html.slim +8 -0
- data/feature_support/testapp/app/views/users/show.html.slim +6 -0
- data/feature_support/testapp/config/application.rb +64 -0
- data/feature_support/testapp/config/cucumber.yml +8 -0
- data/feature_support/testapp/config/database.yml +28 -0
- data/feature_support/testapp/config/environments/cucumber.rb +11 -0
- data/feature_support/testapp/config/environments/test.rb +27 -0
- data/feature_support/testapp/config/routes.rb +4 -0
- data/feature_support/testapp/db/migrate/1_create_users.rb +13 -0
- data/feature_support/testapp/features/inheritance.feature +16 -0
- data/feature_support/testapp/features/step_definitions/testapp_steps.rb +16 -0
- data/feature_support/testapp/features/support/env.rb +13 -0
- data/feature_support/testapp/features/users.feature +15 -0
- data/feature_support/testapp/lib/tasks/cucumber.rake +31 -0
- data/feature_support/testapp/spec/factories/heroes.rb +7 -0
- data/feature_support/testapp/spec/factories/users.rb +7 -0
- data/features/rails_integration.feature +21 -0
- data/features/step_definitions/rails_steps.rb +112 -0
- data/features/support/env.rb +6 -0
- data/gemfiles/3.0.Gemfile +13 -0
- data/gemfiles/3.1.Gemfile +15 -0
- data/gemfiles/3.2.gemfile +15 -0
- data/lib/rails/generators/view_models/USAGE +6 -0
- data/lib/rails/generators/view_models/templates/views/_collection.html.erb +6 -0
- data/lib/{rails2/generators/view_models/templates/views/view_models/collection → rails/generators/view_models/templates/views}/_collection.html.haml +1 -2
- data/lib/rails/generators/view_models/templates/views/_collection.html.slim +6 -0
- data/lib/{rails2/generators/view_models/templates/views/_empty.html.haml → rails/generators/view_models/templates/views/_empty.html.erb} +0 -0
- data/lib/rails/generators/view_models/templates/views/_empty.html.haml +0 -0
- data/lib/rails/generators/view_models/templates/views/_empty.html.slim +0 -0
- data/lib/rails/generators/view_models/templates/views/_list.html.erb +6 -0
- data/lib/rails/generators/view_models/templates/views/_list.html.haml +4 -0
- data/lib/rails/generators/view_models/templates/views/_list.html.slim +5 -0
- data/lib/rails/generators/view_models/templates/views/_pagination.html.erb +18 -0
- data/lib/{rails2/generators/view_models/templates/views/view_models/collection → rails/generators/view_models/templates/views}/_pagination.html.haml +2 -2
- data/lib/rails/generators/view_models/templates/views/_pagination.html.slim +12 -0
- data/lib/rails/generators/view_models/templates/views/_table.html.erb +10 -0
- data/lib/{rails2/generators/view_models/templates/views/view_models/collection → rails/generators/view_models/templates/views}/_table.html.haml +0 -0
- data/lib/rails/generators/view_models/templates/views/_table.html.slim +5 -0
- data/lib/rails/generators/view_models/view_models_generator.rb +57 -0
- data/lib/view_models.rb +15 -5
- data/lib/{shared/lib/view_models → view_models}/base.rb +148 -37
- data/lib/{shared/lib/view_models → view_models}/context_extractor.rb +6 -2
- data/lib/{shared/lib/view_models → view_models}/extensions/model_reader.rb +27 -13
- data/lib/{rails2/lib → view_models}/extensions/view.rb +6 -1
- data/lib/view_models/helpers/collection.rb +113 -0
- data/lib/{shared/lib/view_models → view_models}/helpers/mapping.rb +12 -15
- data/lib/{rails2/lib → view_models}/helpers/view.rb +5 -1
- data/lib/{shared/lib/view_models → view_models}/path_store.rb +6 -1
- data/lib/{shared/lib/view_models → view_models}/render_options.rb +19 -4
- data/lib/view_models/version.rb +5 -0
- data/lib/{rails2/lib/view_models → view_models}/view.rb +7 -6
- data/spec/{rails2/lib → lib}/view_models/base_spec.rb +38 -5
- data/spec/{rails2/lib → lib/view_models}/extensions/model_reader_spec.rb +4 -4
- data/spec/{shared/lib → lib/view_models}/helpers/collection_spec.rb +21 -1
- data/spec/{shared/lib → lib/view_models}/helpers/mapping_spec.rb +6 -5
- data/spec/{rails2/lib → lib/view_models}/helpers/view_spec.rb +1 -1
- data/spec/lib/view_models/view_spec.rb +42 -0
- data/spec/spec_helper.rb +32 -0
- data/spec/spec_helper_extensions.rb +13 -0
- data/view_models.gemspec +36 -0
- metadata +411 -142
- data/lib/init.rb +0 -1
- data/lib/padrino/README.textile +0 -3
- data/lib/padrino/init.rb +0 -10
- data/lib/padrino/lib/helpers/collection.rb +0 -27
- data/lib/padrino/lib/padrino/view_models.rb +0 -19
- data/lib/padrino/lib/view_models/base.rb +0 -65
- data/lib/rails2/README.textile +0 -3
- data/lib/rails2/TODO.textile +0 -5
- data/lib/rails2/generators/view_models/USAGE +0 -6
- data/lib/rails2/generators/view_models/templates/README +0 -1
- data/lib/rails2/generators/view_models/templates/spec/view_model_spec.rb +0 -7
- data/lib/rails2/generators/view_models/templates/view_models/view_model.rb +0 -5
- data/lib/rails2/generators/view_models/templates/views/view_models/collection/_collection.html.erb +0 -1
- data/lib/rails2/generators/view_models/templates/views/view_models/collection/_collection.text.erb +0 -6
- data/lib/rails2/generators/view_models/templates/views/view_models/collection/_list.html.erb +0 -1
- data/lib/rails2/generators/view_models/templates/views/view_models/collection/_list.text.erb +0 -6
- data/lib/rails2/generators/view_models/templates/views/view_models/collection/_pagination.text.erb +0 -3
- data/lib/rails2/generators/view_models/templates/views/view_models/collection/_table.text.erb +0 -10
- data/lib/rails2/generators/view_models/view_models_generator.rb +0 -47
- data/lib/rails2/init.rb +0 -18
- data/lib/rails2/lib/experimental/README.textile +0 -32
- data/lib/rails2/lib/experimental/modules_in_render_hierarchy.rb +0 -21
- data/lib/rails2/lib/helpers/collection.rb +0 -27
- data/lib/rails2/lib/view_models.rb +0 -1
- data/lib/rails2/lib/view_models/base.rb +0 -99
- data/lib/shared/README.textile +0 -3
- data/lib/shared/init.rb +0 -11
- data/lib/shared/lib/view_models.rb +0 -4
- data/lib/shared/lib/view_models/extensions/active_record.rb +0 -27
- data/lib/shared/lib/view_models/helpers/collection.rb +0 -110
- data/spec/padrino/integration/integration_spec.rb +0 -287
- data/spec/padrino/lib/helpers/collection_spec.rb +0 -30
- data/spec/rails2/integration/integration_spec.rb +0 -279
- data/spec/rails2/lib/extensions/active_record_spec.rb +0 -31
- data/spec/rails2/lib/helpers/collection_spec.rb +0 -30
- data/spec/rails2/lib/view_models/view_spec.rb +0 -12
|
@@ -0,0 +1,844 @@
|
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
4
|
+
<head>
|
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
6
|
+
<title>
|
|
7
|
+
Class: ViewModels::Helpers::Mapping::Collection
|
|
8
|
+
|
|
9
|
+
— Documentation by YARD 0.8.3
|
|
10
|
+
|
|
11
|
+
</title>
|
|
12
|
+
|
|
13
|
+
<link rel="stylesheet" href="../../../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
|
14
|
+
|
|
15
|
+
<link rel="stylesheet" href="../../../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
|
16
|
+
|
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
|
19
|
+
relpath = '../../../';
|
|
20
|
+
framesUrl = "../../../frames.html#!" + escape(window.location.href);
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../../../js/jquery.js"></script>
|
|
25
|
+
|
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../../../js/app.js"></script>
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
</head>
|
|
30
|
+
<body>
|
|
31
|
+
<div id="header">
|
|
32
|
+
<div id="menu">
|
|
33
|
+
|
|
34
|
+
<a href="../../../_index.html">Index (C)</a> »
|
|
35
|
+
<span class='title'><span class='object_link'><a href="../../../ViewModels.html" title="ViewModels (module)">ViewModels</a></span></span> » <span class='title'><span class='object_link'><a href="../../Helpers.html" title="ViewModels::Helpers (module)">Helpers</a></span></span> » <span class='title'><span class='object_link'><a href="../Mapping.html" title="ViewModels::Helpers::Mapping (module)">Mapping</a></span></span>
|
|
36
|
+
»
|
|
37
|
+
<span class="title">Collection</span>
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
<div id="search">
|
|
44
|
+
|
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
|
46
|
+
href="../../../class_list.html">
|
|
47
|
+
Class List
|
|
48
|
+
</a>
|
|
49
|
+
|
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
|
51
|
+
href="../../../method_list.html">
|
|
52
|
+
Method List
|
|
53
|
+
</a>
|
|
54
|
+
|
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
|
56
|
+
href="../../../file_list.html">
|
|
57
|
+
File List
|
|
58
|
+
</a>
|
|
59
|
+
|
|
60
|
+
</div>
|
|
61
|
+
<div class="clear"></div>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<iframe id="search_frame"></iframe>
|
|
65
|
+
|
|
66
|
+
<div id="content"><h1>Class: ViewModels::Helpers::Mapping::Collection
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
</h1>
|
|
71
|
+
|
|
72
|
+
<dl class="box">
|
|
73
|
+
|
|
74
|
+
<dt class="r1">Inherits:</dt>
|
|
75
|
+
<dd class="r1">
|
|
76
|
+
<span class="inheritName">Object</span>
|
|
77
|
+
|
|
78
|
+
<ul class="fullTree">
|
|
79
|
+
<li>Object</li>
|
|
80
|
+
|
|
81
|
+
<li class="next">ViewModels::Helpers::Mapping::Collection</li>
|
|
82
|
+
|
|
83
|
+
</ul>
|
|
84
|
+
<a href="#" class="inheritanceTree">show all</a>
|
|
85
|
+
|
|
86
|
+
</dd>
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
<dt class="r2 last">Defined in:</dt>
|
|
97
|
+
<dd class="r2 last">lib/view_models/helpers/collection.rb</dd>
|
|
98
|
+
|
|
99
|
+
</dl>
|
|
100
|
+
<div class="clear"></div>
|
|
101
|
+
|
|
102
|
+
<h2>Overview</h2><div class="docstring">
|
|
103
|
+
<div class="discussion">
|
|
104
|
+
|
|
105
|
+
<p>The Collection view_model helper has the purpose of presenting presentable
|
|
106
|
+
collections.</p>
|
|
107
|
+
<ul><li>
|
|
108
|
+
<p>Render as list</p>
|
|
109
|
+
</li><li>
|
|
110
|
+
<p>Render as table</p>
|
|
111
|
+
</li><li>
|
|
112
|
+
<p>Render as collection</p>
|
|
113
|
+
</li><li>
|
|
114
|
+
<p>Render a pagination</p>
|
|
115
|
+
</li></ul>
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
</div>
|
|
119
|
+
</div>
|
|
120
|
+
<div class="tags">
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
</div>
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
<h2>
|
|
132
|
+
Instance Method Summary
|
|
133
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
|
134
|
+
</h2>
|
|
135
|
+
|
|
136
|
+
<ul class="summary">
|
|
137
|
+
|
|
138
|
+
<li class="public ">
|
|
139
|
+
<span class="summary_signature">
|
|
140
|
+
|
|
141
|
+
<a href="#collection-instance_method" title="#collection (instance method)">- (Object) <strong>collection</strong>(options = {}) </a>
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
</span>
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
<span class="summary_desc"><div class='inline'>
|
|
156
|
+
<p>Renders a collection.</p>
|
|
157
|
+
</div></span>
|
|
158
|
+
|
|
159
|
+
</li>
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
<li class="public ">
|
|
163
|
+
<span class="summary_signature">
|
|
164
|
+
|
|
165
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (Collection) <strong>initialize</strong>(collection, context) </a>
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
</span>
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
<span class="note title constructor">constructor</span>
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
<span class="summary_desc"><div class='inline'>
|
|
182
|
+
<p>A new instance of Collection.</p>
|
|
183
|
+
</div></span>
|
|
184
|
+
|
|
185
|
+
</li>
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
<li class="public ">
|
|
189
|
+
<span class="summary_signature">
|
|
190
|
+
|
|
191
|
+
<a href="#list-instance_method" title="#list (instance method)">- (Object) <strong>list</strong>(options = {}) </a>
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
</span>
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
<span class="summary_desc"><div class='inline'>
|
|
206
|
+
<p>Renders a list (in the broadest sense of the word).</p>
|
|
207
|
+
</div></span>
|
|
208
|
+
|
|
209
|
+
</li>
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
<li class="public ">
|
|
213
|
+
<span class="summary_signature">
|
|
214
|
+
|
|
215
|
+
<a href="#pagination-instance_method" title="#pagination (instance method)">- (Object) <strong>pagination</strong>(options = {}) </a>
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
</span>
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
<span class="summary_desc"><div class='inline'>
|
|
230
|
+
<p>Renders a pagination.</p>
|
|
231
|
+
</div></span>
|
|
232
|
+
|
|
233
|
+
</li>
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
<li class="public ">
|
|
237
|
+
<span class="summary_signature">
|
|
238
|
+
|
|
239
|
+
<a href="#table-instance_method" title="#table (instance method)">- (Object) <strong>table</strong>(options = {}) </a>
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
</span>
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
<span class="summary_desc"><div class='inline'>
|
|
254
|
+
<p>Renders a table.</p>
|
|
255
|
+
</div></span>
|
|
256
|
+
|
|
257
|
+
</li>
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
</ul>
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
<div id="constructor_details" class="method_details_list">
|
|
264
|
+
<h2>Constructor Details</h2>
|
|
265
|
+
|
|
266
|
+
<div class="method_details first">
|
|
267
|
+
<h3 class="signature first" id="initialize-instance_method">
|
|
268
|
+
|
|
269
|
+
- (<tt><span class='object_link'><a href="" title="ViewModels::Helpers::Mapping::Collection (class)">Collection</a></span></tt>) <strong>initialize</strong>(collection, context)
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
</h3><div class="docstring">
|
|
276
|
+
<div class="discussion">
|
|
277
|
+
|
|
278
|
+
<p>A new instance of Collection</p>
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
</div>
|
|
282
|
+
</div>
|
|
283
|
+
<div class="tags">
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
</div><table class="source_code">
|
|
287
|
+
<tr>
|
|
288
|
+
<td>
|
|
289
|
+
<pre class="lines">
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
37
|
|
293
|
+
38
|
|
294
|
+
39</pre>
|
|
295
|
+
</td>
|
|
296
|
+
<td>
|
|
297
|
+
<pre class="code"><span class="info file"># File 'lib/view_models/helpers/collection.rb', line 37</span>
|
|
298
|
+
|
|
299
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span> <span class='id identifier rubyid_collection'>collection</span><span class='comma'>,</span> <span class='id identifier rubyid_context'>context</span>
|
|
300
|
+
<span class='ivar'>@collection</span><span class='comma'>,</span> <span class='ivar'>@context</span> <span class='op'>=</span> <span class='id identifier rubyid_collection'>collection</span><span class='comma'>,</span> <span class='id identifier rubyid_context'>context</span>
|
|
301
|
+
<span class='kw'>end</span></pre>
|
|
302
|
+
</td>
|
|
303
|
+
</tr>
|
|
304
|
+
</table>
|
|
305
|
+
</div>
|
|
306
|
+
|
|
307
|
+
</div>
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
<div id="instance_method_details" class="method_details_list">
|
|
311
|
+
<h2>Instance Method Details</h2>
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
<div class="method_details first">
|
|
315
|
+
<h3 class="signature first" id="collection-instance_method">
|
|
316
|
+
|
|
317
|
+
- (<tt>Object</tt>) <strong>collection</strong>(options = {})
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
</h3><div class="docstring">
|
|
324
|
+
<div class="discussion">
|
|
325
|
+
|
|
326
|
+
<div class="note notetag">
|
|
327
|
+
<strong>Note:</strong>
|
|
328
|
+
<div class='inline'>
|
|
329
|
+
<p>The only difference between a list and a collection is the enclosing list
|
|
330
|
+
type. While list uses ol, the collection uses ul.</p>
|
|
331
|
+
</div>
|
|
332
|
+
</div>
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
<p>Renders a collection.</p>
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
</div>
|
|
339
|
+
</div>
|
|
340
|
+
<div class="tags">
|
|
341
|
+
<p class="tag_title">Parameters:</p>
|
|
342
|
+
<ul class="param">
|
|
343
|
+
|
|
344
|
+
<li>
|
|
345
|
+
|
|
346
|
+
<span class='name'>options</span>
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
—
|
|
356
|
+
<div class='inline'>
|
|
357
|
+
<p>The options for the collection</p>
|
|
358
|
+
</div>
|
|
359
|
+
|
|
360
|
+
</li>
|
|
361
|
+
|
|
362
|
+
</ul>
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
<p class="tag_title">Options Hash (<tt>options</tt>):</p>
|
|
368
|
+
<ul class="option">
|
|
369
|
+
|
|
370
|
+
<li>
|
|
371
|
+
<span class="name">:collection</span>
|
|
372
|
+
<span class="type">(<tt>Object</tt>)</span>
|
|
373
|
+
<span class="default">
|
|
374
|
+
|
|
375
|
+
</span>
|
|
376
|
+
|
|
377
|
+
— <div class='inline'>
|
|
378
|
+
<p>the collection to iterate over (default: The collection of the collection
|
|
379
|
+
view_model to iterate over)</p>
|
|
380
|
+
</div>
|
|
381
|
+
|
|
382
|
+
</li>
|
|
383
|
+
|
|
384
|
+
<li>
|
|
385
|
+
<span class="name">:context</span>
|
|
386
|
+
<span class="type">(<tt>Object</tt>)</span>
|
|
387
|
+
<span class="default">
|
|
388
|
+
|
|
389
|
+
</span>
|
|
390
|
+
|
|
391
|
+
— <div class='inline'>
|
|
392
|
+
<p>the context to render in (default: The original context given to the
|
|
393
|
+
collection view_model to render in)</p>
|
|
394
|
+
</div>
|
|
395
|
+
|
|
396
|
+
</li>
|
|
397
|
+
|
|
398
|
+
<li>
|
|
399
|
+
<span class="name">:template_name</span>
|
|
400
|
+
<span class="type">(<tt>Object</tt>)</span>
|
|
401
|
+
<span class="default">
|
|
402
|
+
|
|
403
|
+
</span>
|
|
404
|
+
|
|
405
|
+
— <div class='inline'>
|
|
406
|
+
<p>the template to render for each model element (default: Uses
|
|
407
|
+
:collection_item as the default element template)</p>
|
|
408
|
+
</div>
|
|
409
|
+
|
|
410
|
+
</li>
|
|
411
|
+
|
|
412
|
+
<li>
|
|
413
|
+
<span class="name">:separator</span>
|
|
414
|
+
<span class="type">(<tt>Object</tt>)</span>
|
|
415
|
+
<span class="default">
|
|
416
|
+
|
|
417
|
+
</span>
|
|
418
|
+
|
|
419
|
+
— <div class='inline'>
|
|
420
|
+
<h1 id="label-%3E+separator+between+each+element+%28default%3A+nil+separator+in+html%29">> separator between each element (default: nil separator in html)</h1>
|
|
421
|
+
</div>
|
|
422
|
+
|
|
423
|
+
</li>
|
|
424
|
+
|
|
425
|
+
</ul>
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
</div><table class="source_code">
|
|
430
|
+
<tr>
|
|
431
|
+
<td>
|
|
432
|
+
<pre class="lines">
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
63
|
|
436
|
+
64
|
|
437
|
+
65</pre>
|
|
438
|
+
</td>
|
|
439
|
+
<td>
|
|
440
|
+
<pre class="code"><span class="info file"># File 'lib/view_models/helpers/collection.rb', line 63</span>
|
|
441
|
+
|
|
442
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_collection'>collection</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
|
443
|
+
<span class='id identifier rubyid_render_partial'>render_partial</span> <span class='symbol'>:collection</span><span class='comma'>,</span> <span class='id identifier rubyid_template_locals'>template_locals</span><span class='lparen'>(</span><span class='symbol'>:collection_item</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
|
444
|
+
<span class='kw'>end</span></pre>
|
|
445
|
+
</td>
|
|
446
|
+
</tr>
|
|
447
|
+
</table>
|
|
448
|
+
</div>
|
|
449
|
+
|
|
450
|
+
<div class="method_details ">
|
|
451
|
+
<h3 class="signature " id="list-instance_method">
|
|
452
|
+
|
|
453
|
+
- (<tt>Object</tt>) <strong>list</strong>(options = {})
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
</h3><div class="docstring">
|
|
460
|
+
<div class="discussion">
|
|
461
|
+
|
|
462
|
+
<p>Renders a list (in the broadest sense of the word).</p>
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
</div>
|
|
466
|
+
</div>
|
|
467
|
+
<div class="tags">
|
|
468
|
+
<p class="tag_title">Parameters:</p>
|
|
469
|
+
<ul class="param">
|
|
470
|
+
|
|
471
|
+
<li>
|
|
472
|
+
|
|
473
|
+
<span class='name'>options</span>
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
|
477
|
+
|
|
478
|
+
|
|
479
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
—
|
|
483
|
+
<div class='inline'>
|
|
484
|
+
<p>The options for the list</p>
|
|
485
|
+
</div>
|
|
486
|
+
|
|
487
|
+
</li>
|
|
488
|
+
|
|
489
|
+
</ul>
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
<p class="tag_title">Options Hash (<tt>options</tt>):</p>
|
|
495
|
+
<ul class="option">
|
|
496
|
+
|
|
497
|
+
<li>
|
|
498
|
+
<span class="name">:collection</span>
|
|
499
|
+
<span class="type">(<tt>Object</tt>)</span>
|
|
500
|
+
<span class="default">
|
|
501
|
+
|
|
502
|
+
</span>
|
|
503
|
+
|
|
504
|
+
— <div class='inline'>
|
|
505
|
+
<p>the collection to iterate over (default: The collection of the collection
|
|
506
|
+
view_model to iterate over)</p>
|
|
507
|
+
</div>
|
|
508
|
+
|
|
509
|
+
</li>
|
|
510
|
+
|
|
511
|
+
<li>
|
|
512
|
+
<span class="name">:context</span>
|
|
513
|
+
<span class="type">(<tt>Object</tt>)</span>
|
|
514
|
+
<span class="default">
|
|
515
|
+
|
|
516
|
+
</span>
|
|
517
|
+
|
|
518
|
+
— <div class='inline'>
|
|
519
|
+
<p>context to render in (default: The original context given to the collection
|
|
520
|
+
view_model to render in)</p>
|
|
521
|
+
</div>
|
|
522
|
+
|
|
523
|
+
</li>
|
|
524
|
+
|
|
525
|
+
<li>
|
|
526
|
+
<span class="name">:template_name</span>
|
|
527
|
+
<span class="type">(<tt>Object</tt>)</span>
|
|
528
|
+
<span class="default">
|
|
529
|
+
|
|
530
|
+
</span>
|
|
531
|
+
|
|
532
|
+
— <div class='inline'>
|
|
533
|
+
<p>the template to render for each model element (default: list_item as the
|
|
534
|
+
default element template)</p>
|
|
535
|
+
</div>
|
|
536
|
+
|
|
537
|
+
</li>
|
|
538
|
+
|
|
539
|
+
<li>
|
|
540
|
+
<span class="name">:separator</span>
|
|
541
|
+
<span class="type">(<tt>Object</tt>)</span>
|
|
542
|
+
<span class="default">
|
|
543
|
+
|
|
544
|
+
</span>
|
|
545
|
+
|
|
546
|
+
— <div class='inline'>
|
|
547
|
+
<p>the separator between each element (default: nil separator in html)</p>
|
|
548
|
+
</div>
|
|
549
|
+
|
|
550
|
+
</li>
|
|
551
|
+
|
|
552
|
+
</ul>
|
|
553
|
+
|
|
554
|
+
|
|
555
|
+
|
|
556
|
+
</div><table class="source_code">
|
|
557
|
+
<tr>
|
|
558
|
+
<td>
|
|
559
|
+
<pre class="lines">
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
49
|
|
563
|
+
50
|
|
564
|
+
51</pre>
|
|
565
|
+
</td>
|
|
566
|
+
<td>
|
|
567
|
+
<pre class="code"><span class="info file"># File 'lib/view_models/helpers/collection.rb', line 49</span>
|
|
568
|
+
|
|
569
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_list'>list</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
|
570
|
+
<span class='id identifier rubyid_render_partial'>render_partial</span> <span class='symbol'>:list</span><span class='comma'>,</span> <span class='id identifier rubyid_template_locals'>template_locals</span><span class='lparen'>(</span><span class='symbol'>:list_item</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
|
571
|
+
<span class='kw'>end</span></pre>
|
|
572
|
+
</td>
|
|
573
|
+
</tr>
|
|
574
|
+
</table>
|
|
575
|
+
</div>
|
|
576
|
+
|
|
577
|
+
<div class="method_details ">
|
|
578
|
+
<h3 class="signature " id="pagination-instance_method">
|
|
579
|
+
|
|
580
|
+
- (<tt>Object</tt>) <strong>pagination</strong>(options = {})
|
|
581
|
+
|
|
582
|
+
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
</h3><div class="docstring">
|
|
587
|
+
<div class="discussion">
|
|
588
|
+
|
|
589
|
+
<p>Renders a pagination.</p>
|
|
590
|
+
|
|
591
|
+
|
|
592
|
+
</div>
|
|
593
|
+
</div>
|
|
594
|
+
<div class="tags">
|
|
595
|
+
<p class="tag_title">Parameters:</p>
|
|
596
|
+
<ul class="param">
|
|
597
|
+
|
|
598
|
+
<li>
|
|
599
|
+
|
|
600
|
+
<span class='name'>options</span>
|
|
601
|
+
|
|
602
|
+
|
|
603
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
|
604
|
+
|
|
605
|
+
|
|
606
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
|
607
|
+
|
|
608
|
+
|
|
609
|
+
—
|
|
610
|
+
<div class='inline'>
|
|
611
|
+
<p>The options for the collection</p>
|
|
612
|
+
</div>
|
|
613
|
+
|
|
614
|
+
</li>
|
|
615
|
+
|
|
616
|
+
</ul>
|
|
617
|
+
|
|
618
|
+
|
|
619
|
+
|
|
620
|
+
|
|
621
|
+
<p class="tag_title">Options Hash (<tt>options</tt>):</p>
|
|
622
|
+
<ul class="option">
|
|
623
|
+
|
|
624
|
+
<li>
|
|
625
|
+
<span class="name">:collection</span>
|
|
626
|
+
<span class="type">(<tt>Object</tt>)</span>
|
|
627
|
+
<span class="default">
|
|
628
|
+
|
|
629
|
+
</span>
|
|
630
|
+
|
|
631
|
+
— <div class='inline'>
|
|
632
|
+
<p>the collection to iterate over (default: The collection of the collection
|
|
633
|
+
view_model to iterate over)</p>
|
|
634
|
+
</div>
|
|
635
|
+
|
|
636
|
+
</li>
|
|
637
|
+
|
|
638
|
+
<li>
|
|
639
|
+
<span class="name">:context</span>
|
|
640
|
+
<span class="type">(<tt>Object</tt>)</span>
|
|
641
|
+
<span class="default">
|
|
642
|
+
|
|
643
|
+
</span>
|
|
644
|
+
|
|
645
|
+
— <div class='inline'>
|
|
646
|
+
<p>the context to render in (default: The original context given to the
|
|
647
|
+
collection view_model to render in)</p>
|
|
648
|
+
</div>
|
|
649
|
+
|
|
650
|
+
</li>
|
|
651
|
+
|
|
652
|
+
<li>
|
|
653
|
+
<span class="name">:template_name</span>
|
|
654
|
+
<span class="type">(<tt>Object</tt>)</span>
|
|
655
|
+
<span class="default">
|
|
656
|
+
|
|
657
|
+
</span>
|
|
658
|
+
|
|
659
|
+
— <div class='inline'>
|
|
660
|
+
<p>the template to render for each model element (default: Uses
|
|
661
|
+
:collection_item as the default element template)</p>
|
|
662
|
+
</div>
|
|
663
|
+
|
|
664
|
+
</li>
|
|
665
|
+
|
|
666
|
+
<li>
|
|
667
|
+
<span class="name">:separator</span>
|
|
668
|
+
<span class="type">(<tt>Object</tt>)</span>
|
|
669
|
+
<span class="default">
|
|
670
|
+
|
|
671
|
+
</span>
|
|
672
|
+
|
|
673
|
+
— <div class='inline'>
|
|
674
|
+
<h1 id="label-%3E+separator+between+each+element+%28default%3A+%7C+separator+in+html%29">> separator between each element (default: | separator in html)</h1>
|
|
675
|
+
</div>
|
|
676
|
+
|
|
677
|
+
</li>
|
|
678
|
+
|
|
679
|
+
</ul>
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
|
|
683
|
+
</div><table class="source_code">
|
|
684
|
+
<tr>
|
|
685
|
+
<td>
|
|
686
|
+
<pre class="lines">
|
|
687
|
+
|
|
688
|
+
|
|
689
|
+
89
|
|
690
|
+
90
|
|
691
|
+
91</pre>
|
|
692
|
+
</td>
|
|
693
|
+
<td>
|
|
694
|
+
<pre class="code"><span class="info file"># File 'lib/view_models/helpers/collection.rb', line 89</span>
|
|
695
|
+
|
|
696
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_pagination'>pagination</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
|
697
|
+
<span class='id identifier rubyid_render_partial'>render_partial</span> <span class='symbol'>:pagination</span><span class='comma'>,</span> <span class='id identifier rubyid_template_locals'>template_locals</span><span class='lparen'>(</span><span class='symbol'>:pagination</span><span class='comma'>,</span> <span class='lbrace'>{</span><span class='symbol'>:separator</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>|</span><span class='tstring_end'>'</span></span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
|
698
|
+
<span class='kw'>end</span></pre>
|
|
699
|
+
</td>
|
|
700
|
+
</tr>
|
|
701
|
+
</table>
|
|
702
|
+
</div>
|
|
703
|
+
|
|
704
|
+
<div class="method_details ">
|
|
705
|
+
<h3 class="signature " id="table-instance_method">
|
|
706
|
+
|
|
707
|
+
- (<tt>Object</tt>) <strong>table</strong>(options = {})
|
|
708
|
+
|
|
709
|
+
|
|
710
|
+
|
|
711
|
+
|
|
712
|
+
|
|
713
|
+
</h3><div class="docstring">
|
|
714
|
+
<div class="discussion">
|
|
715
|
+
|
|
716
|
+
<p>Renders a table.</p>
|
|
717
|
+
|
|
718
|
+
<p>Note: Each item represents a table row.</p>
|
|
719
|
+
|
|
720
|
+
|
|
721
|
+
</div>
|
|
722
|
+
</div>
|
|
723
|
+
<div class="tags">
|
|
724
|
+
<p class="tag_title">Parameters:</p>
|
|
725
|
+
<ul class="param">
|
|
726
|
+
|
|
727
|
+
<li>
|
|
728
|
+
|
|
729
|
+
<span class='name'>options</span>
|
|
730
|
+
|
|
731
|
+
|
|
732
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
|
733
|
+
|
|
734
|
+
|
|
735
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
|
736
|
+
|
|
737
|
+
|
|
738
|
+
—
|
|
739
|
+
<div class='inline'>
|
|
740
|
+
<p>The options for the table</p>
|
|
741
|
+
</div>
|
|
742
|
+
|
|
743
|
+
</li>
|
|
744
|
+
|
|
745
|
+
</ul>
|
|
746
|
+
|
|
747
|
+
|
|
748
|
+
|
|
749
|
+
|
|
750
|
+
<p class="tag_title">Options Hash (<tt>options</tt>):</p>
|
|
751
|
+
<ul class="option">
|
|
752
|
+
|
|
753
|
+
<li>
|
|
754
|
+
<span class="name">:collection</span>
|
|
755
|
+
<span class="type">(<tt>Object</tt>)</span>
|
|
756
|
+
<span class="default">
|
|
757
|
+
|
|
758
|
+
</span>
|
|
759
|
+
|
|
760
|
+
— <div class='inline'>
|
|
761
|
+
<p>the collection to iterate over (default: The collection of the collection
|
|
762
|
+
view_model to iterate over)</p>
|
|
763
|
+
</div>
|
|
764
|
+
|
|
765
|
+
</li>
|
|
766
|
+
|
|
767
|
+
<li>
|
|
768
|
+
<span class="name">:context</span>
|
|
769
|
+
<span class="type">(<tt>Object</tt>)</span>
|
|
770
|
+
<span class="default">
|
|
771
|
+
|
|
772
|
+
</span>
|
|
773
|
+
|
|
774
|
+
— <div class='inline'>
|
|
775
|
+
<p>the context to render in (default: The original context given to the
|
|
776
|
+
collection view_model to render in)</p>
|
|
777
|
+
</div>
|
|
778
|
+
|
|
779
|
+
</li>
|
|
780
|
+
|
|
781
|
+
<li>
|
|
782
|
+
<span class="name">:template_name</span>
|
|
783
|
+
<span class="type">(<tt>Object</tt>)</span>
|
|
784
|
+
<span class="default">
|
|
785
|
+
|
|
786
|
+
</span>
|
|
787
|
+
|
|
788
|
+
— <div class='inline'>
|
|
789
|
+
<p>the template to render for each model element (default: Uses :table_row as
|
|
790
|
+
the default element template)</p>
|
|
791
|
+
</div>
|
|
792
|
+
|
|
793
|
+
</li>
|
|
794
|
+
|
|
795
|
+
<li>
|
|
796
|
+
<span class="name">:separator</span>
|
|
797
|
+
<span class="type">(<tt>Object</tt>)</span>
|
|
798
|
+
<span class="default">
|
|
799
|
+
|
|
800
|
+
</span>
|
|
801
|
+
|
|
802
|
+
— <div class='inline'>
|
|
803
|
+
<h1 id="label-%3E+separator+between+each+element+%28default%3A+nil+separator+in+html%29">> separator between each element (default: nil separator in html)</h1>
|
|
804
|
+
</div>
|
|
805
|
+
|
|
806
|
+
</li>
|
|
807
|
+
|
|
808
|
+
</ul>
|
|
809
|
+
|
|
810
|
+
|
|
811
|
+
|
|
812
|
+
</div><table class="source_code">
|
|
813
|
+
<tr>
|
|
814
|
+
<td>
|
|
815
|
+
<pre class="lines">
|
|
816
|
+
|
|
817
|
+
|
|
818
|
+
77
|
|
819
|
+
78
|
|
820
|
+
79</pre>
|
|
821
|
+
</td>
|
|
822
|
+
<td>
|
|
823
|
+
<pre class="code"><span class="info file"># File 'lib/view_models/helpers/collection.rb', line 77</span>
|
|
824
|
+
|
|
825
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_table'>table</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
|
826
|
+
<span class='id identifier rubyid_render_partial'>render_partial</span> <span class='symbol'>:table</span><span class='comma'>,</span> <span class='id identifier rubyid_template_locals'>template_locals</span><span class='lparen'>(</span><span class='symbol'>:table_row</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
|
827
|
+
<span class='kw'>end</span></pre>
|
|
828
|
+
</td>
|
|
829
|
+
</tr>
|
|
830
|
+
</table>
|
|
831
|
+
</div>
|
|
832
|
+
|
|
833
|
+
</div>
|
|
834
|
+
|
|
835
|
+
</div>
|
|
836
|
+
|
|
837
|
+
<div id="footer">
|
|
838
|
+
Generated on Tue Oct 16 23:27:35 2012 by
|
|
839
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
840
|
+
0.8.3 (ruby-1.9.3).
|
|
841
|
+
</div>
|
|
842
|
+
|
|
843
|
+
</body>
|
|
844
|
+
</html>
|