<%= @pipeline.slug %>

<.link :for={tag <- @pipeline.tags} navigate={Routes.pipeline_index_path(Endpoint, :search, tag)} class="link" > <%= tag %>

<%= gettext("Visibility: %{visibility}", visibility: @pipeline.visibility) %>

<.link class="btn btn-primary" navigate={Routes.pipeline_index_path(@socket, :index)}> <%= dgettext("actions", "back") %> <.link :if={is_owner?(@pipeline, @current_user)} class="btn btn-primary" patch={Routes.pipeline_show_path(@socket, :edit, @pipeline.slug)} > <%= dgettext("actions", "edit") %>

<%= gettext("steps:") %>

<%= if @steps |> Enum.empty?() do %>

<%= gettext("no steps") %>

<% else %> <%= for %{id: step_id, position: position, title: title} = step <- @steps do %>

<%= gettext("%{position}. %{title}", position: position + 1, title: title) %>

<%= if is_owner?(@pipeline, @current_user) do %>
<%= if position <= 0 do %> <% else %> <% end %> <%= if position >= length(@steps) - 1 do %> <% else %> <% end %> <.link class="self-end btn btn-primary" patch={Routes.pipeline_show_path(@socket, :edit_step, @pipeline.slug, step_id)} data-qa={"edit-step-#{step_id}"} > <%= dgettext("actions", "edit") %>
<% end %>
<.step_content step={step} /> <% end %> <% end %> <.link :if={is_owner?(@pipeline, @current_user)} class="self-end btn btn-primary" patch={Routes.pipeline_show_path(@socket, :add_step, @pipeline.slug)} data-qa={"add-step-#{@pipeline.id}"} > <%= dgettext("actions", "add step") %>
<%= case @live_action do %> <% :edit -> %> <.modal return_to={Routes.pipeline_show_path(@socket, :show, @pipeline.slug)}> <.live_component module={MemexWeb.PipelineLive.FormComponent} id={@pipeline.id} current_user={@current_user} title={@page_title} action={@live_action} pipeline={@pipeline} return_to={Routes.pipeline_show_path(@socket, :show, @pipeline.slug)} /> <% action when action in [:add_step, :edit_step] -> %> <.modal return_to={Routes.pipeline_show_path(@socket, :show, @pipeline.slug)}> <.live_component module={MemexWeb.StepLive.FormComponent} id={@pipeline.id || :new} current_user={@current_user} title={@page_title} action={@live_action} pipeline={@pipeline} step={@step} return_to={Routes.pipeline_show_path(@socket, :show, @pipeline.slug)} /> <% _ -> %> <% end %>