Skip to content

Commit

Permalink
switch to live view
Browse files Browse the repository at this point in the history
  • Loading branch information
d-led committed Mar 10, 2022
1 parent c1c3ba4 commit 0292d82
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 21 deletions.
7 changes: 0 additions & 7 deletions lib/dzen_web/controllers/page_controller.ex

This file was deleted.

26 changes: 26 additions & 0 deletions lib/dzen_web/live/page_controller_live.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
defmodule DzenWeb.PageControllerLive do
use Phoenix.LiveView

def render(assigns) do
~H"""
<section class="phx-hero">
<h1><%= @total_count %></h1>
<br>
<h1><%= @active_count %></h1>
</section>
<section class="row">
<article class="column">
.
</article>
</section>
"""
end

def mount(_params, _user, socket) do
socket = socket
|> assign(:total_count, 1)
|> assign(:active_count, 1)
{:ok, socket }
end
end
2 changes: 1 addition & 1 deletion lib/dzen_web/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ defmodule DzenWeb.Router do
scope "/", DzenWeb do
pipe_through :browser

get "/", PageController, :index
live "/", PageControllerLive
end

# Other scopes may use custom stacks.
Expand Down
2 changes: 0 additions & 2 deletions lib/dzen_web/templates/layout/root.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
<script defer phx-track-static type="text/javascript" src={Routes.static_path(@conn, "/assets/app.js")}></script>
</head>
<body>
<header>
</header>
<%= @inner_content %>
</body>
</html>
11 changes: 0 additions & 11 deletions lib/dzen_web/templates/page/index.html.heex

This file was deleted.

0 comments on commit 0292d82

Please sign in to comment.