You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+28-30
Original file line number
Diff line number
Diff line change
@@ -5,29 +5,30 @@ allows the pagination of a list of elements.
5
5
6
6
## Features
7
7
8
-
1. Scrivener.List extends the protocol `Scrivener.Paginater.paginate/2` from the [scrivener](https://github.com/drewolson/scrivener) library.
9
-
2. Scrivener.List also extends the function `MyApp.Repo.paginate/2` from the [scrivener_ecto](https://github.com/drewolson/scrivener_ecto) library.
8
+
1. Scrivener.List extends the protocol `Scrivener.Paginater.paginate/2` from the [scrivener](https://github.com/drewolson/scrivener) library.
9
+
1. Scrivener.List also extends the function `MyApp.Repo.paginate/2` from the [scrivener_ecto](https://github.com/drewolson/scrivener_ecto) library.
10
10
11
-
Using the second feature is entirely optional. It is provided as a convenience where the [scrivener_ecto](https://github.com/drewolson/scrivener_ecto)
12
-
library is also being used in the project and gives access to the pre-configured `MyApp.Repo` module.
13
-
11
+
Using the second feature is entirely optional. It's provided as a convenience where the [scrivener_ecto](https://github.com/drewolson/scrivener_ecto)
12
+
library is also being used in the project and gives access to the
13
+
pre-configured `MyApp.Repo` module.
14
14
15
15
## Usage
16
16
17
17
## 1. Usage without a Repo module
18
18
19
+
```elixir
20
+
Scrivener.paginate(list, config)
21
+
```
19
22
20
-
### Function
21
-
22
-
```Scrivener.paginate(list, config)```
23
+
### Arguments (without a repo)
23
24
24
-
### Arguments
25
+
-```list```: A list of elements to be paginated
25
26
26
-
-```list```: A list of elements to be paginated
27
-
-```config```: A configuration object with the pagination details. Can be in any of the following formats:
`max_page_size`**can** be configured with method 1. See [Scrivener.Ecto](https://github.com/drewolson/scrivener_ecto).
96
97
97
98
### Example
98
99
99
100
Example based on [scrivener_ecto](https://github.com/drewolson/scrivener_ecto) readme.
100
101
101
-
102
102
```elixir
103
103
defindex(conn, params) do
104
104
%{age: age, name: name} = params["search"]
@@ -120,7 +120,6 @@ def index(conn, params) do
120
120
end
121
121
```
122
122
123
-
124
123
## Installation
125
124
126
125
Add [scrivener_list](https://hex.pm/packages/scrivener_list) to your list of dependencies in `mix.exs`:
@@ -133,18 +132,17 @@ def deps do
133
132
end
134
133
```
135
134
136
-
137
135
## Tests
138
136
139
137
```shell
140
138
mix test
141
139
```
142
140
143
-
144
141
## Acknowledgements
145
142
146
-
Thanks to [Drew Olson](https://github.com/drewolson) for helping with this, particularly the introduction of the [protocol](http://blog.drewolson.org/extensible-design-with-protocols/).
147
-
143
+
The introduction of the [protocol](http://blog.drewolson.org/extensible-design-with-protocols/)
144
+
for scrivener enabled the separation of this package into it's own
0 commit comments