Sort landing page paragraphs.

This commit is contained in:
codevictory
2021-05-26 21:54:18 +03:00
parent f3777c1733
commit 5a85e51a01
2 changed files with 14 additions and 1 deletions

View File

@@ -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.

View File

@@ -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