chg: [js:bootstrap-helper] Allow closing success toast without title

pull/121/head
Sami Mokaddem 2022-10-25 14:31:10 +02:00
parent e98290fcba
commit 0c4a73cc39
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
1 changed files with 7 additions and 9 deletions

View File

@ -350,18 +350,16 @@ class Toaster {
$toast.attr('id', options.id) $toast.attr('id', options.id)
} }
$toast.addClass('toast-' + options.variant) $toast.addClass('toast-' + options.variant)
if (options.title !== false || options.titleHtml !== false || options.muted !== false || options.mutedHtml !== false) { if (options.title !== false || options.titleHtml !== false || options.muted !== false || options.mutedHtml !== false || options.closeButton) {
var $toastHeader = $('<div class="toast-header"/>') var $toastHeader = $('<div class="toast-header"/>')
$toastHeader.addClass('toast-' + options.variant) $toastHeader.addClass('toast-' + options.variant)
if (options.title !== false || options.titleHtml !== false) { let $toastHeaderText = $('<span class="me-auto"/>')
var $toastHeaderText
if (options.titleHtml !== false) { if (options.titleHtml !== false) {
$toastHeaderText = $('<div class="me-auto"/>').html(options.titleHtml); $toastHeaderText = $('<div class="me-auto"/>').html(options.titleHtml);
} else { } else if (options.title !== false) {
$toastHeaderText = $('<strong class="me-auto"/>').text(options.title) $toastHeaderText = $('<strong class="me-auto"/>').text(options.title)
} }
$toastHeader.append($toastHeaderText) $toastHeader.append($toastHeaderText)
}
if (options.muted !== false || options.mutedHtml !== false) { if (options.muted !== false || options.mutedHtml !== false) {
var $toastHeaderMuted var $toastHeaderMuted
if (options.mutedHtml !== false) { if (options.mutedHtml !== false) {