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
Dismissable medium banner
Oliver Güntherd766fe151a2e
diff --git a/app/components/enterprise_edition/banner_component.html.erb b/app/components/enterprise_edition/banner_component.html.erbindex 547da3295f2..2f7a194e7f2 100644--- a/app/components/enterprise_edition/banner_component.html.erb+++ b/app/components/enterprise_edition/banner_component.html.erb@@ -47,7 +47,6 @@endend-if medium?grid.with_area(:graphic) doimage_tag @image,@@ -57,9 +56,10 @@if @dismissablegrid.with_area(:dismiss) do+ classes = medium? ? "op-enterprise-banner--close-icon_hovering" : ""render(Primer::Beta::IconButton.new(- classes: "op-enterprise-banner--close-icon",+ classes: class_names("op-enterprise-banner--close-icon", classes),scheme: :invisible,tag: :a,href: dismiss_enterprise_banner_path(feature_key: @dismiss_key),diff --git a/app/components/enterprise_edition/banner_component.rb b/app/components/enterprise_edition/banner_component.rbindex ecfbd876a35..ad9fed9fb66 100644--- a/app/components/enterprise_edition/banner_component.rb+++ b/app/components/enterprise_edition/banner_component.rb@@ -52,7 +52,7 @@ module EnterpriseEdition# @param show_always [boolean] Always show the banner, regardless of the dismissed or feature state.# @param dismiss_key [String] Provide a string to identify this banner when being dismissed. Defaults to feature_key# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>- def initialize(feature_key,+ def initialize(feature_key, # rubocop:disable Metrics/AbcSizevariant: DEFAULT_VARIANT,image: nil,i18n_scope: "ee.upsale.#{feature_key}",@@ -69,9 +69,8 @@ module EnterpriseEditionself.feature_key = feature_keyself.i18n_scope = i18n_scope- if @variant == :medium- raise ArgumentError, "The 'image' parameter is required when the variant is :medium." if @image.nil?- raise ArgumentError, "Banners with variant :medium can not be 'dismissable'." if @dismissable+ if @variant == :medium && @image.nil?+ raise ArgumentError, "The 'image' parameter is required when the variant is :medium."end@system_arguments = system_argumentsdiff --git a/app/components/enterprise_edition/banner_component.sass b/app/components/enterprise_edition/banner_component.sassindex 4d4638c5508..a52a1975ac8 100644--- a/app/components/enterprise_edition/banner_component.sass+++ b/app/components/enterprise_edition/banner_component.sass@@ -74,8 +74,15 @@color: var(--enterprise-upsale-color)margin-block: var(--base-size-2)- &--close-icon .Button-visual- color: var(--enterprise-upsale-color)+ &--close-icon+ .Button-visual+ color: var(--enterprise-upsale-color)++ &_hovering+ position: absolute+ top: var(--base-size-24)+ right: var(--base-size-24)+&--contentpadding: var(--base-size-6) var(--base-size-8)diff --git a/lookbook/previews/open_project/enterprise_edition/banner_component_preview.rb b/lookbook/previews/open_project/enterprise_edition/banner_component_preview.rbindex 8dbfea56aeb..e808e85f13e 100644--- a/lookbook/previews/open_project/enterprise_edition/banner_component_preview.rb+++ b/lookbook/previews/open_project/enterprise_edition/banner_component_preview.rb@@ -62,7 +62,7 @@ module OpenProject)end- # @display min_height 250px+ # @display min_height 350pxdef mediumrender(::EnterpriseEdition::BannerComponent@@ -73,6 +73,19 @@ module OpenProject)end+ # @display min_height 350px+ def medium_dismissable+ render(+ ::EnterpriseEdition::BannerComponent+ .new(:customize_life_cycle,+ variant: :medium,+ dismissable: true,+ dismiss_key: nil,+ image: "enterprise/internal-comments.png",+ show_always: true)+ )+ end+# @display min_height 250pxdef dismissablerender(