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
Allow multiple custom components
Klaus Zanders825a62d0a926
diff --git a/app/components/shares/modal_body_component.html.erb b/app/components/shares/modal_body_component.html.erbindex 2995901dc0d..f66a46615a4 100644--- a/app/components/shares/modal_body_component.html.erb+++ b/app/components/shares/modal_body_component.html.erb@@ -1,11 +1,13 @@<%=component_wrapper(tag: 'turbo-frame') doflex_layout(data: { turbo: true }) do |modal_content|- if strategy.custom_body_component?- render(strategy.additional_body_component.new(strategy: strategy, modal_body_container: modal_content))+ if strategy.custom_body_components?+ strategy.additional_body_components.each do |component|+ render(component.new(strategy: strategy, modal_body_container: modal_content))+ endend- modal_content.with_row(mt: (strategy.custom_body_component? ? 3 : nil)) do+ modal_content.with_row(mt: (strategy.custom_body_components? ? 3 : nil)) dorender(Shares::InviteUserFormComponent.new(strategy:, errors: errors))enddiff --git a/app/models/sharing_strategies/base_strategy.rb b/app/models/sharing_strategies/base_strategy.rbindex 6b1a82fb59f..9976d93c325 100644--- a/app/models/sharing_strategies/base_strategy.rb+++ b/app/models/sharing_strategies/base_strategy.rb@@ -61,13 +61,13 @@ module SharingStrategiesraise NotImplementedError, "Override in a subclass and return the contract class for deleting a share"end- def custom_body_component?- additional_body_component.present?+ def custom_body_components?+ !additional_body_components.empty?end- # Override by returning a component class that should be rendered in the sharing dialog above the table of shares- def additional_body_component- nil+ # Override by returning a list of component classes that should be rendered in the sharing dialog above the table of shares+ def additional_body_components+ []enddef custom_empty_state_component?diff --git a/app/models/sharing_strategies/project_query_strategy.rb b/app/models/sharing_strategies/project_query_strategy.rbindex 981b3fa7359..dc600fb2c1b 100644--- a/app/models/sharing_strategies/project_query_strategy.rb+++ b/app/models/sharing_strategies/project_query_strategy.rb@@ -62,8 +62,11 @@ module SharingStrategiesShares::ProjectQueries::DeleteContractend- def additional_body_component- Shares::ProjectQueries::PublicFlagComponent+ def additional_body_components+ [+ Shares::ProjectQueries::PublicFlagComponent,+ Shares::ProjectQueries::ProjectAccessWarningComponent+ ]enddef empty_state_componentdiff --git a/config/locales/en.yml b/config/locales/en.ymlindex a868c0e24b3..ff76954e8a2 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -3675,6 +3675,10 @@ en:additional_privileges_group: "Might have additional privileges (as group member)"additional_privileges_project_or_group: "Might have additional privileges (as project or group member)"project_queries:+ access_warning: "Users will only see the projects they have access to. Sharing project lists does not impact individual project permissions."+ public_flag:+ label: "Share with everyone at %{instance_name}"+ caption: "Everyone can view this project list. Those with global edit permissions can modify it."text_empty_state_header: "Shared with everyone"text_empty_state_description: "Everyone can view this project list. You can also add individual users with extra permissions."permissions: