mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
hide parent selection on portfolio creation
This commit is contained in:
@@ -40,7 +40,7 @@ See COPYRIGHT and LICENSE files for more details.
|
||||
Primer::Forms::FormList.new(
|
||||
Projects::Settings::NameForm.new(f),
|
||||
Projects::Settings::DescriptionForm.new(f),
|
||||
Projects::Settings::RelationsForm.new(f, visible: params[:parent_id].blank?),
|
||||
Projects::Settings::RelationsForm.new(f, visible: relation_form_visible?),
|
||||
Projects::Settings::TypeForm.new(f)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -53,5 +53,9 @@ module Projects
|
||||
|
||||
url_for(workspace_type.pluralize.to_sym)
|
||||
end
|
||||
|
||||
def relation_form_visible?
|
||||
project.parent_allowed? && params[:parent_id].blank?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -279,8 +279,6 @@ class Project < ApplicationRecord
|
||||
name
|
||||
end
|
||||
|
||||
def allowed_parent_workspace_types = ALLOWED_PARENT_WORKSPACE_TYPES[workspace_type] || []
|
||||
|
||||
def workspace_label
|
||||
case workspace_type
|
||||
when "program"
|
||||
|
||||
@@ -171,5 +171,11 @@ module Projects::Hierarchy
|
||||
end
|
||||
stmt
|
||||
end
|
||||
|
||||
def allowed_parent_workspace_types = Project::ALLOWED_PARENT_WORKSPACE_TYPES[workspace_type] || []
|
||||
|
||||
def parent_allowed?
|
||||
allowed_parent_workspace_types.any?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -65,9 +65,9 @@ RSpec.describe "Portfolios",
|
||||
# Step 2: Fill in project details
|
||||
fill_in "Name", with: "Foo bar"
|
||||
|
||||
expect(page).to have_combo_box "Subproject of"
|
||||
parent_field.expect_no_option "Other portfolio"
|
||||
parent_field.expect_no_option "Root portfolio" # Since no a project cannot have a parent
|
||||
# No parent field since portfolios are always root elements
|
||||
expect(page)
|
||||
.not_to have_combo_box "Subproject of"
|
||||
|
||||
click_on "Complete"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user