2022-11-24 12:44:34 -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
|
|
|
<%= @context.slug %>
|
2022-11-24 12:44:34 -05:00
|
|
|
</h1>
|
|
|
|
|
2022-12-15 22:33:10 -05:00
|
|
|
<div class="flex flex-wrap space-x-1">
|
2023-02-04 11:29:06 -05:00
|
|
|
<.link
|
|
|
|
:for={tag <- @context.tags}
|
|
|
|
navigate={Routes.context_index_path(Endpoint, :search, tag)}
|
|
|
|
class="link"
|
|
|
|
>
|
|
|
|
<%= tag %>
|
|
|
|
</.link>
|
2022-12-15 22:33:10 -05:00
|
|
|
</div>
|
2022-11-24 12:44:34 -05:00
|
|
|
|
2022-11-26 16:36:30 -05:00
|
|
|
<.context_content context={@context} />
|
2022-11-24 12:44:34 -05:00
|
|
|
|
|
|
|
<p class="self-end">
|
|
|
|
<%= gettext("Visibility: %{visibility}", visibility: @context.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.context_index_path(@socket, :index)}>
|
2022-11-24 12:44:34 -05:00
|
|
|
<%= dgettext("actions", "back") %>
|
|
|
|
</.link>
|
2023-02-04 11:29:06 -05:00
|
|
|
<.link
|
2023-03-18 23:09:36 -04:00
|
|
|
:if={Contexts.is_owner?(@context, @current_user)}
|
2023-02-04 11:29:06 -05:00
|
|
|
class="btn btn-primary"
|
|
|
|
patch={Routes.context_show_path(@socket, :edit, @context.slug)}
|
|
|
|
>
|
|
|
|
<%= dgettext("actions", "edit") %>
|
|
|
|
</.link>
|
|
|
|
<button
|
2023-03-18 23:09:36 -04:00
|
|
|
:if={Contexts.is_owner_or_admin?(@context, @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?")}
|
2023-03-18 00:26:32 -04:00
|
|
|
aria-label={dgettext("actions", "delete %{context_slug}", context_slug: @context.slug)}
|
2023-02-04 11:29:06 -05:00
|
|
|
>
|
|
|
|
<%= dgettext("actions", "delete") %>
|
|
|
|
</button>
|
2022-11-24 12:44:34 -05:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-07-25 20:11:08 -04:00
|
|
|
|
2023-02-04 11:29:06 -05:00
|
|
|
<.modal
|
2023-02-04 17:22:06 -05:00
|
|
|
:if={@live_action == :edit}
|
2023-02-04 11:29:06 -05:00
|
|
|
return_to={Routes.context_show_path(@socket, :show, @context.slug)}
|
|
|
|
>
|
|
|
|
<.live_component
|
|
|
|
module={MemexWeb.ContextLive.FormComponent}
|
|
|
|
id={@context.id}
|
|
|
|
current_user={@current_user}
|
|
|
|
title={@page_title}
|
|
|
|
action={@live_action}
|
|
|
|
context={@context}
|
|
|
|
return_to={Routes.context_show_path(@socket, :show, @context.slug)}
|
|
|
|
/>
|
|
|
|
</.modal>
|