Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

3.5 KB
Raw Blame
<%#-- copyright
OpenProject is an open source project management software.
Copyright (C) the OpenProject GmbH

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 3.

OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
Copyright (C) 2006-2013 Jean-Philippe Lang
Copyright (C) 2010-2013 the ChiliProject Team

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

See COPYRIGHT and LICENSE files for more details.

++#%>

<%=
  flex_layout(align_items: :center, justify_content: :space_between) do |row_container|
    row_container.with_column(flex_layout: true, classes: "gap-2 min-width-0") do |title_container|
      if allowed_to_customize_life_cycle?
        title_container.with_column do
          render(
            Primer::OpenProject::DragHandle.new(
              data: { "projects--settings--border-box-filter-target": "hideWhenFiltering" }
            )
          )
        end
      end
      title_container.with_column do
        render(
          Projects::PhaseDefinitionComponent.new(
            definition,
            edit_link: allowed_to_customize_life_cycle?,
            phase_text_options: { classes: "filter-target-visible-text" }
          )
        )
      end
      title_container.with_column(classes: "no-wrap") do
        render(Primer::Beta::Text.new) { t("project.count", count: definition.project_count) }
      end
    end

    if allowed_to_customize_life_cycle?
      row_container.with_column do
        render(Primer::Alpha::ActionMenu.new) do |menu|
          menu.with_show_button(icon: "kebab-horizontal", "aria-label": t(:button_actions), scheme: :invisible)

          menu.with_item(
            label: t(:label_edit),
            href: edit_admin_settings_project_phase_definition_path(definition)
          ) do |item|
            item.with_leading_visual_icon(icon: :pencil)
          end

          unless first?
            move_action(menu:, move_to: :highest, label: t("label_agenda_item_move_to_top"), icon: "move-to-top")
            move_action(menu:, move_to: :higher, label: t("label_agenda_item_move_up"), icon: "chevron-up")
          end
          unless last?
            move_action(menu:, move_to: :lower, label: t("label_agenda_item_move_down"), icon: "chevron-down")
            move_action(menu:, move_to: :lowest, label: t("label_agenda_item_move_to_bottom"), icon: "move-to-bottom")
          end

          menu.with_item(
            label: t(:text_destroy),
            scheme: :danger,
            href: admin_settings_project_phase_definition_path(definition),
            form_arguments: {
              method: :delete,
              data: {
                turbo_confirm: t("text_are_you_sure_with_project_life_cycle_step")
              }
            }
          ) do |item|
            item.with_leading_visual_icon(icon: :trash)
          end
        end
      end
    end
  end
%>