Sort landing page paragraphs.
This commit is contained in:
@@ -21,6 +21,19 @@ defmodule Runosaari.Pages do
|
||||
Repo.all(Index)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Returns the list of paragraphs sorted by seqnum.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> list_sorted_index_paragraphs()
|
||||
[%Index{}, ...]
|
||||
|
||||
"""
|
||||
def list_sorted_index_paragraphs do
|
||||
Repo.all(Index |> order_by(:seqnum))
|
||||
end
|
||||
|
||||
@doc """
|
||||
Gets a single index.
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ defmodule RunosaariWeb.IndexController do
|
||||
alias Runosaari.Pages.Index
|
||||
|
||||
def index(conn, _params) do
|
||||
index_paragraphs = Pages.list_index_paragraphs()
|
||||
index_paragraphs = Pages.list_sorted_index_paragraphs()
|
||||
render(conn, "index.html", index_paragraphs: index_paragraphs)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user