forked from forgejo/forgejo
Make PR form use toast to show error message (#29545)

(cherry picked from commit 27deea7330f83ddb37c918afbb4159053d8847cb)
This commit is contained in:
parent
d509031e84
commit
221a28436a
7 changed files with 35 additions and 30 deletions
|
@ -21,13 +21,12 @@ const levels = {
|
|||
};
|
||||
|
||||
// See https://github.com/apvarun/toastify-js#api for options
|
||||
function showToast(message, level, {gravity, position, duration, ...other} = {}) {
|
||||
function showToast(message, level, {gravity, position, duration, useHtmlBody, ...other} = {}) {
|
||||
const {icon, background, duration: levelDuration} = levels[level ?? 'info'];
|
||||
|
||||
const toast = Toastify({
|
||||
text: `
|
||||
<div class='toast-icon'>${svg(icon)}</div>
|
||||
<div class='toast-body'>${htmlEscape(message)}</div>
|
||||
<div class='toast-body'>${useHtmlBody ? message : htmlEscape(message)}</div>
|
||||
<button class='toast-close'>${svg('octicon-x')}</button>
|
||||
`,
|
||||
escapeMarkup: false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue