fixes + lightbulb
This commit is contained in:
parent
90d0f64f67
commit
9755373c8f
|
@ -0,0 +1,16 @@
|
||||||
|
defmodule PokemonCoutureWeb.ClothesTrackerLive do
|
||||||
|
use PokemonCoutureWeb, :live_view
|
||||||
|
|
||||||
|
def mount(_params, _session, socket) do
|
||||||
|
socket = assign(socket, :light_bulb_status, "off")
|
||||||
|
{:ok, socket}
|
||||||
|
end
|
||||||
|
|
||||||
|
def handle_event("on", _value, socket) do
|
||||||
|
socket =
|
||||||
|
socket
|
||||||
|
|> assign(:light_bulb_status, "on")
|
||||||
|
|
||||||
|
{:noreply, socket}
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,2 @@
|
||||||
|
<h1>The light is <%= @light_bulb_status %>.</h1>
|
||||||
|
<button phx-click="on">On</button>
|
|
@ -23,6 +23,7 @@ defmodule PokemonCoutureWeb.Router do
|
||||||
|
|
||||||
get "/", PageController, :index
|
get "/", PageController, :index
|
||||||
resources "/clothes", ClothesController
|
resources "/clothes", ClothesController
|
||||||
|
live "/tracker", ClothesTrackerLive
|
||||||
end
|
end
|
||||||
|
|
||||||
# Other scopes may use custom stacks.
|
# Other scopes may use custom stacks.
|
||||||
|
|
|
@ -1,35 +1 @@
|
||||||
<!DOCTYPE html>
|
<%= @inner_content %>
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8"/>
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
|
||||||
<title>PokemonCouture · Phoenix Framework</title>
|
|
||||||
<link rel="stylesheet" href="<%= Routes.static_path(@conn, "/css/app.css") %>"/>
|
|
||||||
<%= csrf_meta_tag() %>
|
|
||||||
<script defer type="text/javascript" src="<%= Routes.static_path(@conn, "/js/app.js") %>"></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<header>
|
|
||||||
<section class="container">
|
|
||||||
<nav role="navigation">
|
|
||||||
<ul>
|
|
||||||
<li><a href="https://hexdocs.pm/phoenix/overview.html">Get Started</a></li>
|
|
||||||
<%= if function_exported?(Routes, :live_dashboard_path, 2) do %>
|
|
||||||
<li><%= link "LiveDashboard", to: Routes.live_dashboard_path(@conn, :home) %></li>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
|
||||||
<%= render "_user_menu.html", assigns %>
|
|
||||||
</nav>
|
|
||||||
<a href="http://localhost:4000/" class="phx-logo"> <!-- TODO: needs a way to show the proper link -->
|
|
||||||
<img src="<%= Routes.static_path(@conn, "/images/phoenix.png") %>" alt="Phoenix Framework Logo"/>
|
|
||||||
</a>
|
|
||||||
</section>
|
|
||||||
</header>
|
|
||||||
<main role="main" class="container">
|
|
||||||
<p class="alert alert-info" role="alert"><%= get_flash(@conn, :info) %></p>
|
|
||||||
<p class="alert alert-danger" role="alert"><%= get_flash(@conn, :error) %></p>
|
|
||||||
<%= @inner_content %>
|
|
||||||
</main>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
|
@ -1,35 +1 @@
|
||||||
<!DOCTYPE html>
|
<%= @inner_content %>
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8"/>
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
|
||||||
<title>PokemonCouture · Phoenix Framework</title>
|
|
||||||
<link rel="stylesheet" href="<%= Routes.static_path(@socket, "/css/app.css") %>"/>
|
|
||||||
<%= csrf_meta_tag() %>
|
|
||||||
<script defer type="text/javascript" src="<%= Routes.static_path(@socket, "/js/app.js") %>"></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<header>
|
|
||||||
<section class="container">
|
|
||||||
<nav role="navigation">
|
|
||||||
<ul>
|
|
||||||
<li><a href="https://hexdocs.pm/phoenix/overview.html">Get Started</a></li>
|
|
||||||
<%= if function_exported?(Routes, :live_dashboard_path, 2) do %>
|
|
||||||
<li><%= link "LiveDashboard", to: Routes.live_dashboard_path(@socket, :home) %></li>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
|
||||||
<%= render "_user_menu.html", assigns %>
|
|
||||||
</nav>
|
|
||||||
<a href="http://localhost:4000/" class="phx-logo"> <!-- TODO: needs a way to show the proper link -->
|
|
||||||
<img src="<%= Routes.static_path(@socket, "/images/phoenix.png") %>" alt="Phoenix Framework Logo"/>
|
|
||||||
</a>
|
|
||||||
</section>
|
|
||||||
</header>
|
|
||||||
<main role="main" class="container">
|
|
||||||
<p class="alert alert-info" role="alert"><%= get_flash(@socket, :info) %></p>
|
|
||||||
<p class="alert alert-danger" role="alert"><%= get_flash(@socket, :error) %></p>
|
|
||||||
<%= @inner_content %>
|
|
||||||
</main>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
|
@ -1,12 +1,35 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<%= csrf_meta_tag() %>
|
<meta charset="utf-8"/>
|
||||||
<%= live_title_tag assigns[:page_title] || "PokemonCouture · Phoenix Framework" %>
|
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
|
<title>PokemonCouture · Phoenix Framework</title>
|
||||||
<link rel="stylesheet" href="<%= Routes.static_path(@conn, "/css/app.css") %>"/>
|
<link rel="stylesheet" href="<%= Routes.static_path(@conn, "/css/app.css") %>"/>
|
||||||
|
<%= csrf_meta_tag() %>
|
||||||
<script defer type="text/javascript" src="<%= Routes.static_path(@conn, "/js/app.js") %>"></script>
|
<script defer type="text/javascript" src="<%= Routes.static_path(@conn, "/js/app.js") %>"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<header>
|
||||||
|
<section class="container">
|
||||||
|
<nav role="navigation">
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://hexdocs.pm/phoenix/overview.html">Get Started</a></li>
|
||||||
|
<%= if function_exported?(Routes, :live_dashboard_path, 2) do %>
|
||||||
|
<li><%= link "LiveDashboard", to: Routes.live_dashboard_path(@conn, :home) %></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
<%= render "_user_menu.html", assigns %>
|
||||||
|
</nav>
|
||||||
|
<a href="http://localhost:4000/" class="phx-logo"> <!-- TODO: needs a way to show the proper link -->
|
||||||
|
<img src="<%= Routes.static_path(@conn, "/images/phoenix.png") %>" alt="Phoenix Framework Logo"/>
|
||||||
|
</a>
|
||||||
|
</section>
|
||||||
|
</header>
|
||||||
|
<main role="main" class="container">
|
||||||
|
<p class="alert alert-info" role="alert"><%= get_flash(@conn, :info) %></p>
|
||||||
|
<p class="alert alert-danger" role="alert"><%= get_flash(@conn, :error) %></p>
|
||||||
<%= @inner_content %>
|
<%= @inner_content %>
|
||||||
|
</main>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue