chore(styles): clean up unused styles
Signed-off-by: SphericalKat <amolele@gmail.com>
This commit is contained in:
parent
f411017280
commit
aa86d9a4b9
@ -3,61 +3,25 @@
|
||||
@import "tailwindcss/components";
|
||||
@import "tailwindcss/utilities";
|
||||
|
||||
|
||||
* {
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
color: white;
|
||||
font-family: "JetBrains Mono", monospace;
|
||||
color: white;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
@apply text-amber;
|
||||
html,
|
||||
body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
html, body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
a:hover {
|
||||
@apply text-amber;
|
||||
}
|
||||
|
||||
header {
|
||||
background-color: #1a1a1a
|
||||
background-color: #1a1a1a;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
}
|
||||
|
||||
@import "./phoenix.css";
|
||||
|
||||
/* Alerts and form errors */
|
||||
.alert {
|
||||
padding: 15px;
|
||||
margin-bottom: 20px;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.alert-info {
|
||||
color: #31708f;
|
||||
background-color: #d9edf7;
|
||||
border-color: #bce8f1;
|
||||
}
|
||||
.alert-warning {
|
||||
color: #8a6d3b;
|
||||
background-color: #fcf8e3;
|
||||
border-color: #faebcc;
|
||||
}
|
||||
.alert-danger {
|
||||
color: #a94442;
|
||||
background-color: #f2dede;
|
||||
border-color: #ebccd1;
|
||||
}
|
||||
.alert p {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.alert:empty {
|
||||
display: none;
|
||||
}
|
||||
.invalid-feedback {
|
||||
color: #a94442;
|
||||
display: block;
|
||||
margin: -1rem 0 2rem;
|
||||
font-family: "JetBrains Mono", monospace;
|
||||
}
|
||||
|
@ -11,11 +11,11 @@ defmodule KetbinWeb.PageController do
|
||||
end
|
||||
|
||||
def show(conn, %{"id" => id}) do
|
||||
paste = Pastes.get_paste!(id)
|
||||
paste = Pastes.get_paste!(id) # fetch paste from db
|
||||
|
||||
if paste.is_url do
|
||||
if paste.is_url do # paste is a url, redirect
|
||||
redirect(conn, external: paste.content)
|
||||
else
|
||||
else # regular paste, show content
|
||||
render(conn, "show.html", paste: paste)
|
||||
end
|
||||
end
|
||||
@ -26,27 +26,31 @@ defmodule KetbinWeb.PageController do
|
||||
end
|
||||
|
||||
def create(conn, %{"paste" => paste_params}) do
|
||||
# generate phonetic key
|
||||
id = Utils.generate_key()
|
||||
|
||||
# check if content is a url
|
||||
is_url =
|
||||
Map.get(paste_params, "content")
|
||||
|> Utils.is_url?()
|
||||
|
||||
# put id and is_url values into changeset
|
||||
paste_params =
|
||||
Map.put(paste_params, "id", id)
|
||||
|> Map.put("is_url", is_url)
|
||||
|
||||
# attempt to create a paste
|
||||
case Pastes.create_paste(paste_params) do
|
||||
{:ok, paste} ->
|
||||
{:ok, paste} -> # all good, redirect
|
||||
unless is_url do
|
||||
conn
|
||||
|> redirect(to: Routes.page_path(conn, :show, paste))
|
||||
|> redirect(to: Routes.page_path(conn, :show, paste)) # is a regular paste, take to regular route
|
||||
else
|
||||
conn
|
||||
|> redirect(to: Routes.page_path(conn, :showlink, paste))
|
||||
|> redirect(to: Routes.page_path(conn, :showlink, paste)) # is a url, take to route with /v/ prefix
|
||||
end
|
||||
|
||||
{:error, %Ecto.Changeset{} = changeset} ->
|
||||
{:error, %Ecto.Changeset{} = changeset} -> # something went wrong, bail
|
||||
render(conn, "index.html", changeset: changeset)
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user