shibao 0c5442f0cd
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
add backlinks
2025-02-15 06:01:03 +00:00

67 lines
1.9 KiB
Plaintext

<div class="flex flex-col justify-center items-stretch mx-auto 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} />
<div
:if={@context_backlinks ++ @pipeline_backlinks != []}
class="flex flex-wrap justify-end items-center self-end"
>
<p><%= gettext("Backlinked by:") %></p>
<.link
:for={backlink <- @context_backlinks}
class="m-1 hover:underline"
patch={~p"/context/#{backlink}"}
>
<%= gettext("[%{slug}]", slug: backlink.slug) %>
</.link>
<.link
:for={backlink <- @pipeline_backlinks}
class="m-1 hover:underline"
patch={~p"/pipeline/#{backlink}"}
>
<%= gettext("[[%{slug}]]", slug: backlink.slug) %>
</.link>
</div>
<p class="self-end">
<%= gettext("Visibility: %{visibility}", visibility: @context.visibility) %>
</p>
<div class="flex self-end space-x-4">
<.link :if={@current_user} class="btn btn-primary" patch={~p"/context/#{@context}/edit"}>
<%= dgettext("actions", "edit") %>
</.link>
<button
:if={@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>