fix visibility issues with multiple users
This commit is contained in:
		| @@ -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("contexts") %> | ||||
|   </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={context}> | ||||
|         <.link | ||||
|           :if={Contexts.owner?(context, @current_user)} | ||||
|           :if={@current_user} | ||||
|           patch={~p"/contexts/#{context}/edit"} | ||||
|           aria-label={dgettext("actions", "edit %{context_slug}", context_slug: context.slug)} | ||||
|         > | ||||
|           <%= dgettext("actions", "edit") %> | ||||
|         </.link> | ||||
|         <.link | ||||
|           :if={Contexts.owner_or_admin?(context, @current_user)} | ||||
|           :if={@current_user} | ||||
|           href="#" | ||||
|           phx-click="delete" | ||||
|           phx-value-id={context.id} | ||||
|   | ||||
| @@ -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"> | ||||
|     <%= @context.slug %> | ||||
|   </h1> | ||||
| @@ -15,16 +15,12 @@ | ||||
|     <%= 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"} | ||||
|     > | ||||
|   <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={Contexts.owner_or_admin?(@context, @current_user)} | ||||
|       :if={@current_user} | ||||
|       type="button" | ||||
|       class="btn btn-primary" | ||||
|       phx-click="delete" | ||||
|   | ||||
| @@ -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("notes") %> | ||||
|   </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={note}> | ||||
|         <.link | ||||
|           :if={Notes.owner?(note, @current_user)} | ||||
|           :if={@current_user} | ||||
|           patch={~p"/notes/#{note}/edit"} | ||||
|           aria-label={dgettext("actions", "edit %{note_slug}", note_slug: note.slug)} | ||||
|         > | ||||
|           <%= dgettext("actions", "edit") %> | ||||
|         </.link> | ||||
|         <.link | ||||
|           :if={Notes.owner_or_admin?(note, @current_user)} | ||||
|           :if={@current_user} | ||||
|           href="#" | ||||
|           phx-click="delete" | ||||
|           phx-value-id={note.id} | ||||
|   | ||||
| @@ -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"> | ||||
|     <%= @note.slug %> | ||||
|   </h1> | ||||
| @@ -15,16 +15,12 @@ | ||||
|     <%= gettext("Visibility: %{visibility}", visibility: @note.visibility) %> | ||||
|   </p> | ||||
|  | ||||
|   <div class="self-end flex space-x-4"> | ||||
|     <.link | ||||
|       :if={Notes.owner?(@note, @current_user)} | ||||
|       class="btn btn-primary" | ||||
|       patch={~p"/note/#{@note}/edit"} | ||||
|     > | ||||
|   <div class="flex self-end space-x-4"> | ||||
|     <.link :if={@current_user} class="btn btn-primary" patch={~p"/note/#{@note}/edit"}> | ||||
|       <%= dgettext("actions", "edit") %> | ||||
|     </.link> | ||||
|     <button | ||||
|       :if={Notes.owner_or_admin?(@note, @current_user)} | ||||
|       :if={@current_user} | ||||
|       type="button" | ||||
|       class="btn btn-primary" | ||||
|       phx-click="delete" | ||||
|   | ||||
| @@ -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} | ||||
|   | ||||
| @@ -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"} | ||||
|   > | ||||
|   | ||||
		Reference in New Issue
	
	Block a user