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

Type form banner

Oliver Günther4ff01e16d82f
diff --git a/app/components/enterprise_edition/banner_component.html.erb b/app/components/enterprise_edition/banner_component.html.erb
index 06e5ae5862c..5123bca9211 100644
--- a/app/components/enterprise_edition/banner_component.html.erb
+++ b/app/components/enterprise_edition/banner_component.html.erb
@@ -12,7 +12,14 @@
end
end
grid.with_area(:"title-container") { render(Primer::Beta::Text.new) { title } }
- grid.with_area(:"description-container") { render(Primer::Beta::Text.new) { description } }
+ grid.with_area(:"description-container") do
+ if features.present?
+ concat render(Primer::Beta::Text.new) { description }
+ concat content_tag(:ul) { safe_join features.map { |text| render(Primer::Beta::Text.new(tag: :li)) { text } } }
+ else
+ render(Primer::Beta::Text.new) { description }
+ end
+ end
grid.with_area(:"link-container") do
render(Primer::Beta::Link.new(href: href)) do |link|
link.with_trailing_visual_icon(icon: "link-external")
diff --git a/app/components/enterprise_edition/banner_component.rb b/app/components/enterprise_edition/banner_component.rb
index abfc69f6e3d..39c2c586320 100644
--- a/app/components/enterprise_edition/banner_component.rb
+++ b/app/components/enterprise_edition/banner_component.rb
@@ -76,20 +76,28 @@ module EnterpriseEdition
def description
@description || begin
- I18n.t("ee.upsale.#{feature_key}.description")
- rescue StandardError
- I18n.t("ee.upsale.#{feature_key}.description_html")
+ if I18n.exists?(:"ee.upsale.#{feature_key}.description_html")
+ I18n.t("ee.upsale.#{feature_key}.description_html").html_safe
+ else
+ I18n.t("ee.upsale.#{feature_key}.description")
+ end
end
rescue I18n::MissingTranslationData => e
raise e.exception(
<<~TEXT.squish
- The expected '#{I18n.locale}.ee.upsale.#{feature_key}.description' key does not exist.
+ The expected '#{I18n.locale}.ee.upsale.#{feature_key}.description' nor '#{I18n.locale}.ee.upsale.#{feature_key}.description_html' key does not exist.
Ideally, provide it in the locale file.
If that isn't applicable, a description parameter needs to be provided.
TEXT
)
end
+ def features
+ return @features if defined?(@features)
+
+ @features = I18n.t("ee.upsale.#{feature_key}.features", default: nil)&.values
+ end
+
def plan
@plan ||= OpenProject::Token.lowest_plan_for(feature_key)&.capitalize
end
diff --git a/app/components/enterprise_edition/banner_component.sass b/app/components/enterprise_edition/banner_component.sass
index ba58b9d00e6..2d69234897d 100644
--- a/app/components/enterprise_edition/banner_component.sass
+++ b/app/components/enterprise_edition/banner_component.sass
@@ -65,4 +65,4 @@ $op-ee-banner--shield-width: 32px
font-weight: bold
&--link-container
- align-self: end
+ align-self: start
diff --git a/app/views/types/form/_form_configuration.html.erb b/app/views/types/form/_form_configuration.html.erb
index fdfbe274a48..ea1ed0f9310 100644
--- a/app/views/types/form/_form_configuration.html.erb
+++ b/app/views/types/form/_form_configuration.html.erb
@@ -33,19 +33,15 @@ See COPYRIGHT and LICENSE files for more details.
<div>
<div class="grid-block -visible-overflow wrap">
<div class="grid-content -visible-overflow small-12 large-10">
+ <%=
+ render(EnterpriseEdition::BannerComponent.new(:form_configuration, mb: 3))
+ %>
+
<% if EnterpriseToken.show_banners? %>
<%= angular_component_tag "opce-no-results",
inputs: {
title: t("text_form_configuration") + t("text_custom_field_hint_activate_per_project")
} %>
- <%= angular_component_tag "opce-enterprise-banner",
- inputs: {
- collapsible: true,
- opReferrer: "form-configuration",
- topMargin: true,
- textMessage: t("types.edit.more_info_text_html"),
- moreInfoLink: OpenProject::Static::Links.links[:enterprise_docs][:form_configuration][:href]
- } %>
<% end %>
</div>
</div>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 39ce4a6d541..ff52f90e0af 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -657,13 +657,6 @@ en:
edit:
form_configuration:
tab: "Form configuration"
- more_info_text_html: >
- Enterprise edition allows you to customize form configuration with these additional add-ons: <br>
- <ul class="%{list_styling_class}">
- <li><b>Add new attribute groups</b></li>
- <li><b>Rename attribute groups</b></li>
- <li><b>Add a table of related work packages</b></li>
- </ul>
projects:
tab: "Projects"
enabled_projects: "Enabled projects"
@@ -2059,9 +2052,11 @@ en:
conditional_highlighting:
description: "Need certain work packages to stand out from the mass? Use conditional highlighting in the work packages table."
form_configuration:
- description: "Customize the form configuration with these additional add-ons:"
- add_groups: "Add new attribute groups"
- rename_groups: "Rename attributes groups"
+ description: "Customize form configuration with these additional add-ons:"
+ features:
+ groups: "Add new attribute groups"
+ rename: "Rename attribute groups"
+ related: "Add a table of related work packages"
enumeration_activities: "Time tracking activities"
enumeration_work_package_priorities: "Work package priorities"