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
Large style banner
Oliver Güntherfc88fe1b31d2
diff --git a/app/components/enterprise_edition/banner_component.html.erb b/app/components/enterprise_edition/banner_component.html.erbindex 58db2231c33..91c4fd6e3d4 100644--- a/app/components/enterprise_edition/banner_component.html.erb+++ b/app/components/enterprise_edition/banner_component.html.erb@@ -13,8 +13,11 @@grid.with_area(:content) doflex_layout do |flex|flex.with_row do- if medium?- flex_layout(align_items: :center, mb: 3) do |title_flex|+ if medium? || large?+ flex_layout(+ classes: "op-enterprise-banner--title-wrapper",+ align_items: :center,+ mb: 3) do |title_flex|title_flex.with_column dorender(Primer::Beta::Octicon.new(@@ -36,7 +39,10 @@flex.with_row(classes: "op-enterprise-banner--description") doconcat render(Primer::Beta::Text.new(tag: :p)) { description }- concat render(Primer::Beta::Text.new(tag: :p)) { plan_text }++ unless large?+ concat render(Primer::Beta::Text.new(tag: :p)) { plan_text }+ endendif features.present?@@ -45,8 +51,26 @@endend+ if large?+ flex.with_row(my: 2) do+ video_tag @video,+ controls: false,+ class: "op-enterprise-banner--video-control",+ autoplay: true,+ loop: true,+ muted: true+ end++ flex.with_row do+ render(Primer::Beta::Text.new(tag: :p, text_align: :center)) { plan_text }+ end+ end+flex.with_row(mt: 1) do- render EnterpriseEdition::UpsellButtonsComponent.new(feature_key)+ render EnterpriseEdition::UpsellButtonsComponent.new(+ feature_key,+ justify_content: (large? ? :center : :flex_start)+ )endendenddiff --git a/app/components/enterprise_edition/banner_component.rb b/app/components/enterprise_edition/banner_component.rbindex 22f00940ec5..9f778e107d2 100644--- a/app/components/enterprise_edition/banner_component.rb+++ b/app/components/enterprise_edition/banner_component.rb@@ -41,12 +41,14 @@ module EnterpriseEditioninclude PlanForFeatureDEFAULT_VARIANT = :inline- VARIANT_OPTIONS = %i[inline medium].freeze+ VARIANT_OPTIONS = %i[inline medium large].freeze# @param feature_key [Symbol, NilClass] The key of the feature to show the banner for.# @param variant [Symbol, NilClass] The variant of the banner comopnent.# @param image [String, NilClass] Path to the image to show on the banner, or nil.- # Required when variant is :medium.+ # Only applicable and required when variant is :medium.+ # @param video [String, NilClass] Path to the video to show on the banner, or nil.+ # Only applicable and required when variant is :video.# @param i18n_scope [String] Provide the i18n scope to look for title, description, and features.# Defaults to "ee.upsell.{feature_key}"# @param dismissable [boolean] Allow this banner to be dismissed.@@ -56,6 +58,7 @@ module EnterpriseEditiondef initialize(feature_key, # rubocop:disable Metrics/AbcSizevariant: DEFAULT_VARIANT,image: nil,+ video: nil,i18n_scope: "ee.upsell.#{feature_key}",dismissable: false,show_always: false,@@ -63,6 +66,7 @@ module EnterpriseEdition**system_arguments)@variant = fetch_or_fallback(VARIANT_OPTIONS, variant, DEFAULT_VARIANT)@image = image+ @video = video@dismissable = dismissable@dismiss_key = dismiss_key@show_always = show_always@@ -74,6 +78,10 @@ module EnterpriseEditionraise ArgumentError, "The 'image' parameter is required when the variant is :medium."end+ if @variant == :large && @video.nil?+ raise ArgumentError, "The 'video' parameter is required when the variant is :large."+ end+@system_arguments = system_arguments@system_arguments[:tag] = :div@system_arguments[:mb] ||= 2@@ -82,7 +90,8 @@ module EnterpriseEdition@system_arguments[:classes] = class_names(@system_arguments[:classes],"op-enterprise-banner",- @variant == :medium ? "op-enterprise-banner_medium" : nil+ @variant == :medium ? "op-enterprise-banner_medium" : nil,+ @variant == :large ? "op-enterprise-banner_large" : nil)super@@ -97,6 +106,10 @@ module EnterpriseEdition@variant == :mediumend+ def large?+ @variant == :large+ end+def inline?@variant == :inlineenddiff --git a/app/components/enterprise_edition/banner_component.sass b/app/components/enterprise_edition/banner_component.sassindex 776e6108ad4..140a8796886 100644--- a/app/components/enterprise_edition/banner_component.sass+++ b/app/components/enterprise_edition/banner_component.sass@@ -28,7 +28,8 @@/ ++/-$op-enterprise-banner-fixed-height: 220px+$op-enterprise-banner-fixed-height-medium: 220px+$op-enterprise-banner-fixed-height-large: 320px.op-enterprise-bannerdisplay: grid@@ -47,7 +48,7 @@ $op-enterprise-banner-fixed-height: 220pxpadding: 0grid-template-areas: "content graphic"grid-template-columns: 2fr 1fr- height: $op-enterprise-banner-fixed-height+ height: $op-enterprise-banner-fixed-height-medium@media screen and (max-width: $breakpoint-lg)grid-template-columns: 1fr@@ -63,9 +64,38 @@ $op-enterprise-banner-fixed-height: 220pxalign-self: centerpadding: var(--base-size-16)+ &_large+ position: relative+ padding: 0+ display: flex+ justify-content: center+ grid-template-areas: "content"+ grid-template-columns: 100%++ &_large &+ &--title-wrapper+ justify-content: center++ &--description+ text-align: center+&--image@include upsell-image+ &--video-control+ display: block+ margin: 0 auto+ max-width: 50vw+ object-fit: contain+ box-shadow: var(--shadow-floating-small)+ border-radius: 25px+ border: 1px solid var(--borderColor-default)++ @media screen and (max-width: $breakpoint-md)+ max-width: unset+ width: 100%+ border-radius: 15px+&--visualdisplay: gridalign-self: start@@ -77,7 +107,7 @@ $op-enterprise-banner-fixed-height: 220px&--close-icon.Button-visual- color: var(--enterprise-upsell-color)+ color: var(--enterprise-upsell-color)&_hoveringposition: absolutediff --git a/lookbook/docs/components/enterprise.md.erb b/lookbook/docs/components/enterprise.md.erbindex 540d71ba7d2..bce4149ce49 100644--- a/lookbook/docs/components/enterprise.md.erb+++ b/lookbook/docs/components/enterprise.md.erb@@ -65,22 +65,6 @@ If none is provided, the link will go to the enterprise landing page on our websThere are three varations of the Enterprise banner.-### Full-page upsell banner--The full-page upsell banner is used an entire page is inaccessible to the current user because their plan does not include that feature (vs. only a part of that feature not being available). The full page banner also allows us to provide a feature video or large illustration.--For example: when a community user clicks on the 'Team planner' module (but it's not included in their plan), or if they go to the Project admin settings and navigate to the 'Internal comments' tab under Work packages.--```ruby-render EnterpriseEdition::UpsellPageComponent.new(- :enterprise_feature,- video: "enterprise/some-video.mp4",- # or image: "enterprise/some-image.png"-)-```--<%= embed OpenProject::EnterpriseEdition::UpsellPageComponentPreview, :default, panels: %i[] %>-### Inline upsell bannersInline upsell banners are useful when you want to indicate that part of a functionality or a page isn't available in the current plan. This allows the banner to be placed within a page where other parts are functional.@@ -127,3 +111,20 @@ render EnterpriseEdition::BannerComponent.new(:enterprise_feature, variant: :med```<%= embed OpenProject::EnterpriseEdition::BannerComponentPreview, :medium, panels: %i[] %>++## Large variant banners++The large variant upsell banner is used an entire page is inaccessible to the current user because their plan does not include that feature (vs. only a part of that feature not being available).+This banner is used when there is an illustration video present that requires this amount of space.++For example: when a community user clicks on the 'Team planner' module (but it's not included in their plan)++```ruby+render EnterpriseEdition::BannerComponent.new(+ :enterprise_feature,+ variant: :large,+ video: "enterprise/some-video.mp4",+)+```++<%= embed OpenProject::EnterpriseEdition::BannerComponentPreview, :large, panels: %i[] %>diff --git a/lookbook/previews/open_project/enterprise_edition/banner_component_preview.rb b/lookbook/previews/open_project/enterprise_edition/banner_component_preview.rbindex 159fcf9c883..d9174206deb 100644--- a/lookbook/previews/open_project/enterprise_edition/banner_component_preview.rb+++ b/lookbook/previews/open_project/enterprise_edition/banner_component_preview.rb@@ -73,6 +73,17 @@ module OpenProject)end+ # @display min_height 600px+ def large+ render(+ ::EnterpriseEdition::BannerComponent+ .new(:date_alerts,+ variant: :large,+ video: "enterprise/date-alert-notifications.mp4",+ show_always: true)+ )+ end+# @display min_height 350pxdef medium_dismissablerender(diff --git a/spec/components/enterprise_edition/banner_component_spec.rb b/spec/components/enterprise_edition/banner_component_spec.rbindex 65b43e77ba7..0731ac03bb2 100644--- a/spec/components/enterprise_edition/banner_component_spec.rb+++ b/spec/components/enterprise_edition/banner_component_spec.rb@@ -87,8 +87,8 @@ RSpec.describe EnterpriseEdition::BannerComponent, type: :component doallow(OpenProject::Token).to receive(:lowest_plan_for)- .with(:some_enterprise_feature)- .and_return(plan)+ .with(:some_enterprise_feature)+ .and_return(plan)I18n.config.enforce_available_locales = !enforce_available_locales@@ -269,4 +269,30 @@ RSpec.describe EnterpriseEdition::BannerComponent, type: :component doexpect(component).to have_link("More information", href: "https://example.com")endend++ context "with large variant" do+ context "with video parameter" do+ let(:component_args) { { variant: :large, video: "enterprise/date-alert-notifications.mp4" } }++ it_behaves_like "renders the component"++ it "renders with large variant class" do+ render_component_in_mo++ component = find_test_selector(component_test_selector)++ expect(component[:class]).to include("op-enterprise-banner_large")+ end+ end++ context "without video parameter" do+ let(:component_args) { { variant: :large } }++ it "raises an error" do+ expect do+ render_component_in_mo+ end.to raise_error(ArgumentError, "The 'video' parameter is required when the variant is :large.")+ end+ end+ endend