From 0c8a388dd87453f6914786b7d83e3e996bc8ab81 Mon Sep 17 00:00:00 2001 From: Klaus Zanders Date: Tue, 25 Feb 2025 11:43:32 +0100 Subject: [PATCH] add enterprise plan and features to the view (rails side) --- app/models/enterprise_token.rb | 2 ++ app/views/enterprises/_current.html.erb | 2 ++ config/locales/en.yml | 29 +++++++++++++++++++++++++ 3 files changed, 33 insertions(+) diff --git a/app/models/enterprise_token.rb b/app/models/enterprise_token.rb index 1e064f48c2c0..dd43d7de04b1 100644 --- a/app/models/enterprise_token.rb +++ b/app/models/enterprise_token.rb @@ -76,6 +76,8 @@ def set_current_token :reprieve_days, :reprieve_days_left, :restrictions, + :plan, + :features, to: :token_object def token_object diff --git a/app/views/enterprises/_current.html.erb b/app/views/enterprises/_current.html.erb index c1d737fff8e7..4e3aaafe6b5e 100644 --- a/app/views/enterprises/_current.html.erb +++ b/app/views/enterprises/_current.html.erb @@ -3,10 +3,12 @@ data-email="<%= @current_token.mail %>" data-company="<%= @current_token.try(:company) %>" data-domain="<%= @current_token.try(:domain) %>" + data-plan="<%= (@current_token.respond_to?(:plan) ? I18n.t(@current_token.plan, scope: [:enterprise_plans]) : nil) %>" data-user-count="<%= @current_token.restrictions.nil? ? t("js.admin.enterprise.upsale.unlimited") : @current_token.restrictions[:active_user_count] %>" data-starts-at="<%= format_date @current_token.starts_at %>" data-expires-at="<%= @current_token.will_expire? ? (format_date @current_token.expires_at) : t("js.admin.enterprise.upsale.unlimited") %>" data-is-expired="<%= @current_token.expired?(reprieve: false) %>" + data-additional-features="<%= (@current_token.try(:features) || []).map { |feature| I18n.t(feature, scope: [:enterprise_features], default: feature.to_s.humanize) }.join(", ") %>" data-reprieve-days-left="<%= @current_token.reprieve_days_left %>"> diff --git a/config/locales/en.yml b/config/locales/en.yml index dbeeaa34aa29..97c75f93f8c7 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -4493,3 +4493,32 @@ en: plugin_openproject_auth_saml: name: "OmniAuth SAML / Single-Sign On" description: "Adds the OmniAuth SAML provider to OpenProject" + + enterprise_plans: + corporate: Corporate Plan + enterprise: Enterprise Plan + + enterprise_features: + baseline_comparison: Baseline Comparison + board_view: Board View + conditional_highlighting: Conditional Highlighting + custom_actions: Custom Actions + custom_field_hierarchies: Custom Field Hierarchies + customize_life_cycle: Customize Life Cycle + date_alerts: Date Alerts + define_custom_style: Define Custom Style + edit_attribute_groups: Edit Attribute Groups + gantt_pdf_export: Gantt PDF Export + grid_widget_wp_graph: Grid Widget Work Package Graph + ldap_groups: LDAP Groups + one_drive_sharepoint_file_storage: OneDrive/SharePoint File Storage + placeholder_users: Placeholder Users + project_list_sharing: Project List Sharing + readonly_work_packages: Readonly Work Packages + sso_auth_providers: SSO Auth Providers + team_planner_view: Team Planner View + two_factor_authentication: Two-Factor Authentication + virus_scanning: Attachment Virus Scanning + work_package_query_relation_columns: Work Package Query Relation Columns + work_package_sharing: Work Package Sharing + work_package_subject_generation: Work Package Subject Generation