From ffc0bb5dab06874f2737a3def62835e45e0cd676 Mon Sep 17 00:00:00 2001 From: Guillermo Ramos Date: Tue, 4 Feb 2020 17:06:22 +0100 Subject: Parse exports --- lib/waev_web/controllers/exports_controller.ex | 11 +++++++- lib/waev_web/templates/exports/show.html.eex | 36 ++++++++------------------ 2 files changed, 21 insertions(+), 26 deletions(-) (limited to 'lib/waev_web') 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 %>
-

Left

-
    -
  • - Link 1 -
  • -
  • - Text 2 -
  • -
  • - Text 3 -
  • -
+

<%= @export.left %>

-

Right

-
    -
  • - Link 1 -
  • -
  • - Text 2 -
  • -
  • - Text 3 -
  • -
+

<%= @export.right %>

+ <%= for message <- @export.messages do %> +
+
+ <%= message.text %> +
+
+
+
+ <% end %>
- -- cgit v1.2.3