33 lines
901 B
Text
33 lines
901 B
Text
<main>
|
|
<header>
|
|
<h1>{page_title(@post, @live_action)}</h1>
|
|
</header>
|
|
|
|
<.form for={@form} phx-change="validate" phx-submit="save">
|
|
<.input :if={@post.kind == :blog} type="text" field={@form[:title]} />
|
|
<.input
|
|
:if={@post.kind == :blog}
|
|
type="text"
|
|
field={@form[:slug]}
|
|
disabled={not update_slug?(@post)}
|
|
/>
|
|
<.input type="textarea" field={@form[:body]} />
|
|
|
|
<.button type="submit">save</.button>
|
|
</.form>
|
|
|
|
<%= if @live_action == :edit do %>
|
|
<div>
|
|
<%= if @post.published_at do %>
|
|
<.button phx-click="unpublish">unpublish</.button>
|
|
<% else %>
|
|
<.button phx-click="publish">publish</.button>
|
|
<% end %>
|
|
<%= if @post.deleted_at do %>
|
|
<.button phx-click="undelete">undelete</.button>
|
|
<% else %>
|
|
<.button phx-click="delete">delete</.button>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
</main>
|