New registration page
This commit is contained in:
@@ -4,8 +4,4 @@ defmodule OsuuspuutarhaWeb.PageController do
|
|||||||
def index(conn, _params) do
|
def index(conn, _params) do
|
||||||
render(conn, "index.html")
|
render(conn, "index.html")
|
||||||
end
|
end
|
||||||
|
|
||||||
def welcome(conn, _params) do
|
|
||||||
render(conn, "welcome.html")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
27
lib/osuuspuutarha_web/live/order_live/registration.ex
Normal file
27
lib/osuuspuutarha_web/live/order_live/registration.ex
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
defmodule OsuuspuutarhaWeb.OrderLive.Registration do
|
||||||
|
use OsuuspuutarhaWeb, :live_view
|
||||||
|
|
||||||
|
alias Osuuspuutarha.Orders.Order
|
||||||
|
|
||||||
|
@impl true
|
||||||
|
def mount(_params, _session, socket) do
|
||||||
|
{:ok, socket}
|
||||||
|
end
|
||||||
|
|
||||||
|
@impl true
|
||||||
|
def handle_params(_, _, socket) do
|
||||||
|
{:noreply, apply_action(socket, socket.assigns.live_action)}
|
||||||
|
end
|
||||||
|
|
||||||
|
defp apply_action(socket, :index) do
|
||||||
|
socket
|
||||||
|
|> assign(:page_title, "Tilaukset")
|
||||||
|
|> assign(:order, nil)
|
||||||
|
end
|
||||||
|
|
||||||
|
defp apply_action(socket, :new) do
|
||||||
|
socket
|
||||||
|
|> assign(:page_title, "Satolaatikko tilaus")
|
||||||
|
|> assign(:order, %Order{})
|
||||||
|
end
|
||||||
|
end
|
||||||
26
lib/osuuspuutarha_web/live/order_live/registration.html.heex
Normal file
26
lib/osuuspuutarha_web/live/order_live/registration.html.heex
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<h2>Tervetuloa osuuspuutarhan jäseneksi</h2>
|
||||||
|
|
||||||
|
<%= if @live_action == :new do %>
|
||||||
|
<.modal return_to={Routes.order_registration_path(@socket, :index)}>
|
||||||
|
<.live_component
|
||||||
|
module={OsuuspuutarhaWeb.OrderLive.FormComponent}
|
||||||
|
id={:new}
|
||||||
|
title={@page_title}
|
||||||
|
submit_text="Lähetä tilaus"
|
||||||
|
action={@live_action}
|
||||||
|
order={@order}
|
||||||
|
return_to={Routes.order_registration_path(@socket, :index)}
|
||||||
|
/>
|
||||||
|
</.modal>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<p>Tarjouksemme ovat seuraavat</p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Asd</li>
|
||||||
|
<li>Qwe</li>
|
||||||
|
<li>Zxc</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h3>Voit lähteä mukaan alla olevasta linkistä</h3>
|
||||||
|
<%= link "Tilaa satolaatikko", to: Routes.order_registration_path(@socket, :new) %>
|
||||||
@@ -18,7 +18,6 @@ defmodule OsuuspuutarhaWeb.Router do
|
|||||||
pipe_through :browser
|
pipe_through :browser
|
||||||
|
|
||||||
get "/", PageController, :index
|
get "/", PageController, :index
|
||||||
get "/tervetuloa", PageController, :welcome
|
|
||||||
|
|
||||||
live "/tilaukset", OrderLive.Index, :index
|
live "/tilaukset", OrderLive.Index, :index
|
||||||
live "/tilaukset/uusi", OrderLive.Index, :new
|
live "/tilaukset/uusi", OrderLive.Index, :new
|
||||||
@@ -26,6 +25,9 @@ defmodule OsuuspuutarhaWeb.Router do
|
|||||||
|
|
||||||
live "/tilaukset/:id", OrderLive.Show, :show
|
live "/tilaukset/:id", OrderLive.Show, :show
|
||||||
live "/tilaukset/:id/nayta/muokkaa", OrderLive.Show, :edit
|
live "/tilaukset/:id/nayta/muokkaa", OrderLive.Show, :edit
|
||||||
|
|
||||||
|
live "/ilmoittautuminen", OrderLive.Registration, :index
|
||||||
|
live "/ilmoittautuminen/uusi", OrderLive.Registration, :new
|
||||||
end
|
end
|
||||||
|
|
||||||
# Other scopes may use custom stacks.
|
# Other scopes may use custom stacks.
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
<h2>Tervetuloa osuuspuutarhan jäseneksi</h2>
|
|
||||||
|
|
||||||
<p>Tarjouksemme ovat seuraavat</p>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>Asd</li>
|
|
||||||
<li>Qwe</li>
|
|
||||||
<li>Zxc</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<h3>Voit lähteä mukaan alla olevasta linkistä</h3>
|
|
||||||
<%= link "Liity jäseneksi", to: Routes.order_index_path(@conn, :new) %>
|
|
||||||
Reference in New Issue
Block a user