feat(pastes): add page to view pastes
Signed-off-by: SphericalKat <amolele@gmail.com>
This commit is contained in:
6 files changed
+23
-2
No files matched your search
@@ -1,7 +1,15 @@
|
||||
defmodule KetbinWeb.PageController do
|
||||
use KetbinWeb, :controller
|
||||
|
||||
alias Ketbin.Pastes
|
||||
alias Ketbin.Pastes.Paste
|
||||
|
||||
def index(conn, _params) do
|
||||
render(conn, "index.html")
|
||||
end
|
||||
|
||||
def show(conn, %{"id" => id}) do
|
||||
paste = Pastes.get_paste!(id)
|
||||
render(conn, "show.html", paste: paste)
|
||||
end
|
||||
end
|
||||
@@ -20,6 +20,7 @@ defmodule KetbinWeb.Router do
|
||||
pipe_through :browser
|
||||
|
||||
get "/", PageController, :index
|
||||
get "/:id", PageController, :show
|
||||
end
|
||||
|
||||
# Other scopes may use custom stacks.
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
</nav>
|
||||
|
||||
</header>
|
||||
<main role="main">
|
||||
<main class="w-full h-full bg-light-grey" role="main">
|
||||
<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 %>
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
|
||||
<pre class="py-6">
|
||||
<code><%= @paste.content %></code>
|
||||
</pre>
|
||||
Reference in new issue
Block a user