apes 1.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.
- checksums.yaml +7 -0
- data/.gitignore +7 -0
- data/.rubocop.yml +82 -0
- data/.travis-gemfile +15 -0
- data/.travis.yml +15 -0
- data/.yardopts +1 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +22 -0
- data/README.md +177 -0
- data/Rakefile +44 -0
- data/apes.gemspec +34 -0
- data/doc/Apes.html +130 -0
- data/doc/Apes/Concerns.html +127 -0
- data/doc/Apes/Concerns/Errors.html +1089 -0
- data/doc/Apes/Concerns/Pagination.html +636 -0
- data/doc/Apes/Concerns/Request.html +766 -0
- data/doc/Apes/Concerns/Response.html +940 -0
- data/doc/Apes/Controller.html +1100 -0
- data/doc/Apes/Errors.html +125 -0
- data/doc/Apes/Errors/AuthenticationError.html +133 -0
- data/doc/Apes/Errors/BadRequestError.html +157 -0
- data/doc/Apes/Errors/BaseError.html +320 -0
- data/doc/Apes/Errors/InvalidDataError.html +157 -0
- data/doc/Apes/Errors/MissingDataError.html +157 -0
- data/doc/Apes/Model.html +378 -0
- data/doc/Apes/PaginationCursor.html +2138 -0
- data/doc/Apes/RuntimeConfiguration.html +909 -0
- data/doc/Apes/Serializers.html +125 -0
- data/doc/Apes/Serializers/JSON.html +389 -0
- data/doc/Apes/Serializers/JWT.html +452 -0
- data/doc/Apes/Serializers/List.html +347 -0
- data/doc/Apes/UrlsParser.html +1432 -0
- data/doc/Apes/Validators.html +125 -0
- data/doc/Apes/Validators/BaseValidator.html +278 -0
- data/doc/Apes/Validators/BooleanValidator.html +494 -0
- data/doc/Apes/Validators/EmailValidator.html +350 -0
- data/doc/Apes/Validators/PhoneValidator.html +375 -0
- data/doc/Apes/Validators/ReferenceValidator.html +372 -0
- data/doc/Apes/Validators/TimestampValidator.html +640 -0
- data/doc/Apes/Validators/UuidValidator.html +372 -0
- data/doc/Apes/Validators/ZipCodeValidator.html +372 -0
- data/doc/Apes/Version.html +189 -0
- data/doc/ApplicationController.html +547 -0
- data/doc/Concerns.html +128 -0
- data/doc/Concerns/ErrorHandling.html +826 -0
- data/doc/Concerns/PaginationHandling.html +463 -0
- data/doc/Concerns/RequestHandling.html +512 -0
- data/doc/Concerns/ResponseHandling.html +579 -0
- data/doc/Errors.html +126 -0
- data/doc/Errors/AuthenticationError.html +123 -0
- data/doc/Errors/BadRequestError.html +147 -0
- data/doc/Errors/BaseError.html +289 -0
- data/doc/Errors/InvalidDataError.html +147 -0
- data/doc/Errors/MissingDataError.html +147 -0
- data/doc/Model.html +315 -0
- data/doc/PaginationCursor.html +764 -0
- data/doc/Serializers.html +126 -0
- data/doc/Serializers/JSON.html +253 -0
- data/doc/Serializers/JWT.html +253 -0
- data/doc/Serializers/List.html +245 -0
- data/doc/Validators.html +126 -0
- data/doc/Validators/BaseValidator.html +209 -0
- data/doc/Validators/BooleanValidator.html +391 -0
- data/doc/Validators/EmailValidator.html +298 -0
- data/doc/Validators/PhoneValidator.html +313 -0
- data/doc/Validators/ReferenceValidator.html +284 -0
- data/doc/Validators/TimestampValidator.html +476 -0
- data/doc/Validators/UuidValidator.html +310 -0
- data/doc/Validators/ZipCodeValidator.html +310 -0
- data/doc/_index.html +435 -0
- data/doc/class_list.html +58 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +339 -0
- data/doc/file.README.html +252 -0
- data/doc/file_list.html +60 -0
- data/doc/frames.html +26 -0
- data/doc/index.html +252 -0
- data/doc/js/app.js +219 -0
- data/doc/js/full_list.js +181 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +615 -0
- data/doc/top-level-namespace.html +112 -0
- data/lib/apes.rb +40 -0
- data/lib/apes/concerns/errors.rb +111 -0
- data/lib/apes/concerns/pagination.rb +81 -0
- data/lib/apes/concerns/request.rb +237 -0
- data/lib/apes/concerns/response.rb +74 -0
- data/lib/apes/controller.rb +77 -0
- data/lib/apes/errors.rb +38 -0
- data/lib/apes/model.rb +94 -0
- data/lib/apes/pagination_cursor.rb +152 -0
- data/lib/apes/runtime_configuration.rb +80 -0
- data/lib/apes/serializers.rb +88 -0
- data/lib/apes/urls_parser.rb +233 -0
- data/lib/apes/validators.rb +234 -0
- data/lib/apes/version.rb +24 -0
- data/spec/apes/concerns/errors_spec.rb +141 -0
- data/spec/apes/concerns/pagination_spec.rb +114 -0
- data/spec/apes/concerns/request_spec.rb +244 -0
- data/spec/apes/concerns/response_spec.rb +79 -0
- data/spec/apes/controller_spec.rb +54 -0
- data/spec/apes/errors_spec.rb +14 -0
- data/spec/apes/models_spec.rb +148 -0
- data/spec/apes/pagination_cursor_spec.rb +113 -0
- data/spec/apes/runtime_configuration_spec.rb +100 -0
- data/spec/apes/serializers_spec.rb +70 -0
- data/spec/apes/urls_parser_spec.rb +150 -0
- data/spec/apes/validators_spec.rb +237 -0
- data/spec/spec_helper.rb +30 -0
- data/views/_included.json.jbuilder +9 -0
- data/views/_pagination.json.jbuilder +9 -0
- data/views/collection.json.jbuilder +4 -0
- data/views/errors/400.json.jbuilder +9 -0
- data/views/errors/403.json.jbuilder +7 -0
- data/views/errors/404.json.jbuilder +6 -0
- data/views/errors/422.json.jbuilder +19 -0
- data/views/errors/500.json.jbuilder +12 -0
- data/views/errors/501.json.jbuilder +7 -0
- data/views/layouts/general.json.jbuilder +36 -0
- data/views/object.json.jbuilder +4 -0
- metadata +262 -0
|
@@ -0,0 +1,636 @@
|
|
|
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
|
+
Module: Apes::Concerns::Pagination
|
|
8
|
+
|
|
9
|
+
— Documentation by YARD 0.8.7.6
|
|
10
|
+
|
|
11
|
+
</title>
|
|
12
|
+
|
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
|
|
14
|
+
|
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" 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#!Apes/Concerns/Pagination.html";
|
|
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 (P)</a> »
|
|
35
|
+
<span class='title'><span class='object_link'><a href="../../Apes.html" title="Apes (module)">Apes</a></span></span> » <span class='title'><span class='object_link'><a href="../Concerns.html" title="Apes::Concerns (module)">Concerns</a></span></span>
|
|
36
|
+
»
|
|
37
|
+
<span class="title">Pagination</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>Module: Apes::Concerns::Pagination
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
</h1>
|
|
71
|
+
|
|
72
|
+
<dl class="box">
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
<dt class="r1">Included in:</dt>
|
|
81
|
+
<dd class="r1"><span class='object_link'><a href="../Controller.html" title="Apes::Controller (class)">Apes::Controller</a></span></dd>
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
<dt class="r2 last">Defined in:</dt>
|
|
86
|
+
<dd class="r2 last">lib/apes/concerns/pagination.rb</dd>
|
|
87
|
+
|
|
88
|
+
</dl>
|
|
89
|
+
<div class="clear"></div>
|
|
90
|
+
|
|
91
|
+
<h2>Overview</h2><div class="docstring">
|
|
92
|
+
<div class="discussion">
|
|
93
|
+
<p>Pagination handling module.</p>
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
<div class="tags">
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
</div>
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
<h2>
|
|
110
|
+
Instance Method Summary
|
|
111
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
|
112
|
+
</h2>
|
|
113
|
+
|
|
114
|
+
<ul class="summary">
|
|
115
|
+
|
|
116
|
+
<li class="public ">
|
|
117
|
+
<span class="summary_signature">
|
|
118
|
+
|
|
119
|
+
<a href="#paginate-instance_method" title="#paginate (instance method)">- (ActiveRecord::Relation) <strong>paginate</strong>(collection, sort_field: :id, sort_order: :desc) </a>
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
</span>
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
<span class="summary_desc"><div class='inline'><p>Paginates a collection according to the current cursor.</p>
|
|
134
|
+
</div></span>
|
|
135
|
+
|
|
136
|
+
</li>
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
<li class="public ">
|
|
140
|
+
<span class="summary_signature">
|
|
141
|
+
|
|
142
|
+
<a href="#pagination_field-instance_method" title="#pagination_field (instance method)">- (Symbol) <strong>pagination_field</strong> </a>
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
</span>
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
<span class="summary_desc"><div class='inline'><p>The field to use for pagination.</p>
|
|
157
|
+
</div></span>
|
|
158
|
+
|
|
159
|
+
</li>
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
<li class="public ">
|
|
163
|
+
<span class="summary_signature">
|
|
164
|
+
|
|
165
|
+
<a href="#pagination_skip%3F-instance_method" title="#pagination_skip? (instance method)">- (Boolean) <strong>pagination_skip?</strong> </a>
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
</span>
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
<span class="summary_desc"><div class='inline'><p>Whether to skip pagination.</p>
|
|
180
|
+
</div></span>
|
|
181
|
+
|
|
182
|
+
</li>
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
<li class="public ">
|
|
186
|
+
<span class="summary_signature">
|
|
187
|
+
|
|
188
|
+
<a href="#pagination_supported%3F-instance_method" title="#pagination_supported? (instance method)">- (Boolean) <strong>pagination_supported?</strong> </a>
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
</span>
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
<span class="summary_desc"><div class='inline'><p>Checks if current collection supports pagination.</p>
|
|
203
|
+
</div></span>
|
|
204
|
+
|
|
205
|
+
</li>
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
<li class="public ">
|
|
209
|
+
<span class="summary_signature">
|
|
210
|
+
|
|
211
|
+
<a href="#pagination_url-instance_method" title="#pagination_url (instance method)">- (String) <strong>pagination_url</strong>(page = nil) </a>
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
</span>
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
<span class="summary_desc"><div class='inline'><p>Returns the URL a specific page of the current collection.</p>
|
|
226
|
+
</div></span>
|
|
227
|
+
|
|
228
|
+
</li>
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
</ul>
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
<div id="instance_method_details" class="method_details_list">
|
|
237
|
+
<h2>Instance Method Details</h2>
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
<div class="method_details first">
|
|
241
|
+
<h3 class="signature first" id="paginate-instance_method">
|
|
242
|
+
|
|
243
|
+
- (<tt>ActiveRecord::Relation</tt>) <strong>paginate</strong>(collection, sort_field: :id, sort_order: :desc)
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
</h3><div class="docstring">
|
|
250
|
+
<div class="discussion">
|
|
251
|
+
<p>Paginates a collection according to the current cursor.</p>
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
</div>
|
|
255
|
+
</div>
|
|
256
|
+
<div class="tags">
|
|
257
|
+
<p class="tag_title">Parameters:</p>
|
|
258
|
+
<ul class="param">
|
|
259
|
+
|
|
260
|
+
<li>
|
|
261
|
+
|
|
262
|
+
<span class='name'>collection</span>
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
<span class='type'>(<tt>ActiveRecord::Relation</tt>)</span>
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
—
|
|
270
|
+
<div class='inline'><p>The collection to paginate.</p>
|
|
271
|
+
</div>
|
|
272
|
+
|
|
273
|
+
</li>
|
|
274
|
+
|
|
275
|
+
<li>
|
|
276
|
+
|
|
277
|
+
<span class='name'>sort_field</span>
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
<span class='type'>(<tt>Symbol</tt>)</span>
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
—
|
|
285
|
+
<div class='inline'><p>The field to use for pagination.</p>
|
|
286
|
+
</div>
|
|
287
|
+
|
|
288
|
+
</li>
|
|
289
|
+
|
|
290
|
+
<li>
|
|
291
|
+
|
|
292
|
+
<span class='name'>sort_order</span>
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
<span class='type'>(<tt>Symbol</tt>)</span>
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
—
|
|
300
|
+
<div class='inline'><p>The order to use for pagination.</p>
|
|
301
|
+
</div>
|
|
302
|
+
|
|
303
|
+
</li>
|
|
304
|
+
|
|
305
|
+
</ul>
|
|
306
|
+
|
|
307
|
+
<p class="tag_title">Returns:</p>
|
|
308
|
+
<ul class="return">
|
|
309
|
+
|
|
310
|
+
<li>
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
<span class='type'>(<tt>ActiveRecord::Relation</tt>)</span>
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
—
|
|
318
|
+
<div class='inline'><p>The paginated collection.</p>
|
|
319
|
+
</div>
|
|
320
|
+
|
|
321
|
+
</li>
|
|
322
|
+
|
|
323
|
+
</ul>
|
|
324
|
+
|
|
325
|
+
</div><table class="source_code">
|
|
326
|
+
<tr>
|
|
327
|
+
<td>
|
|
328
|
+
<pre class="lines">
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
16
|
|
332
|
+
17
|
|
333
|
+
18
|
|
334
|
+
19
|
|
335
|
+
20
|
|
336
|
+
21
|
|
337
|
+
22
|
|
338
|
+
23
|
|
339
|
+
24
|
|
340
|
+
25
|
|
341
|
+
26
|
|
342
|
+
27
|
|
343
|
+
28
|
|
344
|
+
29
|
|
345
|
+
30
|
|
346
|
+
31
|
|
347
|
+
32</pre>
|
|
348
|
+
</td>
|
|
349
|
+
<td>
|
|
350
|
+
<pre class="code"><span class="info file"># File 'lib/apes/concerns/pagination.rb', line 16</span>
|
|
351
|
+
|
|
352
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_paginate'>paginate</span><span class='lparen'>(</span><span class='id identifier rubyid_collection'>collection</span><span class='comma'>,</span> <span class='label'>sort_field:</span> <span class='symbol'>:id</span><span class='comma'>,</span> <span class='label'>sort_order:</span> <span class='symbol'>:desc</span><span class='rparen'>)</span>
|
|
353
|
+
<span class='id identifier rubyid_direction'>direction</span> <span class='op'>=</span> <span class='ivar'>@cursor</span><span class='period'>.</span><span class='id identifier rubyid_direction'>direction</span>
|
|
354
|
+
<span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='ivar'>@cursor</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span>
|
|
355
|
+
|
|
356
|
+
<span class='comment'># Apply the query
|
|
357
|
+
</span> <span class='id identifier rubyid_collection'>collection</span> <span class='op'>=</span> <span class='id identifier rubyid_apply_value'>apply_value</span><span class='lparen'>(</span><span class='id identifier rubyid_collection'>collection</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_sort_field'>sort_field</span><span class='comma'>,</span> <span class='id identifier rubyid_sort_order'>sort_order</span><span class='rparen'>)</span>
|
|
358
|
+
<span class='id identifier rubyid_collection'>collection</span> <span class='op'>=</span> <span class='id identifier rubyid_collection'>collection</span><span class='period'>.</span><span class='id identifier rubyid_limit'>limit</span><span class='lparen'>(</span><span class='ivar'>@cursor</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_order'>order</span><span class='lparen'>(</span><span class='id identifier rubyid_sprintf'>sprintf</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%s %s</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_sort_field'>sort_field</span><span class='comma'>,</span> <span class='id identifier rubyid_sort_order'>sort_order</span><span class='period'>.</span><span class='id identifier rubyid_upcase'>upcase</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
|
359
|
+
|
|
360
|
+
<span class='comment'># If we're fetching previous we reverse the order to make sure we fetch the results adiacents to the previous request,
|
|
361
|
+
</span> <span class='comment'># then we reverse results to ensure the order requested
|
|
362
|
+
</span> <span class='kw'>if</span> <span class='id identifier rubyid_direction'>direction</span> <span class='op'>!=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>next</span><span class='tstring_end'>"</span></span>
|
|
363
|
+
<span class='id identifier rubyid_collection'>collection</span> <span class='op'>=</span> <span class='id identifier rubyid_collection'>collection</span><span class='period'>.</span><span class='id identifier rubyid_reverse_order'>reverse_order</span>
|
|
364
|
+
<span class='id identifier rubyid_collection'>collection</span> <span class='op'>=</span> <span class='id identifier rubyid_collection'>collection</span><span class='period'>.</span><span class='id identifier rubyid_reverse'>reverse</span>
|
|
365
|
+
<span class='kw'>end</span>
|
|
366
|
+
|
|
367
|
+
<span class='id identifier rubyid_collection'>collection</span>
|
|
368
|
+
<span class='kw'>end</span></pre>
|
|
369
|
+
</td>
|
|
370
|
+
</tr>
|
|
371
|
+
</table>
|
|
372
|
+
</div>
|
|
373
|
+
|
|
374
|
+
<div class="method_details ">
|
|
375
|
+
<h3 class="signature " id="pagination_field-instance_method">
|
|
376
|
+
|
|
377
|
+
- (<tt>Symbol</tt>) <strong>pagination_field</strong>
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
</h3><div class="docstring">
|
|
384
|
+
<div class="discussion">
|
|
385
|
+
<p>The field to use for pagination.</p>
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
</div>
|
|
389
|
+
</div>
|
|
390
|
+
<div class="tags">
|
|
391
|
+
|
|
392
|
+
<p class="tag_title">Returns:</p>
|
|
393
|
+
<ul class="return">
|
|
394
|
+
|
|
395
|
+
<li>
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
<span class='type'>(<tt>Symbol</tt>)</span>
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
—
|
|
403
|
+
<div class='inline'><p>The field to use for pagination.</p>
|
|
404
|
+
</div>
|
|
405
|
+
|
|
406
|
+
</li>
|
|
407
|
+
|
|
408
|
+
</ul>
|
|
409
|
+
|
|
410
|
+
</div><table class="source_code">
|
|
411
|
+
<tr>
|
|
412
|
+
<td>
|
|
413
|
+
<pre class="lines">
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
37
|
|
417
|
+
38
|
|
418
|
+
39</pre>
|
|
419
|
+
</td>
|
|
420
|
+
<td>
|
|
421
|
+
<pre class="code"><span class="info file"># File 'lib/apes/concerns/pagination.rb', line 37</span>
|
|
422
|
+
|
|
423
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_pagination_field'>pagination_field</span>
|
|
424
|
+
<span class='ivar'>@pagination_field</span> <span class='op'>||=</span> <span class='symbol'>:handle</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="pagination_skip?-instance_method">
|
|
433
|
+
|
|
434
|
+
- (<tt>Boolean</tt>) <strong>pagination_skip?</strong>
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
</h3><div class="docstring">
|
|
441
|
+
<div class="discussion">
|
|
442
|
+
<p>Whether to skip pagination. This is used by template generation.</p>
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
</div>
|
|
446
|
+
</div>
|
|
447
|
+
<div class="tags">
|
|
448
|
+
|
|
449
|
+
<p class="tag_title">Returns:</p>
|
|
450
|
+
<ul class="return">
|
|
451
|
+
|
|
452
|
+
<li>
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
—
|
|
460
|
+
<div class='inline'><p><code>true</code> if pagination must be skipped in template, <code>false</code> otherwise.</p>
|
|
461
|
+
</div>
|
|
462
|
+
|
|
463
|
+
</li>
|
|
464
|
+
|
|
465
|
+
</ul>
|
|
466
|
+
|
|
467
|
+
</div><table class="source_code">
|
|
468
|
+
<tr>
|
|
469
|
+
<td>
|
|
470
|
+
<pre class="lines">
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
44
|
|
474
|
+
45
|
|
475
|
+
46</pre>
|
|
476
|
+
</td>
|
|
477
|
+
<td>
|
|
478
|
+
<pre class="code"><span class="info file"># File 'lib/apes/concerns/pagination.rb', line 44</span>
|
|
479
|
+
|
|
480
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_pagination_skip?'>pagination_skip?</span>
|
|
481
|
+
<span class='ivar'>@skip_pagination</span>
|
|
482
|
+
<span class='kw'>end</span></pre>
|
|
483
|
+
</td>
|
|
484
|
+
</tr>
|
|
485
|
+
</table>
|
|
486
|
+
</div>
|
|
487
|
+
|
|
488
|
+
<div class="method_details ">
|
|
489
|
+
<h3 class="signature " id="pagination_supported?-instance_method">
|
|
490
|
+
|
|
491
|
+
- (<tt>Boolean</tt>) <strong>pagination_supported?</strong>
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
</h3><div class="docstring">
|
|
498
|
+
<div class="discussion">
|
|
499
|
+
<p>Checks if current collection supports pagination. This is used by template generation.</p>
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
</div>
|
|
503
|
+
</div>
|
|
504
|
+
<div class="tags">
|
|
505
|
+
|
|
506
|
+
<p class="tag_title">Returns:</p>
|
|
507
|
+
<ul class="return">
|
|
508
|
+
|
|
509
|
+
<li>
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
—
|
|
517
|
+
<div class='inline'><p><code>true</code> if pagination is supported, <code>false</code> otherwise.</p>
|
|
518
|
+
</div>
|
|
519
|
+
|
|
520
|
+
</li>
|
|
521
|
+
|
|
522
|
+
</ul>
|
|
523
|
+
|
|
524
|
+
</div><table class="source_code">
|
|
525
|
+
<tr>
|
|
526
|
+
<td>
|
|
527
|
+
<pre class="lines">
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
51
|
|
531
|
+
52
|
|
532
|
+
53</pre>
|
|
533
|
+
</td>
|
|
534
|
+
<td>
|
|
535
|
+
<pre class="code"><span class="info file"># File 'lib/apes/concerns/pagination.rb', line 51</span>
|
|
536
|
+
|
|
537
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_pagination_supported?'>pagination_supported?</span>
|
|
538
|
+
<span class='ivar'>@objects</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:first</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='ivar'>@objects</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:last</span><span class='rparen'>)</span>
|
|
539
|
+
<span class='kw'>end</span></pre>
|
|
540
|
+
</td>
|
|
541
|
+
</tr>
|
|
542
|
+
</table>
|
|
543
|
+
</div>
|
|
544
|
+
|
|
545
|
+
<div class="method_details ">
|
|
546
|
+
<h3 class="signature " id="pagination_url-instance_method">
|
|
547
|
+
|
|
548
|
+
- (<tt>String</tt>) <strong>pagination_url</strong>(page = nil)
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
|
|
552
|
+
|
|
553
|
+
|
|
554
|
+
</h3><div class="docstring">
|
|
555
|
+
<div class="discussion">
|
|
556
|
+
<p>Returns the URL a specific page of the current collection.</p>
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
</div>
|
|
560
|
+
</div>
|
|
561
|
+
<div class="tags">
|
|
562
|
+
<p class="tag_title">Parameters:</p>
|
|
563
|
+
<ul class="param">
|
|
564
|
+
|
|
565
|
+
<li>
|
|
566
|
+
|
|
567
|
+
<span class='name'>page</span>
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
<span class='type'>(<tt>Symbol</tt>)</span>
|
|
571
|
+
|
|
572
|
+
|
|
573
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
|
574
|
+
|
|
575
|
+
|
|
576
|
+
—
|
|
577
|
+
<div class='inline'><p>The page to return.</p>
|
|
578
|
+
</div>
|
|
579
|
+
|
|
580
|
+
</li>
|
|
581
|
+
|
|
582
|
+
</ul>
|
|
583
|
+
|
|
584
|
+
<p class="tag_title">Returns:</p>
|
|
585
|
+
<ul class="return">
|
|
586
|
+
|
|
587
|
+
<li>
|
|
588
|
+
|
|
589
|
+
|
|
590
|
+
<span class='type'>(<tt>String</tt>)</span>
|
|
591
|
+
|
|
592
|
+
|
|
593
|
+
|
|
594
|
+
—
|
|
595
|
+
<div class='inline'><p>The URL for a page of the current collection.</p>
|
|
596
|
+
</div>
|
|
597
|
+
|
|
598
|
+
</li>
|
|
599
|
+
|
|
600
|
+
</ul>
|
|
601
|
+
|
|
602
|
+
</div><table class="source_code">
|
|
603
|
+
<tr>
|
|
604
|
+
<td>
|
|
605
|
+
<pre class="lines">
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
59
|
|
609
|
+
60
|
|
610
|
+
61
|
|
611
|
+
62</pre>
|
|
612
|
+
</td>
|
|
613
|
+
<td>
|
|
614
|
+
<pre class="code"><span class="info file"># File 'lib/apes/concerns/pagination.rb', line 59</span>
|
|
615
|
+
|
|
616
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_pagination_url'>pagination_url</span><span class='lparen'>(</span><span class='id identifier rubyid_page'>page</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
|
617
|
+
<span class='id identifier rubyid_exist'>exist</span> <span class='op'>=</span> <span class='ivar'>@cursor</span><span class='period'>.</span><span class='id identifier rubyid_might_exist?'>might_exist?</span><span class='lparen'>(</span><span class='id identifier rubyid_page'>page</span><span class='comma'>,</span> <span class='ivar'>@objects</span><span class='rparen'>)</span>
|
|
618
|
+
<span class='id identifier rubyid_exist'>exist</span> <span class='op'>?</span> <span class='id identifier rubyid_url_for'>url_for</span><span class='lparen'>(</span><span class='id identifier rubyid_request'>request</span><span class='period'>.</span><span class='id identifier rubyid_params'>params</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='label'>page:</span> <span class='ivar'>@cursor</span><span class='period'>.</span><span class='id identifier rubyid_save'>save</span><span class='lparen'>(</span><span class='ivar'>@objects</span><span class='comma'>,</span> <span class='id identifier rubyid_page'>page</span><span class='comma'>,</span> <span class='label'>field:</span> <span class='id identifier rubyid_pagination_field'>pagination_field</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='label'>only_path:</span> <span class='kw'>false</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
|
619
|
+
<span class='kw'>end</span></pre>
|
|
620
|
+
</td>
|
|
621
|
+
</tr>
|
|
622
|
+
</table>
|
|
623
|
+
</div>
|
|
624
|
+
|
|
625
|
+
</div>
|
|
626
|
+
|
|
627
|
+
</div>
|
|
628
|
+
|
|
629
|
+
<div id="footer">
|
|
630
|
+
Generated on Sat Jun 4 12:41:53 2016 by
|
|
631
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
632
|
+
0.8.7.6 (ruby-2.3.0).
|
|
633
|
+
</div>
|
|
634
|
+
|
|
635
|
+
</body>
|
|
636
|
+
</html>
|