From c68a5b0e1011a0b96f5f89f877813a35e78f9022 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Sun, 9 Aug 2020 15:52:27 -0700 Subject: [PATCH] MAINT: drop old landing page (#35) --- lib/planner_web/live/landing_live.ex | 49 ------------------- lib/planner_web/router.ex | 8 ++- .../templates/layout/root.html.leex | 6 +-- 3 files changed, 5 insertions(+), 58 deletions(-) delete mode 100644 lib/planner_web/live/landing_live.ex diff --git a/lib/planner_web/live/landing_live.ex b/lib/planner_web/live/landing_live.ex deleted file mode 100644 index 3823051..0000000 --- a/lib/planner_web/live/landing_live.ex +++ /dev/null @@ -1,49 +0,0 @@ -defmodule PlannerWeb.LandingLive do - use Phoenix.LiveView, layout: {PlannerWeb.LayoutView, "live.html"} - use Phoenix.HTML - - import PlannerWeb.ErrorHelpers - - alias Planner.Tasks - alias Planner.Tasks.Task - - def mount(_params, _session, socket) do - socket = - socket - |> clear_flash(:info) - |> assign(:new_task_changeset, Tasks.change_task(%Task{})) - - {:ok, socket} - end - - def render(assigns) do - ~L""" -
- <%= f = form_for(@new_task_changeset, "#", [phx_submit: :save_new_task]) %> -
-
- <%= text_input f, :value, placeholder: "add new task", class: "input", autocomplete: "off" %> -
- <%= error_tag f, :value %> -
- -
- """ - end - - def handle_event("save_new_task", %{"task" => task_params}, socket) do - case Tasks.add_task(task_params) do - {:ok, task} -> - {:noreply, - socket - |> clear_flash(:info) - |> put_flash(:info, "task '#{task.value}' created") - |> assign(:new_task_changeset, Tasks.change_task(%Task{}))} - - {:error, %Ecto.Changeset{} = changeset} -> - {:noreply, - socket - |> assign(new_task_changeset: changeset)} - end - end -end diff --git a/lib/planner_web/router.ex b/lib/planner_web/router.ex index 89dea4d..7e17982 100644 --- a/lib/planner_web/router.ex +++ b/lib/planner_web/router.ex @@ -52,11 +52,9 @@ defmodule PlannerWeb.Router do scope "/", PlannerWeb do pipe_through([:browser, :require_authenticated_user]) - live("/", LandingLive, :index) - - live("/tasks", TasksLive, :index) - live("/tasks/:id", TasksLive, :show) - live("/tasks/:id/edit", TasksLive, :edit) + live("/", TasksLive, :index) + live("/:id", TasksLive, :show) + live("/:id/edit", TasksLive, :edit) resources("/tasks-old", TaskController) diff --git a/lib/planner_web/templates/layout/root.html.leex b/lib/planner_web/templates/layout/root.html.leex index 62e032a..f511b46 100644 --- a/lib/planner_web/templates/layout/root.html.leex +++ b/lib/planner_web/templates/layout/root.html.leex @@ -11,7 +11,7 @@