needs css..
This commit is contained in:
parent
2c18bc9520
commit
302c9ec6a9
|
@ -26,6 +26,10 @@ defmodule Farmbot.Target.Bootstrap.Configurator.Router do
|
|||
render_page(conn, "firmware")
|
||||
end
|
||||
|
||||
get "/credentials" do
|
||||
render_page(conn, "credentials")
|
||||
end
|
||||
|
||||
post "/configure_network" do
|
||||
{:ok, _, conn} = read_body conn
|
||||
sorted = conn.body_params |> sort_network_configs
|
||||
|
@ -50,6 +54,25 @@ defmodule Farmbot.Target.Bootstrap.Configurator.Router do
|
|||
|
||||
defp sort_network_configs([], acc), do: acc
|
||||
|
||||
post "/configure_firmware" do
|
||||
{:ok, _, conn} = read_body conn
|
||||
case conn.body_params do
|
||||
%{"firmware_hardware" => hw} when hw in ["arduino", "farmduino"] ->
|
||||
#TODO Flash firmware here.
|
||||
redir(conn, "/credentials")
|
||||
_ -> send_resp(conn, 500, "Bad firmware_hardware!")
|
||||
end
|
||||
end
|
||||
|
||||
post "/configure_credentials" do
|
||||
{:ok, _, conn} = read_body conn
|
||||
case conn.body_params do
|
||||
%{"email" => email, "password" => pass} ->
|
||||
# TODO(connor) save email and pass into db
|
||||
render_page(conn, "finish")
|
||||
_ -> send_resp(conn, 500, "invalid request.")
|
||||
end
|
||||
end
|
||||
|
||||
match _, do: send_resp(conn, 404, "Page not found")
|
||||
|
||||
|
|
1
priv/static/.gitignore
vendored
1
priv/static/.gitignore
vendored
|
@ -6,3 +6,4 @@
|
|||
!farmware_schema.json
|
||||
!templates
|
||||
!templates/*
|
||||
!styles.css
|
||||
|
|
0
priv/static/styles.css
Normal file
0
priv/static/styles.css
Normal file
16
priv/static/templates/credentials.html.eex
Normal file
16
priv/static/templates/credentials.html.eex
Normal file
|
@ -0,0 +1,16 @@
|
|||
<html>
|
||||
<head>
|
||||
<title> Configure your Farmbot account </title>
|
||||
<link rel="styles.css">
|
||||
</head>
|
||||
<body>
|
||||
<form method=post action=configure_credentials>
|
||||
<fieldset>
|
||||
<legend> Farmbot Account settings </legend>
|
||||
Email: <input type=email name=email>
|
||||
Password: <input type=password name=password>
|
||||
<input type=submit>
|
||||
</fieldset>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
9
priv/static/templates/finish.html.eex
Normal file
9
priv/static/templates/finish.html.eex
Normal file
|
@ -0,0 +1,9 @@
|
|||
<html>
|
||||
<head>
|
||||
<title> Your all done! </title>
|
||||
</head>
|
||||
<body>
|
||||
You're all set. Farmbot will now reboot. It will reboot if any configs are
|
||||
incorrect.
|
||||
</body>
|
||||
</html>
|
|
@ -4,6 +4,14 @@
|
|||
</head>
|
||||
|
||||
<body>
|
||||
YAY
|
||||
<form action=configure_firmware method=post>
|
||||
<fieldset>
|
||||
<select name=firmware_hardware>
|
||||
<option value="arduino"> Arduino + Ramps </option>
|
||||
<option value="farmduino"> Farmduino </option>
|
||||
</select>
|
||||
</fieldset>
|
||||
<input type=submit>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<title> Configure your Farmbot </title>
|
||||
<link rel="/styles.css">
|
||||
</head>
|
||||
<body>
|
||||
Get ready to configure your farmbot!
|
||||
|
|
Loading…
Reference in a new issue