Skip to content

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

Add custom handling for some trial banners

Mir Bhatiaa8e222991670
diff --git a/app/components/settings/project_life_cycle_step_definitions/index_component.html.erb b/app/components/settings/project_life_cycle_step_definitions/index_component.html.erb
index e6a8145822c..93bfb3498fb 100644
--- a/app/components/settings/project_life_cycle_step_definitions/index_component.html.erb
+++ b/app/components/settings/project_life_cycle_step_definitions/index_component.html.erb
@@ -31,7 +31,14 @@ See COPYRIGHT and LICENSE files for more details.
component_wrapper do
flex_layout(data: wrapper_data_attributes) do |flex|
flex.with_row do
- if allowed_to_customize_life_cycle?
+ render EnterpriseEdition::BannerComponent.new(:customize_life_cycle,
+ variant: :medium,
+ image: "enterprise/project-lifecycle.png",
+ mb: 3)
+ end
+
+ if allowed_to_customize_life_cycle?
+ flex.with_row do
render(Primer::OpenProject::SubHeader.new) do |subheader|
subheader.with_filter_input(
name: "border-box-filter",
@@ -57,11 +64,6 @@ See COPYRIGHT and LICENSE files for more details.
I18n.t("settings.project_phase_definitions.label_add")
end
end
- else
- render EnterpriseEdition::BannerComponent.new(:customize_life_cycle,
- variant: :medium,
- image: "enterprise/project-lifecycle.png",
- mb: 3)
end
end
diff --git a/app/components/shares/modal_body_component.html.erb b/app/components/shares/modal_body_component.html.erb
index 3bc42afca95..d2da46e0b2a 100644
--- a/app/components/shares/modal_body_component.html.erb
+++ b/app/components/shares/modal_body_component.html.erb
@@ -7,7 +7,9 @@
end
end
- render(strategy.manage_shares_component(modal_content:, errors:))
+ render(Shares::ProjectQueries::UpsellComponent.new(modal_content:))
+
+ render(strategy.manage_shares_component(modal_content:, errors:)) if EnterpriseToken.allows_to?(:project_list_sharing)
end
end
%>
diff --git a/app/controllers/concerns/projects/life_cycle_definition_helper.rb b/app/controllers/concerns/projects/life_cycle_definition_helper.rb
index 76cc76672e3..da94f719d2b 100644
--- a/app/controllers/concerns/projects/life_cycle_definition_helper.rb
+++ b/app/controllers/concerns/projects/life_cycle_definition_helper.rb
@@ -32,6 +32,6 @@ module Projects::LifeCycleDefinitionHelper
private
def allowed_to_customize_life_cycle?
- EnterpriseToken.allows_to?(:customize_life_cycle)
+ EnterpriseToken.allows_to?(:customize_life_cycle) || EnterpriseToken.trialling?(:customize_life_cycle)
end
end
diff --git a/app/forms/statuses/form.rb b/app/forms/statuses/form.rb
index 2948f1356aa..cac0631dde9 100644
--- a/app/forms/statuses/form.rb
+++ b/app/forms/statuses/form.rb
@@ -86,10 +86,8 @@ module Statuses
}
)
- if readonly_work_packages_restricted?
- statuses_form.html_content do
- render(EnterpriseEdition::BannerComponent.new(:readonly_work_packages))
- end
+ statuses_form.html_content do
+ render(EnterpriseEdition::BannerComponent.new(:readonly_work_packages))
end
statuses_form.check_box(
diff --git a/app/models/sharing_strategies/project_query_strategy.rb b/app/models/sharing_strategies/project_query_strategy.rb
index 9ee3c9922e1..da6428bca5b 100644
--- a/app/models/sharing_strategies/project_query_strategy.rb
+++ b/app/models/sharing_strategies/project_query_strategy.rb
@@ -105,14 +105,6 @@ module SharingStrategies
end
end
- def manage_shares_component(modal_content:, errors:)
- if EnterpriseToken.allows_to?(:project_list_sharing)
- super
- else
- Shares::ProjectQueries::UpsellComponent.new(modal_content:)
- end
- end
-
def title
I18n.t(:label_share_project_list)
end
diff --git a/app/views/custom_fields/new.html.erb b/app/views/custom_fields/new.html.erb
index 448c0fba16d..1fd6d04aa3e 100644
--- a/app/views/custom_fields/new.html.erb
+++ b/app/views/custom_fields/new.html.erb
@@ -46,7 +46,8 @@ See COPYRIGHT and LICENSE files for more details.
<% content_controller "admin--custom-fields",
dynamic: true,
"admin--custom-fields-format-config-value": OpenProject::CustomFieldFormatDependent.stimulus_config,
- "admin--custom-fields-enterprise-edition-value": EnterpriseToken.allows_to?(:custom_field_hierarchies) %>
+ "admin--custom-fields-enterprise-edition-value": !EnterpriseToken.allows_to?(:custom_field_hierarchies) || EnterpriseToken.trialling?(:custom_field_hierarchies),
+ "admin--custom-fields-hierarchy-enabled-value": EnterpriseToken.allows_to?(:custom_field_hierarchies) || EnterpriseToken.trialling?(:custom_field_hierarchies) %>
<%= labelled_tabular_form_for @custom_field, as: :custom_field,
url: custom_fields_path,
diff --git a/config/locales/en.yml b/config/locales/en.yml
index a122ce78654..aec1f171ab8 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -2094,7 +2094,6 @@ en:
readonly_work_packages: Readonly Work Packages
sso_auth_providers: Single sign-on
team_planner_view: Team Planner View
- two_factor_authentication: 2FA Authentication
virus_scanning: Antivirus Scanning
work_package_query_relation_columns: Work Package Query Relation Columns
work_package_sharing: Share work packages with external users
diff --git a/frontend/src/stimulus/controllers/dynamic/admin/custom-fields.controller.ts b/frontend/src/stimulus/controllers/dynamic/admin/custom-fields.controller.ts
index d0d72100077..325e12db1d6 100644
--- a/frontend/src/stimulus/controllers/dynamic/admin/custom-fields.controller.ts
+++ b/frontend/src/stimulus/controllers/dynamic/admin/custom-fields.controller.ts
@@ -56,10 +56,12 @@ export default class CustomFieldsController extends Controller {
static values = {
formatConfig: Array,
enterpriseEdition: Boolean,
+ hierarchyEnabled: Boolean,
};
declare readonly formatConfigValue:[string, string, string[]][];
declare readonly enterpriseEditionValue:boolean;
+ declare readonly hierarchyEnabledValue:boolean;
declare readonly formatTarget:HTMLInputElement;
declare readonly dragContainerTarget:HTMLElement;
@@ -252,13 +254,13 @@ export default class CustomFieldsController extends Controller {
private toggleFormat(format:string) {
if (this.hasSubmitButtonTarget) {
- this.submitButtonTarget.disabled = format === 'hierarchy' && !this.enterpriseEditionValue;
+ this.submitButtonTarget.disabled = format === 'hierarchy' && !this.hierarchyEnabledValue;
}
this.formatConfigValue.forEach(([targetsName, operator, formats]) => {
let active = operator === 'only' ? formats.includes(format) : !formats.includes(format);
- if (targetsName === 'enterpriseBanner' && this.enterpriseEditionValue) {
- active = false;
+ if (targetsName === 'enterpriseBanner') {
+ active = this.enterpriseEditionValue;
}
const targets = this[`${targetsName}Targets` as keyof typeof this] as HTMLElement[];