.form
for={@form}
phx-change="validate"
phx-submit="save"
class="flex flex-col md:flex-row p-4 gap-4"
>
<.input :if={@post.kind == :blog} type="text" label="title" field={@form[:title]} />
<.input type="textarea" field={@form[:body]} label="body" class="md:flex-grow" />
<.button type="submit" class="self-end">save
<.link
:if={@post.published_at}
class="self-end"
navigate={Web.Paths.public_post_path(@post)}
target="_blank"
>
view
<.input type="datetime-local" label="published (utc)" field={@form[:published_at]} />
<%= if @post.published_at do %>
<.button phx-click="unpublish" class="self-end">unpublish
<% else %>
<.button phx-click="publish" class="self-end">publish
<% end %>
<.input type="datetime-local" label="deleted (utc)" field={@form[:deleted_at]} />
<.input
type="checkbox"
label="syndicate to mastodon"
class="self-end"
field={@form[:syndicate_to_mastodon]}
/>
<%= if @post.deleted_at do %>
<.button phx-click="undelete" class="self-end">undelete
<% else %>
<.button phx-click="delete" class="self-end">delete
<% end %>
<.input
:if={@post.kind == :blog}
label="slug"
type="text"
field={@form[:slug]}
disabled={not update_slug?(@post)}
/>