live page working, need to send data
This commit is contained in:
parent
5d304e3d1f
commit
f26d6321f2
6 changed files with 57 additions and 11 deletions
|
|
@ -10,4 +10,8 @@ defmodule AprsWeb.PageController do
|
||||||
def map(conn, _params) do
|
def map(conn, _params) do
|
||||||
render(conn, :map, layout: false)
|
render(conn, :map, layout: false)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def packets(conn, _params) do
|
||||||
|
render(conn, :packets)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
1
lib/aprs_web/controllers/page_html/packets.html.heex
Normal file
1
lib/aprs_web/controllers/page_html/packets.html.heex
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
<h1>Packets</h1>
|
||||||
43
lib/aprs_web/live/packets_live/index.ex
Normal file
43
lib/aprs_web/live/packets_live/index.ex
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
defmodule AprsWeb.PacketsLive.Index do
|
||||||
|
use AprsWeb, :live_view
|
||||||
|
|
||||||
|
@impl true
|
||||||
|
def mount(_params, _session, socket) do
|
||||||
|
{:ok, assign(socket, :packets, [])}
|
||||||
|
end
|
||||||
|
|
||||||
|
# @impl true
|
||||||
|
# def handle_params(params, _url, socket) do
|
||||||
|
# {:noreply, apply_action(socket, socket.assigns.live_action, params)}
|
||||||
|
# end
|
||||||
|
|
||||||
|
# defp apply_action(socket, :edit, %{"id" => id}) do
|
||||||
|
# socket
|
||||||
|
# |> assign(:page_title, "Edit Book")
|
||||||
|
# |> assign(:book, Books.get_book!(id))
|
||||||
|
# end
|
||||||
|
|
||||||
|
# defp apply_action(socket, :new, _params) do
|
||||||
|
# socket
|
||||||
|
# |> assign(:page_title, "New Book")
|
||||||
|
# |> assign(:book, %Book{})
|
||||||
|
# end
|
||||||
|
|
||||||
|
# defp apply_action(socket, :index, _params) do
|
||||||
|
# socket
|
||||||
|
# |> assign(:page_title, "Listing Books")
|
||||||
|
# |> assign(:book, nil)
|
||||||
|
# end
|
||||||
|
|
||||||
|
# @impl true
|
||||||
|
# def handle_event("delete", %{"id" => id}, socket) do
|
||||||
|
# book = Books.get_book!(id)
|
||||||
|
# {:ok, _} = Books.delete_book(book)
|
||||||
|
|
||||||
|
# {:noreply, assign(socket, :books, list_books())}
|
||||||
|
# end
|
||||||
|
|
||||||
|
# defp list_books do
|
||||||
|
# Books.list_books()
|
||||||
|
# end
|
||||||
|
end
|
||||||
7
lib/aprs_web/live/packets_live/index.html.heex
Normal file
7
lib/aprs_web/live/packets_live/index.html.heex
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
<.header>
|
||||||
|
Packets
|
||||||
|
</.header>
|
||||||
|
|
||||||
|
<.table id="packets" rows={@packets}>
|
||||||
|
<:col :let={packet} label="packet"><%= packet %></:col>
|
||||||
|
</.table>
|
||||||
|
|
@ -22,6 +22,8 @@ defmodule AprsWeb.Router do
|
||||||
|
|
||||||
get "/", PageController, :home
|
get "/", PageController, :home
|
||||||
get "/map", PageController, :map
|
get "/map", PageController, :map
|
||||||
|
|
||||||
|
live "/packets", PacketsLive.Index, :index
|
||||||
end
|
end
|
||||||
|
|
||||||
# Other scopes may use custom stacks.
|
# Other scopes may use custom stacks.
|
||||||
|
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
defimpl Inspect, for: Parser.Types.Position do
|
|
||||||
alias Parser.Types.Position
|
|
||||||
|
|
||||||
def inspect(d, %{:structs => false} = opts) do
|
|
||||||
Inspect.Algebra.to_doc(d, opts)
|
|
||||||
end
|
|
||||||
|
|
||||||
def inspect(d, _opts) do
|
|
||||||
"#{Position.to_string(d)}"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
Loading…
Add table
Reference in a new issue