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
pass workspace_type on project creation
ulfertsc1fd9520acfa
diff --git a/app/components/projects/new_component.html.erb b/app/components/projects/new_component.html.erbindex 2476f81e135..43c99ab1d2a 100644--- a/app/components/projects/new_component.html.erb+++ b/app/components/projects/new_component.html.erb@@ -51,6 +51,7 @@ See COPYRIGHT and LICENSE files for more details.container.with_row(mb: 3) dorender(Primer::Forms::FormList.new(+ Projects::Settings::TypeForm.new(f),Projects::Settings::NameForm.new(f),Projects::Settings::RelationsForm.new(f),Projects::Settings::CustomFieldsForm.new(f)diff --git a/app/forms/projects/settings/type_form.rb b/app/forms/projects/settings/type_form.rbnew file mode 100644index 00000000000..d17fb70540e--- /dev/null+++ b/app/forms/projects/settings/type_form.rb@@ -0,0 +1,39 @@+# 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 Projects+ module Settings+ class TypeForm < ApplicationForm+ form do |f|+ f.hidden name: :workspace_type,+ value: Project.workspace_types[:project]+ end+ end+ end+enddiff --git a/app/models/permitted_params.rb b/app/models/permitted_params.rbindex 58764f3c7d4..d7e786e832c 100644--- a/app/models/permitted_params.rb+++ b/app/models/permitted_params.rb@@ -297,7 +297,7 @@ class PermittedParamsdef new_projectparams- .expect(project: %i[name parent_id])+ .expect(project: %i[name parent_id workspace_type]).merge(custom_field_values(:project))enddiff --git a/spec/models/permitted_params_spec.rb b/spec/models/permitted_params_spec.rbindex 66b16d392a2..683c989a4dd 100644--- a/spec/models/permitted_params_spec.rb+++ b/spec/models/permitted_params_spec.rb@@ -261,19 +261,19 @@ RSpec.describe PermittedParams dolet(:hash_key) { "project" }context "with minimal params" do- let(:hash) { { "name" => "Brand New Project" } }+ let(:hash) { { "name" => "Brand New Project", "workspace_type" => "project" } }it_behaves_like "allows params"endcontext "with parent_id" do- let(:hash) { { "name" => "Brand New Project", "parent_id" => "19" } }+ let(:hash) { { "name" => "Brand New Project", "workspace_type" => "project", "parent_id" => "19" } }it_behaves_like "allows params"endcontext "with custom_field_values" do- let(:hash) { { "name" => "Brand New Project", "custom_field_values" => { "4" => "21" } } }+ let(:hash) { { "name" => "Brand New Project", "workspace_type" => "project", "custom_field_values" => { "4" => "21" } } }it_behaves_like "allows params"end