diff options
Diffstat (limited to 'lib/waev_web')
-rw-r--r-- | lib/waev_web/controllers/exports_controller.ex | 11 | ||||
-rw-r--r-- | lib/waev_web/templates/exports/show.html.eex | 36 |
2 files changed, 21 insertions, 26 deletions
diff --git a/lib/waev_web/controllers/exports_controller.ex b/lib/waev_web/controllers/exports_controller.ex index a50896e..a3dde48 100644 --- a/lib/waev_web/controllers/exports_controller.ex +++ b/lib/waev_web/controllers/exports_controller.ex @@ -2,6 +2,15 @@ defmodule WaevWeb.ExportsController do use WaevWeb, :controller def show(conn, %{"id" => id}) do - render(conn, "show.html", id: id) + case Waev.Export.get(id) do + {:ok, export} -> + render(conn, "show.html", id: id, export: export) + + :error -> + conn + |> put_status(:not_found) + |> put_view(WaevWeb.ErrorView) + |> render("404.html") + end end end diff --git a/lib/waev_web/templates/exports/show.html.eex b/lib/waev_web/templates/exports/show.html.eex index 4351a17..4f0e3f5 100644 --- a/lib/waev_web/templates/exports/show.html.eex +++ b/lib/waev_web/templates/exports/show.html.eex @@ -3,33 +3,19 @@ ID: <%= @id %> <section class="phx-hero"> <section class="row"> <article class="column"> - <h2>Left</h2> - <ul> - <li> - <a href="#">Link 1</a> - </li> - <li> - Text 2 - </li> - <li> - Text 3 - </li> - </ul> + <h2><%= @export.left %></h2> </article> <article class="column"> - <h2>Right</h2> - <ul> - <li> - <a href="#">Link 1</a> - </li> - <li> - Text 2 - </li> - <li> - Text 3 - </li> - </ul> + <h2><%= @export.right %></h2> </article> </section> + <%= for message <- @export.messages do %> + <section class="row"> + <article class="column"> + <%= message.text %> + </article> + <article class="column"> + </article> + </section> + <% end %> </section> - |