Skip to content

Commit

Permalink
Merge pull request #2 from mbuhot/patch-1
Browse files Browse the repository at this point in the history
Fix example without Repo in README
  • Loading branch information
stephenmoloney authored Feb 11, 2019
2 parents 6d968c8 + 68039b2 commit b2c7b80
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ library is also being used in the project and gives access to the pre-configured
def index(conn, params) do
config = maybe_put_default_config(params)

["C#", "C++", "Clojure", "Elixir", "Erlang", "Go", "JAVA", "JavaScript", "Lisp",
"PHP", "Perl", "Python", "Ruby", "Rust", "SQL"]
|> Enum.map(&(&1 <> " " <> "language"))
|> Scrivener.paginate(config)
page =
["C#", "C++", "Clojure", "Elixir", "Erlang", "Go", "JAVA", "JavaScript", "Lisp",
"PHP", "Perl", "Python", "Ruby", "Rust", "SQL"]
|> Enum.map(&(&1 <> " " <> "language"))
|> Scrivener.paginate(config)

render conn, :index,
people: page.entries,
Expand All @@ -59,10 +60,10 @@ defp maybe_put_default_config(_params), do: %Scrivener.Config{page_number: 1, pa
list = ["C#", "C++", "Clojure", "Elixir", "Erlang", "Go", "JAVA", "JavaScript", "Lisp",
"PHP", "Perl", "Python", "Ruby", "Rust", "SQL"]

MyApp.Repo.paginate(list, %Scrivener.Config{page_number: 1, page_size: 4}) # %Scrivener.Config{}
MyApp.Repo.paginate(list, page: 1, page_size: 4) # keyword list
MyApp.Repo.paginate(%{page: 1, page_size: 4}) # map
MyApp.Repo.paginate(%{page: 1}) # map with only page number (page_size defaults to 10)
Scrivener.paginate(list, %Scrivener.Config{page_number: 1, page_size: 4}) # %Scrivener.Config{}
Scrivener.paginate(list, page: 1, page_size: 4) # keyword list
Scrivener.paginate(list, %{page: 1, page_size: 4}) # map
Scrivener.paginate(list, %{page: 1}) # map with only page number (page_size defaults to 10)
```


Expand Down

0 comments on commit b2c7b80

Please sign in to comment.