memEx/lib/memex_web/live/pipeline_live/index.html.heex

74 lines
2.1 KiB
Plaintext
Raw Normal View History

2022-11-24 14:31:16 -05:00
<div class="mx-auto flex flex-col justify-center items-start space-y-4 max-w-3xl">
<h1 class="text-xl">
<%= gettext("pipelines") %>
</h1>
<.form
:let={f}
2023-03-16 19:49:19 -04:00
for={%{}}
as={:search}
2022-11-24 14:31:16 -05:00
phx-change="search"
phx-submit="search"
class="self-stretch flex flex-col items-stretch"
>
<%= text_input(f, :search_term,
class: "input input-primary",
value: @search,
2023-03-19 15:28:53 -04:00
role: "search",
2022-11-24 14:31:16 -05:00
phx_debounce: 300,
placeholder: gettext("search")
) %>
</.form>
<%= if @pipelines |> Enum.empty?() do %>
<h1 class="self-center text-primary-500">
<%= gettext("no pipelines found") %>
</h1>
<% else %>
<.live_component
module={MemexWeb.Components.PipelinesTableComponent}
id="pipelines-index-table"
current_user={@current_user}
pipelines={@pipelines}
>
<:actions :let={pipeline}>
2023-02-04 11:29:06 -05:00
<.link
2024-02-23 22:18:25 -05:00
:if={Pipelines.owner?(pipeline, @current_user)}
2023-04-13 23:29:29 -04:00
patch={~p"/pipelines/#{pipeline}/edit"}
aria-label={dgettext("actions", "edit %{pipeline_slug}", pipeline_slug: pipeline.slug)}
2023-02-04 11:29:06 -05:00
>
<%= dgettext("actions", "edit") %>
</.link>
<.link
:if={Pipelines.owner_or_admin?(pipeline, @current_user)}
2023-02-04 11:29:06 -05:00
href="#"
phx-click="delete"
phx-value-id={pipeline.id}
data-confirm={dgettext("prompts", "are you sure?")}
aria-label={
dgettext("actions", "delete %{pipeline_slug}", pipeline_slug: pipeline.slug)
}
2023-02-04 11:29:06 -05:00
>
<%= dgettext("actions", "delete") %>
</.link>
2022-11-24 14:31:16 -05:00
</:actions>
</.live_component>
<% end %>
2023-04-13 23:29:29 -04:00
<.link :if={@current_user} patch={~p"/pipelines/new"} class="self-end btn btn-primary">
2023-02-04 11:29:06 -05:00
<%= dgettext("actions", "new pipeline") %>
</.link>
2022-11-24 14:31:16 -05:00
</div>
2022-07-25 20:12:11 -04:00
2023-04-13 23:29:29 -04:00
<.modal :if={@live_action in [:new, :edit]} return_to={~p"/pipelines"}>
2023-02-04 11:29:06 -05:00
<.live_component
module={MemexWeb.PipelineLive.FormComponent}
id={@pipeline.id || :new}
current_user={@current_user}
title={@page_title}
action={@live_action}
pipeline={@pipeline}
2023-04-13 23:29:29 -04:00
return_to={~p"/pipelines"}
2023-02-04 11:29:06 -05:00
/>
</.modal>