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

Update preview

Oliver Günther2d2ed491e6d8
diff --git a/app/components/enterprise_edition/banner_component.html.erb b/app/components/enterprise_edition/banner_component.html.erb
index d024384ee18..f202a85c2a9 100644
--- a/app/components/enterprise_edition/banner_component.html.erb
+++ b/app/components/enterprise_edition/banner_component.html.erb
@@ -36,7 +36,7 @@
classes: "op-enterprise-banner--close-icon",
scheme: :invisible,
tag: :a,
- href: dismiss_enterprise_banner_path(feature_key:),
+ href: dismiss_enterprise_banner_path(feature_key: @dismiss_key),
data: { turbo_stream: true, turbo_method: :post },
icon: :x,
aria: { label: t("ee.upsale.hide_banner") }
diff --git a/app/components/enterprise_edition/upsale_page_component.html.erb b/app/components/enterprise_edition/upsale_page_component.html.erb
index 723f404b74a..7bcde81f8ff 100644
--- a/app/components/enterprise_edition/upsale_page_component.html.erb
+++ b/app/components/enterprise_edition/upsale_page_component.html.erb
@@ -1,8 +1,7 @@
-<% helpers.write_augur_to_gon %>
-
-<% if !EnterpriseToken.current.present? %>
- <% helpers.write_trial_key_to_gon %>
-<% end %>
+<% if respond_to?(:gon) %>
+ <% helpers.write_augur_to_gon %>
+ <% helpers.write_trial_key_to_gon if !EnterpriseToken.current.present? %>
+ <% end %>
<div class="op-enterprise-upsale-page">
<%=
diff --git a/app/components/work_packages/types/subject_configuration_component.html.erb b/app/components/work_packages/types/subject_configuration_component.html.erb
index b5141bf2ab8..03b77fd4e42 100644
--- a/app/components/work_packages/types/subject_configuration_component.html.erb
+++ b/app/components/work_packages/types/subject_configuration_component.html.erb
@@ -28,9 +28,7 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
<%=
- render(EnterpriseEdition::BannerComponent.new(:work_package_subject_generation,
- dismissable: true,
- mb: 3))
+ render(EnterpriseEdition::BannerComponent.new(:work_package_subject_generation))
%>
<%=
diff --git a/lookbook/previews/open_project/enterprise_edition/banner_component_preview.rb b/lookbook/previews/open_project/enterprise_edition/banner_component_preview.rb
index 7dae51d9d28..116a0f719ed 100644
--- a/lookbook/previews/open_project/enterprise_edition/banner_component_preview.rb
+++ b/lookbook/previews/open_project/enterprise_edition/banner_component_preview.rb
@@ -38,8 +38,6 @@ module OpenProject
# ee:
# # Title used unless it is overwritten for the specific feature
# title: "Enterprise add-on"
- # # Title of the link used unless it is overwritten for the specific feature
- # link_title: "More information"
# upsale:
# [feature_key]:
# # Title used for this feature only. If this is missing, the default title is used.
@@ -48,27 +46,27 @@ module OpenProject
# description: "This is a splendid feature that you should use. It just might transform your life."
# # Title of the link used for this feature only. If this is missing, the default link title is used.
# title_link: "Even more information"
+ # # An unordered list of features
+ # features:
+ # some_key: "Some feature"
+ # some_other_key: "Some other feature"
# ```
+ # You can also provide a custom i18n_scope to change the place where the component looks for
+ # title, description, and features.
#
# The href is inferred from `OpenProject::Static::Links.enterprise_docs[feature_key][:href]`.
- def default
+ # @param dismissable toggle
+ def default(dismissable: false)
render(
::EnterpriseEdition::BannerComponent
- .new(:customize_life_cycle,
- skip_render: false)
+ .new(:customize_life_cycle, dismissable:)
)
end
- # The defaults can be completely overwritten. This should be used sparingly.
- def manual_overwrite
+ def dismissable
render(
::EnterpriseEdition::BannerComponent
- .new(nil,
- title: "A splendid feature",
- description: "This is a splendid feature that you should use. It just might transform your life.",
- href: "https://www.openproject.org",
- link_title: "Get more information",
- skip_render: false)
+ .new(:customize_life_cycle, dismiss_key: nil, dismissable: true)
)
end
end
diff --git a/lookbook/previews/open_project/enterprise_edition/upsale_page_component_preview.rb b/lookbook/previews/open_project/enterprise_edition/upsale_page_component_preview.rb
new file mode 100644
index 00000000000..ac1a7898486
--- /dev/null
+++ b/lookbook/previews/open_project/enterprise_edition/upsale_page_component_preview.rb
@@ -0,0 +1,87 @@
+# frozen_string_literal: true
+
+# -- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+# ++
+
+module OpenProject
+ module EnterpriseEdition
+ # @logical_path OpenProject/EnterpriseEdition
+ class UpsalePageComponentPreview < Lookbook::Preview
+ # Render a full-screen upsale page, with optional video or image features.
+ # The easiest way to render the banner component is to provide a feature key and
+ # have the assorted data structures match the expectations.
+ # The text will be fetched from the i18n files:
+ # ```
+ # en:
+ # ee:
+ # # Title used unless it is overwritten for the specific feature
+ # title: "Enterprise add-on"
+ # upsale:
+ # [feature_key]:
+ # # Title used for this feature only. If this is missing, the default title is used.
+ # title: "A splendid feature"
+ # # Could also be description_html if necessary
+ # description: "This is a splendid feature that you should use. It just might transform your life."
+ # # Title of the link used for this feature only. If this is missing, the default link title is used.
+ # title_link: "Even more information"
+ # # An unordered list of features
+ # features:
+ # some_key: "Some feature"
+ # some_other_key: "Some other feature"
+ # ```
+ # You can also provide a custom i18n_scope to change the place where the component looks for
+ # title, description, and features.
+ #
+ # To provide a video or image, use the respective `video:` or `image:` tags.
+ # If none or provided, a default image will be used.
+ #
+ # The href is inferred from `OpenProject::Static::Links.enterprise_docs[feature_key][:href]`.
+ def default
+ render(
+ ::EnterpriseEdition::UpsalePageComponent
+ .new(:customize_life_cycle)
+ )
+ end
+
+ def video
+ render(
+ ::EnterpriseEdition::UpsalePageComponent
+ .new(:date_alerts,
+ video: "enterprise/date-alert-notifications.mp4")
+ )
+ end
+
+ def image
+ render(
+ ::EnterpriseEdition::UpsalePageComponent
+ .new(:ldap_groups, image: "enterprise/ldap-groups.jpg")
+ )
+ end
+ end
+ end
+end