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
Also replace FlashMessageComponent
Oliver Günthera333d0009f1e
diff --git a/app/controllers/concerns/op_turbo/component_stream.rb b/app/controllers/concerns/op_turbo/component_stream.rbindex 23dd63c9457..7e77a32c0c2 100644--- a/app/controllers/concerns/op_turbo/component_stream.rb+++ b/app/controllers/concerns/op_turbo/component_stream.rb@@ -77,8 +77,9 @@ module OpTurboupdate_flash_message_via_turbo_stream(**kwargs.merge(scheme: :danger, icon: :stop))end- def update_flash_message_via_turbo_stream(component: OpPrimer::BannerMessageComponent, **)- turbo_streams << component.new(**).render_as_turbo_stream(view_context:, action: :flash)+ def update_flash_message_via_turbo_stream(message:, component: OpPrimer::BannerMessageComponent, **)+ instance = component.new(**).with_content(message)+ turbo_streams << instance.render_as_turbo_stream(view_context:, action: :flash)enddef turbo_streamsdiff --git a/lookbook/docs/patterns/08-flash-banner.md.erb b/lookbook/docs/patterns/08-flash-banner.md.erbindex 5f9ebb56750..7587e3f3169 100644--- a/lookbook/docs/patterns/08-flash-banner.md.erb+++ b/lookbook/docs/patterns/08-flash-banner.md.erb@@ -56,6 +56,9 @@ update_flash_message_via_turbo_stream(The width of this banner is always configured through the `op-primer-banner` namespace.It is set to 80% of the available width+Note that using a turbo stream will always remove all previous flashes.+Please create a code maintenance ticket if you need to append/prepend messages instead.+## Further Examples### Danger:diff --git a/modules/meeting/app/components/flash_message_component.rb b/modules/meeting/app/components/flash_message_component.rbdeleted file mode 100644index 3636c5530ed..00000000000--- a/modules/meeting/app/components/flash_message_component.rb+++ /dev/null@@ -1,61 +0,0 @@-#-- 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.-#++--class FlashMessageComponent < ApplicationComponent- include ApplicationHelper- include OpTurbo::Streamable- include OpPrimer::ComponentHelpers-- def initialize(message: nil, full: false, dismiss_scheme: :none, icon: nil, scheme: :default)- super-- @message = message- @full = full- @dismiss_scheme = dismiss_scheme- @icon = icon- @scheme = scheme- end-- def call- component_wrapper do- # even without provided message, the wrapper should be rendered as this allows- # for triggering a flash message via turbo stream- if @message.present?- flash_partial- end- end- end-- private-- def flash_partial- render(Primer::Alpha::Banner.new(- full: @full, dismiss_scheme: @dismiss_scheme, icon: @icon, scheme: @scheme- )) { @message }- end-enddiff --git a/modules/meeting/app/components/meetings/show_component.html.erb b/modules/meeting/app/components/meetings/show_component.html.erbindex 7b1d937fcd2..523b9142b58 100644--- a/modules/meeting/app/components/meetings/show_component.html.erb+++ b/modules/meeting/app/components/meetings/show_component.html.erb@@ -1,12 +1,5 @@<%=flex_layout(data: { turbo: true }) do |show_page|- show_page.with_row do- # prototyical usage of Primer's flash message component wrapped in a component which can be updated via turbo stream- # empty initially- # should become part of the application layout once finalized- render(FlashMessageComponent.new)- end-show_page.with_row dorender(Meetings::HeaderComponent.new(meeting: @meeting, project: @project))end