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
[#57815] add item page for hierarchies
Eric Schubertdc667cc19cab
diff --git a/app/components/admin/custom_fields/edit_form_header_component.html.erb b/app/components/admin/custom_fields/edit_form_header_component.html.erbindex 140535ca0d4..f3853f41a7a 100644--- a/app/components/admin/custom_fields/edit_form_header_component.html.erb+++ b/app/components/admin/custom_fields/edit_form_header_component.html.erb@@ -41,6 +41,15 @@ See COPYRIGHT and LICENSE files for more details.tab.with_text { t(:label_details) }end+ if @custom_field.field_format_hierarchy?+ tab_nav.with_tab(+ selected: tab_selected?(:items),+ href: custom_field_items_path(@custom_field)+ ) do |tab|+ tab.with_text { t(:label_item_plural) }+ end+ end+tab_nav.with_tab(selected: tab_selected?(:custom_field_projects),href: custom_field_projects_path(@custom_field)diff --git a/app/components/admin/custom_fields/edit_form_header_component.rb b/app/components/admin/custom_fields/edit_form_header_component.rbindex c64d79dc8c5..9882900223f 100644--- a/app/components/admin/custom_fields/edit_form_header_component.rb+++ b/app/components/admin/custom_fields/edit_form_header_component.rb@@ -31,6 +31,7 @@ module Adminclass EditFormHeaderComponent < ApplicationComponentTAB_NAVS = %i[edit+ itemscustom_field_projects].freezediff --git a/app/components/admin/custom_fields/hierarchy/item_component.html.erb b/app/components/admin/custom_fields/hierarchy/item_component.html.erbnew file mode 100644index 00000000000..a47d6fa45c1--- /dev/null+++ b/app/components/admin/custom_fields/hierarchy/item_component.html.erb@@ -0,0 +1,49 @@+<%#-- 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+ render Primer::Beta::Blankslate.new(border: true) do |component|+ component.with_visual_icon(icon: "list-ordered")+ component.with_heading(tag: :h3).with_content(I18n.t("custom_fields.admin.items.blankslate.title"))+ component.with_description { I18n.t("custom_fields.admin.items.blankslate.description") }+ end+ end++ container.with_row do+ render Primer::Beta::Button.new(scheme: :primary) do |button|+ button.with_leading_visual_icon(icon: :plus)+ I18n.t(:label_item)+ end+ end+ end+ end+%>diff --git a/app/components/admin/custom_fields/hierarchy/item_component.rb b/app/components/admin/custom_fields/hierarchy/item_component.rbnew file mode 100644index 00000000000..b8f7d6cb6ea--- /dev/null+++ b/app/components/admin/custom_fields/hierarchy/item_component.rb@@ -0,0 +1,38 @@+#-- 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 ItemComponent < ApplicationComponent+ include OpTurbo::Streamable+ include OpPrimer::ComponentHelpers+ end+ end+ end+enddiff --git a/app/controllers/admin/custom_fields/hierarchy/items_controller.rb b/app/controllers/admin/custom_fields/hierarchy/items_controller.rbnew file mode 100644index 00000000000..9c7aa2c7556--- /dev/null+++ b/app/controllers/admin/custom_fields/hierarchy/items_controller.rb@@ -0,0 +1,55 @@+# frozen_string_literal: true++#-- 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 ItemsController < ApplicationController+ layout "admin"++ model_object CustomField++ before_action :require_admin+ before_action :find_model_object++ menu_item :custom_fields++ def index; end++ private++ def find_model_object(object_id = :custom_field_id)+ super+ @custom_field = @object+ end+ end+ end+ end+enddiff --git a/app/views/admin/custom_fields/hierarchy/items/index.html.erb b/app/views/admin/custom_fields/hierarchy/items/index.html.erbnew file mode 100644index 00000000000..4ac75e9f651--- /dev/null+++ b/app/views/admin/custom_fields/hierarchy/items/index.html.erb@@ -0,0 +1,34 @@+<%#-- 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.++++#%>++<% html_title t(:label_administration), "#{CustomField.model_name.human} #{h @custom_field.name}", t(:label_item_plural) %>++<%= render(Admin::CustomFields::EditFormHeaderComponent.new(custom_field: @custom_field, selected: :items)) %>++<%= render(Admin::CustomFields::Hierarchy::ItemComponent.new(custom_field: @custom_field)) %>diff --git a/config/locales/en.yml b/config/locales/en.ymlindex b4e348a4efc..c5e9a1033fd 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -234,6 +234,10 @@ en:is_for_all_blank_slate:heading: For all projectsdescription: This custom field is enabled in all projects since the "For all projects" option is checked. It cannot be deactivated for individual projects.+ items:+ blankslate:+ title: "Your list of items is empty"+ description: "Start by adding items to the custom field of type hierarchy. Each item can be used to create a hierarchy bellow it. To navigate and create sub-items inside a hierarchy click on the created item."notice:remember_items_and_projects: "Remember to set items and projects in the respective tabs for this custom field."@@ -2294,6 +2298,8 @@ en:label_internal: "Internal"label_introduction_video: "Introduction video"label_invite_user: "Invite user"+ label_item: "Item"+ label_item_plural: "Items"label_share: "Share"label_share_project_list: "Share project list"label_share_work_package: "Share work package"diff --git a/config/routes.rb b/config/routes.rbindex 9caca4554e3..0eaec67895d 100644--- a/config/routes.rb+++ b/config/routes.rb@@ -178,6 +178,9 @@ Rails.application.routes.draw doresource :project,controller: "/admin/custom_fields/custom_field_projects",only: :destroy+ resources :items,+ controller: "/admin/custom_fields/hierarchy/items",+ only: :indexendendend