diff --git a/lib/nulla_web/components/templates.ex b/lib/nulla_web/components/templates.ex index 87fc303..acec111 100644 --- a/lib/nulla_web/components/templates.ex +++ b/lib/nulla_web/components/templates.ex @@ -3,14 +3,6 @@ defmodule NullaWeb.UserHTML do embed_templates "templates/user/*" - @doc """ - Renders a user form. - """ - attr :changeset, Ecto.Changeset, required: true - attr :action, :string, required: true - - def user_form(assigns) - def format_birthdate(date) do formatted = Date.to_string(date) |> String.replace("-", "/") age = Timex.diff(Timex.today(), date, :years) @@ -84,17 +76,3 @@ defmodule NullaWeb.UserHTML do end end end - -defmodule NullaWeb.NoteHTML do - use NullaWeb, :html - - embed_templates "templates/note/*" - - @doc """ - Renders a note form. - """ - attr :changeset, Ecto.Changeset, required: true - attr :action, :string, required: true - - def note_form(assigns) -end diff --git a/lib/nulla_web/components/templates/note/edit.html.heex b/lib/nulla_web/components/templates/note/edit.html.heex deleted file mode 100644 index 3bef388..0000000 --- a/lib/nulla_web/components/templates/note/edit.html.heex +++ /dev/null @@ -1,8 +0,0 @@ -<.header> - Edit Note {@note.id} - <:subtitle>Use this form to manage note records in your database. - - -<.note_form changeset={@changeset} action={~p"/notes/#{@note}"} /> - -<.back navigate={~p"/notes"}>Back to notes diff --git a/lib/nulla_web/components/templates/note/index.html.heex b/lib/nulla_web/components/templates/note/index.html.heex deleted file mode 100644 index ffeedbc..0000000 --- a/lib/nulla_web/components/templates/note/index.html.heex +++ /dev/null @@ -1,23 +0,0 @@ -<.header> - Listing Notes - <:actions> - <.link href={~p"/notes/new"}> - <.button>New Note - - - - -<.table id="notes" rows={@notes} row_click={&JS.navigate(~p"/notes/#{&1}")}> - <:col :let={note} label="Content">{note.content} - <:action :let={note}> -
- <.link navigate={~p"/notes/#{note}"}>Show -
- <.link navigate={~p"/notes/#{note}/edit"}>Edit - - <:action :let={note}> - <.link href={~p"/notes/#{note}"} method="delete" data-confirm="Are you sure?"> - Delete - - - diff --git a/lib/nulla_web/components/templates/note/new.html.heex b/lib/nulla_web/components/templates/note/new.html.heex deleted file mode 100644 index 4cf47a4..0000000 --- a/lib/nulla_web/components/templates/note/new.html.heex +++ /dev/null @@ -1,8 +0,0 @@ -<.header> - New Note - <:subtitle>Use this form to manage note records in your database. - - -<.note_form changeset={@changeset} action={~p"/notes"} /> - -<.back navigate={~p"/notes"}>Back to notes diff --git a/lib/nulla_web/components/templates/note/note_form.html.heex b/lib/nulla_web/components/templates/note/note_form.html.heex deleted file mode 100644 index da6ac0f..0000000 --- a/lib/nulla_web/components/templates/note/note_form.html.heex +++ /dev/null @@ -1,9 +0,0 @@ -<.simple_form :let={f} for={@changeset} action={@action}> - <.error :if={@changeset.action}> - Oops, something went wrong! Please check the errors below. - - <.input field={f[:content]} type="text" label="Content" /> - <:actions> - <.button>Save Note - - diff --git a/lib/nulla_web/components/templates/note/show.html.heex b/lib/nulla_web/components/templates/note/show.html.heex deleted file mode 100644 index d7f2f70..0000000 --- a/lib/nulla_web/components/templates/note/show.html.heex +++ /dev/null @@ -1,15 +0,0 @@ -<.header> - Note {@note.id} - <:subtitle>This is a note record from your database. - <:actions> - <.link href={~p"/notes/#{@note}/edit"}> - <.button>Edit note - - - - -<.list> - <:item title="Content">{@note.content} - - -<.back navigate={~p"/notes"}>Back to notes diff --git a/lib/nulla_web/components/templates/user/edit.html.heex b/lib/nulla_web/components/templates/user/edit.html.heex deleted file mode 100644 index 2f8aa66..0000000 --- a/lib/nulla_web/components/templates/user/edit.html.heex +++ /dev/null @@ -1,8 +0,0 @@ -<.header> - Edit User {@user.id} - <:subtitle>Use this form to manage user records in your database. - - -<.user_form changeset={@changeset} action={~p"/users/#{@user}"} /> - -<.back navigate={~p"/users"}>Back to users diff --git a/lib/nulla_web/components/templates/user/index.html.heex b/lib/nulla_web/components/templates/user/index.html.heex deleted file mode 100644 index 9eca5b7..0000000 --- a/lib/nulla_web/components/templates/user/index.html.heex +++ /dev/null @@ -1,23 +0,0 @@ -<.header> - Listing Users - <:actions> - <.link href={~p"/users/new"}> - <.button>New User - - - - -<.table id="users" rows={@users} row_click={&JS.navigate(~p"/users/#{&1}")}> - <:col :let={user} label="Username">{user.username} - <:action :let={user}> -
- <.link navigate={~p"/users/#{user}"}>Show -
- <.link navigate={~p"/users/#{user}/edit"}>Edit - - <:action :let={user}> - <.link href={~p"/users/#{user}"} method="delete" data-confirm="Are you sure?"> - Delete - - - diff --git a/lib/nulla_web/components/templates/user/new.html.heex b/lib/nulla_web/components/templates/user/new.html.heex deleted file mode 100644 index 9248fb0..0000000 --- a/lib/nulla_web/components/templates/user/new.html.heex +++ /dev/null @@ -1,8 +0,0 @@ -<.header> - New User - <:subtitle>Use this form to manage user records in your database. - - -<.user_form changeset={@changeset} action={~p"/users"} /> - -<.back navigate={~p"/users"}>Back to users diff --git a/lib/nulla_web/components/templates/user/user_form.html.heex b/lib/nulla_web/components/templates/user/user_form.html.heex deleted file mode 100644 index 6871618..0000000 --- a/lib/nulla_web/components/templates/user/user_form.html.heex +++ /dev/null @@ -1,9 +0,0 @@ -<.simple_form :let={f} for={@changeset} action={@action}> - <.error :if={@changeset.action}> - Oops, something went wrong! Please check the errors below. - - <.input field={f[:username]} type="text" label="Username" /> - <:actions> - <.button>Save User - -