feat(ui): create idiomatic UI matching previous katbin iteration

Signed-off-by: SphericalKat <amolele@gmail.com>
This commit is contained in:
sphericalkat committed 2021-08-13 06:33:43 +05:30
1 parent c6c54347a7
commit 13728f2ef8
7 files changed
+33 -10

No files matched your search

+15 -1
View File
@@ -5,11 +5,25 @@ defmodule KetbinWeb.PageController do
alias Ketbin.Pastes.Paste
def index(conn, _params) do
render(conn, "index.html")
changeset = Pastes.change_paste(%Paste{})
render(conn, "index.html", changeset: changeset)
end
def show(conn, %{"id" => id}) do
paste = Pastes.get_paste!(id)
render(conn, "show.html", paste: paste)
end
def create(conn, %{"paste" => paste_params}) do
# paste_params = Map.put(paste_params, "id", s)
case Pastes.create_paste(paste_params) do
{:ok, paste} ->
conn
|> put_flash(:info, "Paste created successfully.")
|> redirect(to: Routes.paste_path(conn, :show, paste))
{:error, %Ecto.Changeset{} = changeset} ->
render(conn, "index.html", changeset: changeset)
end
end
end