MAINT: drop old landing page (#35)

This commit is contained in:
Matthew Ryan Dillon 2020-08-09 15:52:27 -07:00 committed by GitHub
parent 2cd2f38356
commit c68a5b0e10
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 58 deletions

View file

@ -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"""
<div class="box">
<%= f = form_for(@new_task_changeset, "#", [phx_submit: :save_new_task]) %>
<div class="field">
<div class="control">
<%= text_input f, :value, placeholder: "add new task", class: "input", autocomplete: "off" %>
</div>
<%= error_tag f, :value %>
</div>
</form>
</div>
"""
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

View file

@ -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)

View file

@ -11,7 +11,7 @@
<body>
<nav class="navbar is-dark mb-5" role="navigation">
<div class="navbar-brand">
<%= link "planner", to: Routes.landing_path(@conn, :index), class: "navbar-item has-text-weight-bold hast-text-info-light" %>
<%= link "planner", to: Routes.tasks_path(@conn, :index), class: "navbar-item has-text-weight-bold hast-text-info-light" %>
<a role="button" class="navbar-burger burger" data-target="nvbr">
<span></span>
@ -21,9 +21,7 @@
</div>
<div id="nvbr" class="navbar-menu">
<div class="navbar-start">
<%= link "tasks", to: Routes.tasks_path(@conn, :index), class: "navbar-item" %>
</div>
<div class="navbar-start"></div>
<div class="navbar-end">
<%= link "log out", to: Routes.user_session_path(@conn, :delete), method: :delete, class: "navbar-item" %>