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">
|
|
|
|
<%= @note.title %>
|
|
|
|
</h1>
|
|
|
|
|
|
|
|
<p><%= if @note.tags, do: @note.tags |> Enum.join(", ") %></p>
|
|
|
|
|
|
|
|
<textarea
|
|
|
|
id="show-note-content"
|
|
|
|
class="input input-primary h-128 min-h-128"
|
|
|
|
phx-hook="MaintainAttrs"
|
|
|
|
phx-update="ignore"
|
|
|
|
readonly
|
|
|
|
phx-no-format
|
|
|
|
><%= @note.content %></textarea>
|
|
|
|
|
|
|
|
<p class="self-end">
|
|
|
|
<%= gettext("Visibility: %{visibility}", visibility: @note.visibility) %>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<div class="self-end flex space-x-4">
|
2022-11-24 17:15:10 -05:00
|
|
|
<.link class="btn btn-primary" navigate={Routes.note_index_path(@socket, :index)}>
|
2022-11-24 12:43:34 -05:00
|
|
|
<%= dgettext("actions", "back") %>
|
2022-11-17 22:38:52 -05:00
|
|
|
</.link>
|
2022-11-24 17:15:10 -05:00
|
|
|
<%= if is_owner?(@note, @current_user) do %>
|
2022-11-17 22:38:52 -05:00
|
|
|
<.link class="btn btn-primary" patch={Routes.note_show_path(@socket, :edit, @note)}>
|
|
|
|
<%= dgettext("actions", "edit") %>
|
|
|
|
</.link>
|
2022-11-24 17:15:10 -05:00
|
|
|
<% end %>
|
|
|
|
<%= if is_owner_or_admin?(@note, @current_user) do %>
|
2022-11-24 12:43:34 -05:00
|
|
|
<button
|
|
|
|
type="button"
|
|
|
|
class="btn btn-primary"
|
|
|
|
phx-click="delete"
|
|
|
|
data-confirm={dgettext("prompts", "are you sure?")}
|
|
|
|
data-qa={"delete-note-#{@note.id}"}
|
|
|
|
>
|
|
|
|
<%= dgettext("actions", "delete") %>
|
|
|
|
</button>
|
2022-11-17 22:38:52 -05:00
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-07-25 20:08:40 -04:00
|
|
|
|
|
|
|
<%= if @live_action in [:edit] do %>
|
|
|
|
<.modal return_to={Routes.note_show_path(@socket, :show, @note)}>
|
|
|
|
<.live_component
|
|
|
|
module={MemexWeb.NoteLive.FormComponent}
|
|
|
|
id={@note.id}
|
2022-11-17 22:38:52 -05:00
|
|
|
current_user={@current_user}
|
2022-07-25 20:08:40 -04:00
|
|
|
title={@page_title}
|
|
|
|
action={@live_action}
|
|
|
|
note={@note}
|
|
|
|
return_to={Routes.note_show_path(@socket, :show, @note)}
|
|
|
|
/>
|
|
|
|
</.modal>
|
|
|
|
<% end %>
|