feat(pastes): add page to view pastes
Signed-off-by: SphericalKat <amolele@gmail.com>
This commit is contained in:
parent
d818c7033a
commit
c6c54347a7
@ -6,7 +6,6 @@
|
||||
|
||||
* {
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
background-color: #1a1a1a;
|
||||
color: white;
|
||||
}
|
||||
|
||||
@ -14,6 +13,14 @@ a:hover {
|
||||
@apply text-amber;
|
||||
}
|
||||
|
||||
html, body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
header {
|
||||
background-color: #1a1a1a
|
||||
}
|
||||
|
||||
@import "./phoenix.css";
|
||||
|
||||
|
@ -10,6 +10,7 @@ module.exports = {
|
||||
extend: {
|
||||
colors: {
|
||||
amber: '#ff9800',
|
||||
'light-grey': '#212121',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -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 %>
|
||||
|
4
lib/ketbin_web/templates/page/show.html.eex
Normal file
4
lib/ketbin_web/templates/page/show.html.eex
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
<pre class="py-6">
|
||||
<code><%= @paste.content %></code>
|
||||
</pre>
|
Loading…
Reference in New Issue
Block a user