fix visibility issues with multiple users

This commit is contained in:
2025-02-15 04:24:53 +00:00
parent 3e686fa199
commit 6c2aba84ef
32 changed files with 187 additions and 413 deletions

View File

@ -1,4 +1,4 @@
<div class="mx-auto flex flex-col justify-center items-start space-y-4 max-w-3xl">
<div class="flex flex-col justify-center items-start mx-auto space-y-4 max-w-3xl">
<h1 class="text-xl">
<%= gettext("pipelines") %>
</h1>
@ -9,7 +9,7 @@
as={:search}
phx-change="search"
phx-submit="search"
class="self-stretch flex flex-col items-stretch"
class="flex flex-col items-stretch self-stretch"
>
<%= text_input(f, :search_term,
class: "input input-primary",
@ -33,14 +33,14 @@
>
<:actions :let={pipeline}>
<.link
:if={Pipelines.owner?(pipeline, @current_user)}
:if={@current_user}
patch={~p"/pipelines/#{pipeline}/edit"}
aria-label={dgettext("actions", "edit %{pipeline_slug}", pipeline_slug: pipeline.slug)}
>
<%= dgettext("actions", "edit") %>
</.link>
<.link
:if={Pipelines.owner_or_admin?(pipeline, @current_user)}
:if={@current_user}
href="#"
phx-click="delete"
phx-value-id={pipeline.id}

View File

@ -1,4 +1,4 @@
<div class="mx-auto flex flex-col justify-center items-stretch space-y-4 max-w-3xl">
<div class="flex flex-col justify-center items-stretch mx-auto space-y-4 max-w-3xl">
<h1 class="text-xl">
<%= @pipeline.slug %>
</h1>
@ -15,16 +15,12 @@
<%= gettext("Visibility: %{visibility}", visibility: @pipeline.visibility) %>
</p>
<div class="pb-4 self-end flex space-x-4">
<.link
:if={Pipelines.owner?(@pipeline, @current_user)}
class="btn btn-primary"
patch={~p"/pipeline/#{@pipeline}/edit"}
>
<div class="flex self-end pb-4 space-x-4">
<.link :if={@current_user} class="btn btn-primary" patch={~p"/pipeline/#{@pipeline}/edit"}>
<%= dgettext("actions", "edit") %>
</.link>
<button
:if={Pipelines.owner_or_admin?(@pipeline, @current_user)}
:if={@current_user}
type="button"
class="btn btn-primary"
phx-click="delete"
@ -37,7 +33,7 @@
<hr class="hr" />
<h2 class="pt-2 self-center text-lg">
<h2 class="self-center pt-2 text-lg">
<%= gettext("steps:") %>
</h2>
@ -52,29 +48,29 @@
<%= gettext("%{position}. %{title}", position: position + 1, title: title) %>
</h3>
<%= if Pipelines.owner?(@pipeline, @current_user) do %>
<%= if @current_user do %>
<div class="flex justify-between items-center space-x-4">
<%= if position <= 0 do %>
<i class="fas text-xl fa-chevron-up cursor-not-allowed opacity-25"></i>
<i class="text-xl opacity-25 cursor-not-allowed fas fa-chevron-up"></i>
<% else %>
<button
type="button"
class="cursor-pointer flex justify-center items-center"
class="flex justify-center items-center cursor-pointer"
phx-click="reorder_step"
phx-value-direction="up"
phx-value-step-id={step_id}
aria-label={dgettext("actions", "move %{step_title} up", step_title: step.title)}
>
<i class="fas text-xl fa-chevron-up"></i>
<i class="text-xl fas fa-chevron-up"></i>
</button>
<% end %>
<%= if position >= length(@steps) - 1 do %>
<i class="fas text-xl fa-chevron-down cursor-not-allowed opacity-25"></i>
<i class="text-xl opacity-25 cursor-not-allowed fas fa-chevron-down"></i>
<% else %>
<button
type="button"
class="cursor-pointer flex justify-center items-center"
class="flex justify-center items-center cursor-pointer"
phx-click="reorder_step"
phx-value-direction="down"
phx-value-step-id={step_id}
@ -82,7 +78,7 @@
dgettext("actions", "move %{step_title} down", step_title: step.title)
}
>
<i class="fas text-xl fa-chevron-down"></i>
<i class="text-xl fas fa-chevron-down"></i>
</button>
<% end %>
@ -113,7 +109,7 @@
<% end %>
<.link
:if={Pipelines.owner?(@pipeline, @current_user)}
:if={@current_user}
class="self-end btn btn-primary"
patch={~p"/pipeline/#{@pipeline}/add_step"}
>