memEx/lib/memex_web/live/note_live/show.html.heex

50 lines
1.3 KiB
Plaintext
Raw Normal View History

2022-11-17 22:38:52 -05:00
<div class="mx-auto flex flex-col justify-center items-stretch space-y-4 max-w-3xl">
<h1 class="text-xl">
2022-11-26 14:51:18 -05:00
<%= @note.slug %>
2022-11-17 22:38:52 -05:00
</h1>
2022-12-15 22:33:10 -05:00
<div class="flex flex-wrap space-x-1">
2023-04-13 23:29:29 -04:00
<.link :for={tag <- @note.tags} navigate={~p"/notes/#{tag}"} class="link">
2023-02-04 11:29:06 -05:00
<%= tag %>
</.link>
2022-12-15 22:33:10 -05:00
</div>
2022-11-17 22:38:52 -05:00
2022-12-15 22:43:18 -05:00
<.note_content note={@note} />
2022-11-17 22:38:52 -05:00
<p class="self-end">
<%= gettext("Visibility: %{visibility}", visibility: @note.visibility) %>
</p>
<div class="self-end flex space-x-4">
2023-02-04 11:29:06 -05:00
<.link
2024-02-23 22:18:25 -05:00
:if={Notes.owner?(@note, @current_user)}
2023-02-04 11:29:06 -05:00
class="btn btn-primary"
2023-04-13 23:29:29 -04:00
patch={~p"/note/#{@note}/edit"}
2023-02-04 11:29:06 -05:00
>
<%= dgettext("actions", "edit") %>
</.link>
<button
:if={Notes.owner_or_admin?(@note, @current_user)}
2023-02-04 11:29:06 -05:00
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)}
2023-02-04 11:29:06 -05:00
>
<%= dgettext("actions", "delete") %>
</button>
2022-11-17 22:38:52 -05:00
</div>
</div>
2022-07-25 20:08:40 -04:00
2023-04-13 23:29:29 -04:00
<.modal :if={@live_action == :edit} return_to={~p"/note/#{@note}"}>
2023-02-04 11:29:06 -05:00
<.live_component
module={MemexWeb.NoteLive.FormComponent}
id={@note.id}
current_user={@current_user}
title={@page_title}
action={@live_action}
note={@note}
2023-04-13 23:29:29 -04:00
return_to={~p"/note/#{@note}"}
2023-02-04 11:29:06 -05:00
/>
</.modal>