Files

85 lines
3.0 KiB
Plaintext

<%#-- 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.
++#%>
<%=
component_wrapper(tag: "turbo-frame", refresh: :morph) do
if show_form?
render Admin::CustomFields::Hierarchy::ItemFormComponent.new(model)
else
flex_layout(align_items: :center, justify_content: :space_between, test_selector: "op-custom-fields--hierarchy-item") do |item_container|
item_container.with_column(flex_layout: true) do |item_information|
item_information.with_column(mr: 2) do
render(Primer::OpenProject::DragHandle.new(draggable: true))
end
item_information.with_column(mr: 2) do
render(
Primer::Beta::Link.new(
href: item_link,
underline: false,
data: { turbo_frame: Admin::CustomFields::Hierarchy::ItemsComponent.wrapper_key }
)
) do
render(Primer::Beta::Text.new(font_weight: :bold)) { model.label }
end
end
label_addition = secondary_text
if label_addition.present?
item_information.with_column(mr: 2) do
render(Primer::Beta::Text.new(color: :subtle)) { label_addition }
end
end
if model.children_count > 0
item_information.with_column(mr: 2) do
render(Primer::Beta::Text.new) { children_count }
end
end
end
item_container.with_column do
render(
Primer::Alpha::ActionMenu.new(
menu_id:,
src: item_actions_href,
test_selector: "op-hierarchy-item--action-menu"
)
) do |menu|
menu.with_show_button(
icon: "kebab-horizontal",
scheme: :invisible,
"aria-label": I18n.t("custom_fields.admin.items.actions")
)
end
end
end
end
end
%>