MAINT: drop old landing page (#35)
This commit is contained in:
parent
2cd2f38356
commit
c68a5b0e10
3 changed files with 5 additions and 58 deletions
|
@ -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
|
|
|
@ -52,11 +52,9 @@ defmodule PlannerWeb.Router do
|
||||||
scope "/", PlannerWeb do
|
scope "/", PlannerWeb do
|
||||||
pipe_through([:browser, :require_authenticated_user])
|
pipe_through([:browser, :require_authenticated_user])
|
||||||
|
|
||||||
live("/", LandingLive, :index)
|
live("/", TasksLive, :index)
|
||||||
|
live("/:id", TasksLive, :show)
|
||||||
live("/tasks", TasksLive, :index)
|
live("/:id/edit", TasksLive, :edit)
|
||||||
live("/tasks/:id", TasksLive, :show)
|
|
||||||
live("/tasks/:id/edit", TasksLive, :edit)
|
|
||||||
|
|
||||||
resources("/tasks-old", TaskController)
|
resources("/tasks-old", TaskController)
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<body>
|
<body>
|
||||||
<nav class="navbar is-dark mb-5" role="navigation">
|
<nav class="navbar is-dark mb-5" role="navigation">
|
||||||
<div class="navbar-brand">
|
<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">
|
<a role="button" class="navbar-burger burger" data-target="nvbr">
|
||||||
<span></span>
|
<span></span>
|
||||||
|
@ -21,9 +21,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="nvbr" class="navbar-menu">
|
<div id="nvbr" class="navbar-menu">
|
||||||
<div class="navbar-start">
|
<div class="navbar-start"></div>
|
||||||
<%= link "tasks", to: Routes.tasks_path(@conn, :index), class: "navbar-item" %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="navbar-end">
|
<div class="navbar-end">
|
||||||
<%= link "log out", to: Routes.user_session_path(@conn, :delete), method: :delete, class: "navbar-item" %>
|
<%= link "log out", to: Routes.user_session_path(@conn, :delete), method: :delete, class: "navbar-item" %>
|
||||||
|
|
Loading…
Add table
Reference in a new issue