feat(pastes): add page to view pastes

Signed-off-by: SphericalKat <amolele@gmail.com>
This commit is contained in:
sphericalkat committed 2021-08-13 05:47:13 +05:30
1 parent d818c7033a
commit c6c54347a7
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
+1
View File
@@ -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.
+1 -1
View File
@@ -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>