alphabetical_paginate 1.3.0 → 1.4.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/README.md
CHANGED
@@ -26,7 +26,7 @@ And then execute:
|
|
26
26
|
Basic Pagination is as simple as adding a few lines to the controller and the view.
|
27
27
|
|
28
28
|
### Controller
|
29
|
-
You simply need to call alpha_paginate on the desired
|
29
|
+
You simply need to call alpha_paginate on the desired Active Record Collection (i.e. `User.alpha_paginate`) or on any array (`User.all.alpha_paginate`). This method takes two parameters, the first always being `params[:letter]` and the second being an optional options hash.
|
30
30
|
|
31
31
|
Also, it takes a block in which you can specify the field you wish to paginate by (it can even be in another table). It returns the paginated subset of the collection, sorted by the pagination field. The method returns two values (the paginated array subsection, and an options hash), both of which must be stored as class variables.
|
32
32
|
|
@@ -39,7 +39,7 @@ It has a :db_mode parameter which tells the gem to perform low level SQL queries
|
|
39
39
|
class UsersController < ApplicationController
|
40
40
|
|
41
41
|
def index
|
42
|
-
@users, @alphaParams = User.
|
42
|
+
@users, @alphaParams = User.alpha_paginate(params[:letter], {db_mode: true, db_field: "name"})
|
43
43
|
end
|
44
44
|
|
45
45
|
...
|
@@ -35,7 +35,7 @@ module AlphabeticalPaginate
|
|
35
35
|
|
36
36
|
params[:availableLetters].each do |l|
|
37
37
|
if l == params[:currentField]
|
38
|
-
links += '<li class="active"><a href="?letter=' + l + '" data-letter="' + l + '">' + l +
|
38
|
+
links += '<li class="active"><a href="?letter=' + l + '" data-letter="' + l + '">' + l + '</a></li>'
|
39
39
|
else
|
40
40
|
links += '<li><a href="?letter=' + l + '" data-letter="' + l + '">' + l + "</a></li>"
|
41
41
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alphabetical_paginate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-08-
|
12
|
+
date: 2013-08-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|