From 0225aecadc20f841bb86dee865ecffae9b8eb8b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Veikko=20Lintuj=C3=A4rvi?= Date: Thu, 16 Mar 2023 21:41:42 +0200 Subject: [PATCH] New welcome page --- lib/osuuspuutarha_web/controllers/page_controller.ex | 4 ++++ .../live/order_live/form_component.html.heex | 4 ++-- lib/osuuspuutarha_web/live/order_live/index.ex | 2 ++ .../live/order_live/index.html.heex | 1 + lib/osuuspuutarha_web/router.ex | 1 + .../templates/page/welcome.html.heex | 12 ++++++++++++ 6 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 lib/osuuspuutarha_web/templates/page/welcome.html.heex diff --git a/lib/osuuspuutarha_web/controllers/page_controller.ex b/lib/osuuspuutarha_web/controllers/page_controller.ex index de7906a..8a7f556 100644 --- a/lib/osuuspuutarha_web/controllers/page_controller.ex +++ b/lib/osuuspuutarha_web/controllers/page_controller.ex @@ -4,4 +4,8 @@ defmodule OsuuspuutarhaWeb.PageController do def index(conn, _params) do render(conn, "index.html") end + + def welcome(conn, _params) do + render(conn, "welcome.html") + end end diff --git a/lib/osuuspuutarha_web/live/order_live/form_component.html.heex b/lib/osuuspuutarha_web/live/order_live/form_component.html.heex index f04488c..143e43b 100644 --- a/lib/osuuspuutarha_web/live/order_live/form_component.html.heex +++ b/lib/osuuspuutarha_web/live/order_live/form_component.html.heex @@ -9,7 +9,7 @@ phx-change="validate" phx-submit="save"> -<%= label f, :order_type, "Valitse tilausmuoto" %> + <%= label f, :order_type, "Valitse tilausmuoto" %> <%= select f, :order_type, Ecto.Enum.values(Osuuspuutarha.Orders.Order, :order_type), prompt: "Ei valintaa" %> <%= error_tag f, :order_type %> @@ -54,7 +54,7 @@ <%= error_tag f, :split_invoice %>
- <%= submit "Tallenna", phx_disable_with: "Tallennetaan..." %> + <%= submit @submit_text, phx_disable_with: "Tallennetaan..." %>
diff --git a/lib/osuuspuutarha_web/live/order_live/index.ex b/lib/osuuspuutarha_web/live/order_live/index.ex index 5bc6d24..b68e9ec 100644 --- a/lib/osuuspuutarha_web/live/order_live/index.ex +++ b/lib/osuuspuutarha_web/live/order_live/index.ex @@ -17,12 +17,14 @@ defmodule OsuuspuutarhaWeb.OrderLive.Index do defp apply_action(socket, :edit, %{"id" => id}) do socket |> assign(:page_title, "Muokkaa tilausta") + |> assign(:submit_text, "Tallenna") |> assign(:order, Orders.get_order!(id)) end defp apply_action(socket, :new, _params) do socket |> assign(:page_title, "Satolaatikko tilaus") + |> assign(:submit_text, "Lähetä") |> assign(:order, %Order{}) end diff --git a/lib/osuuspuutarha_web/live/order_live/index.html.heex b/lib/osuuspuutarha_web/live/order_live/index.html.heex index 16be4e9..d9863f8 100644 --- a/lib/osuuspuutarha_web/live/order_live/index.html.heex +++ b/lib/osuuspuutarha_web/live/order_live/index.html.heex @@ -6,6 +6,7 @@ module={OsuuspuutarhaWeb.OrderLive.FormComponent} id={@order.id || :new} title={@page_title} + submit_text={@submit_text} action={@live_action} order={@order} return_to={Routes.order_index_path(@socket, :index)} diff --git a/lib/osuuspuutarha_web/router.ex b/lib/osuuspuutarha_web/router.ex index 983a625..4eebcee 100644 --- a/lib/osuuspuutarha_web/router.ex +++ b/lib/osuuspuutarha_web/router.ex @@ -18,6 +18,7 @@ defmodule OsuuspuutarhaWeb.Router do pipe_through :browser get "/", PageController, :index + get "/tervetuloa", PageController, :welcome live "/tilaukset", OrderLive.Index, :index live "/tilaukset/uusi", OrderLive.Index, :new diff --git a/lib/osuuspuutarha_web/templates/page/welcome.html.heex b/lib/osuuspuutarha_web/templates/page/welcome.html.heex new file mode 100644 index 0000000..50f493b --- /dev/null +++ b/lib/osuuspuutarha_web/templates/page/welcome.html.heex @@ -0,0 +1,12 @@ +

Tervetuloa osuuspuutarhan jäseneksi

+ +

Tarjouksemme ovat seuraavat

+ + + +

Voit lähteä mukaan alla olevasta linkistä

+<%= link "Liity jäseneksi", to: Routes.order_index_path(@conn, :new) %> \ No newline at end of file