memEx/lib/memex_web/live/note_live/show.html.heex
shibao 63d854ffbe
All checks were successful
continuous-integration/drone/push Build is passing
upgrade to phoenix 1.7
2023-04-13 23:29:29 -04:00

50 lines
1.3 KiB
Plaintext

<div class="mx-auto flex flex-col justify-center items-stretch space-y-4 max-w-3xl">
<h1 class="text-xl">
<%= @note.slug %>
</h1>
<div class="flex flex-wrap space-x-1">
<.link :for={tag <- @note.tags} navigate={~p"/notes/#{tag}"} class="link">
<%= tag %>
</.link>
</div>
<.note_content note={@note} />
<p class="self-end">
<%= gettext("Visibility: %{visibility}", visibility: @note.visibility) %>
</p>
<div class="self-end flex space-x-4">
<.link
:if={Notes.is_owner?(@note, @current_user)}
class="btn btn-primary"
patch={~p"/note/#{@note}/edit"}
>
<%= dgettext("actions", "edit") %>
</.link>
<button
:if={Notes.is_owner_or_admin?(@note, @current_user)}
type="button"
class="btn btn-primary"
phx-click="delete"
data-confirm={dgettext("prompts", "are you sure?")}
aria-label={dgettext("actions", "delete %{note_slug}", note_slug: @note.slug)}
>
<%= dgettext("actions", "delete") %>
</button>
</div>
</div>
<.modal :if={@live_action == :edit} return_to={~p"/note/#{@note}"}>
<.live_component
module={MemexWeb.NoteLive.FormComponent}
id={@note.id}
current_user={@current_user}
title={@page_title}
action={@live_action}
note={@note}
return_to={~p"/note/#{@note}"}
/>
</.modal>