Add Articles

mix phx.gen.live Articles Article articles title:string\                                                            /Crucial/git/phoenix-liveview-book
  content:text url:string language:string\
  date:utc_datetime author_id:references:authors
This commit is contained in:
Thelonius Kort
2022-12-26 18:02:29 +01:00
parent 005a9d9337
commit f7f1e1a284
13 changed files with 582 additions and 0 deletions

View File

@ -0,0 +1,30 @@
<.header>
Article <%= @article.id %>
<:subtitle>This is a article record from your database.</:subtitle>
<:actions>
<.link patch={~p"/articles/#{@article}/show/edit"} phx-click={JS.push_focus()}>
<.button>Edit article</.button>
</.link>
</:actions>
</.header>
<.list>
<:item title="Title"><%= @article.title %></:item>
<:item title="Content"><%= @article.content %></:item>
<:item title="Url"><%= @article.url %></:item>
<:item title="Language"><%= @article.language %></:item>
<:item title="Date"><%= @article.date %></:item>
</.list>
<.back navigate={~p"/articles"}>Back to articles</.back>
<.modal :if={@live_action == :edit} id="article-modal" show on_cancel={JS.patch(~p"/articles/#{@article}")}>
<.live_component
module={OutlookWeb.ArticleLive.FormComponent}
id={@article.id}
title={@page_title}
action={@live_action}
article={@article}
navigate={~p"/articles/#{@article}"}
/>
</.modal>