From dabbad7f082f6c5261d814e97139a7130bcc92f6 Mon Sep 17 00:00:00 2001 From: Sirine Mhedhbi Date: Mon, 3 Jul 2023 10:03:17 +0200 Subject: [PATCH] fix bug of display text in alert when there is no collections --- app/components/alert_message_component.rb | 2 +- .../alert_message_component/alert_message_component.html.haml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/components/alert_message_component.rb b/app/components/alert_message_component.rb index 1ef3b185ce..09ece182b6 100644 --- a/app/components/alert_message_component.rb +++ b/app/components/alert_message_component.rb @@ -2,7 +2,7 @@ class AlertMessageComponent < ViewComponent::Base include Turbo::FramesHelper - def initialize(id: '', message: '', type: 'info', closeable: true) + def initialize(id: '', message: nil, type: 'info', closeable: true) @id = id @message = message @type = "alert-#{type}" diff --git a/app/components/alert_message_component/alert_message_component.html.haml b/app/components/alert_message_component/alert_message_component.html.haml index 107ab14acf..c32ec7d3c7 100644 --- a/app/components/alert_message_component/alert_message_component.html.haml +++ b/app/components/alert_message_component/alert_message_component.html.haml @@ -1,5 +1,5 @@ -.alert.alert-dismissible.fade.show{:role => "alert", class: "#{@type}", style: "text-align: left"} - = @message +.alert.alert-dismissible.fade.show{:role => "alert", class: "#{@type}", style: "text-align: left;white-space: normal;"} + = @message || content - if @closeable %button.close{"aria-label": "Close", "data-dismiss": "alert", type: "button", style: "background: transparent"}