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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[#57816] create hierarchy items
Eric Schubert5ef44b40efa6
diff --git a/app/components/admin/custom_fields/hierarchy/item_component.html.erb b/app/components/admin/custom_fields/hierarchy/items_component.html.erbsimilarity index 83%rename from app/components/admin/custom_fields/hierarchy/item_component.html.erbrename to app/components/admin/custom_fields/hierarchy/items_component.html.erbindex a47d6fa45c1..390fd0da2e2 100644--- a/app/components/admin/custom_fields/hierarchy/item_component.html.erb+++ b/app/components/admin/custom_fields/hierarchy/items_component.html.erb@@ -30,6 +30,17 @@ See COPYRIGHT and LICENSE files for more details.<%=component_wrapper doflex_layout do |container|++ container.with_row(mb: 3) do+ render(Primer::Beta::BorderBox.new) do |items|+ items.with_header { @custom_field.name }+ items.with_row { "hello" }+ items.with_footer do+ render Admin::CustomFields::Hierarchy::NewItemFormComponent.new(custom_field: @custom_field)+ end+ end+ end+container.with_row(mb: 3) dorender Primer::Beta::Blankslate.new(border: true) do |component|component.with_visual_icon(icon: "list-ordered")diff --git a/app/components/admin/custom_fields/hierarchy/items_component.rb b/app/components/admin/custom_fields/hierarchy/items_component.rbnew file mode 100644index 00000000000..86709c25f7e--- /dev/null+++ b/app/components/admin/custom_fields/hierarchy/items_component.rb@@ -0,0 +1,43 @@+#-- 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.+#++++module Admin+ module CustomFields+ module Hierarchy+ class ItemsComponent < ApplicationComponent+ include OpTurbo::Streamable+ include OpPrimer::ComponentHelpers++ def initialize(custom_field:)+ super+ @custom_field = custom_field+ end+ end+ end+ end+enddiff --git a/app/components/admin/custom_fields/hierarchy/new_item_form_component.html.erb b/app/components/admin/custom_fields/hierarchy/new_item_form_component.html.erbnew file mode 100644index 00000000000..37b757d471d--- /dev/null+++ b/app/components/admin/custom_fields/hierarchy/new_item_form_component.html.erb@@ -0,0 +1,66 @@+<%#-- 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 do+ flex_layout do |container|+ container.with_row(mb: 3) do+ primer_form_with(url: "/foo") do |f|+ render_inline_form(f) do |new_item_form|+ new_item_form.group(layout: :horizontal) do |input_group|+ input_group.text_field(+ name: :label,+ label: "Label",+ visually_hide_label: true,+ required: true,+ placeholder: "Item label"+ )+ input_group.text_field(+ name: :short,+ label: "Short",+ visually_hide_label: true,+ full_width: false,+ required: false,+ placeholder: "Short label"+ )+ end++ new_item_form.group(layout: :horizontal, align_self: :end) do |button_group|+ button_group.button(name: :cancel, label: I18n.t(:button_cancel), scheme: :default)+ button_group.submit(name: :submit, label: I18n.t(:button_save), scheme: :primary)+ end+ end+ end+ end+ end+ end+%>+++diff --git a/app/components/admin/custom_fields/hierarchy/item_component.rb b/app/components/admin/custom_fields/hierarchy/new_item_form_component.rbsimilarity index 96%rename from app/components/admin/custom_fields/hierarchy/item_component.rbrename to app/components/admin/custom_fields/hierarchy/new_item_form_component.rbindex b8f7d6cb6ea..98207e42091 100644--- a/app/components/admin/custom_fields/hierarchy/item_component.rb+++ b/app/components/admin/custom_fields/hierarchy/new_item_form_component.rb@@ -29,7 +29,7 @@module Adminmodule CustomFieldsmodule Hierarchy- class ItemComponent < ApplicationComponent+ class NewItemFormComponent < ApplicationComponentinclude OpTurbo::Streamableinclude OpPrimer::ComponentHelpersenddiff --git a/app/views/admin/custom_fields/hierarchy/items/index.html.erb b/app/views/admin/custom_fields/hierarchy/items/index.html.erbindex 4ac75e9f651..48cc28d03f0 100644--- a/app/views/admin/custom_fields/hierarchy/items/index.html.erb+++ b/app/views/admin/custom_fields/hierarchy/items/index.html.erb@@ -31,4 +31,4 @@ See COPYRIGHT and LICENSE files for more details.<%= render(Admin::CustomFields::EditFormHeaderComponent.new(custom_field: @custom_field, selected: :items)) %>-<%= render(Admin::CustomFields::Hierarchy::ItemComponent.new(custom_field: @custom_field)) %>+<%= render(Admin::CustomFields::Hierarchy::ItemsComponent.new(custom_field: @custom_field)) %>