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

50 lines
1.4 KiB
Plaintext

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