mirror of https://github.com/go-gitea/gitea
Git with a cup of tea, painless self-hosted git service
Mirror for internal git.with.parts use
https://git.with.parts
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
987 B
32 lines
987 B
1 year ago
|
import $ from 'jquery';
|
||
5 months ago
|
import {svg} from '../../svg.ts';
|
||
1 year ago
|
import {htmlEscape} from 'escape-goat';
|
||
5 months ago
|
import {createElementFromHTML} from '../../utils/dom.ts';
|
||
1 year ago
|
|
||
|
const {i18n} = window.config;
|
||
|
|
||
6 months ago
|
export function confirmModal(content, {confirmButtonColor = 'primary'} = {}) {
|
||
1 year ago
|
return new Promise((resolve) => {
|
||
6 months ago
|
const modal = createElementFromHTML(`
|
||
|
<div class="ui g-modal-confirm modal">
|
||
|
<div class="content">${htmlEscape(content)}</div>
|
||
|
<div class="actions">
|
||
|
<button class="ui cancel button">${svg('octicon-x')} ${htmlEscape(i18n.modal_cancel)}</button>
|
||
|
<button class="ui ${confirmButtonColor} ok button">${svg('octicon-check')} ${htmlEscape(i18n.modal_confirm)}</button>
|
||
|
</div>
|
||
|
</div>
|
||
|
`);
|
||
|
document.body.append(modal);
|
||
|
const $modal = $(modal);
|
||
1 year ago
|
$modal.modal({
|
||
|
onApprove() {
|
||
|
resolve(true);
|
||
|
},
|
||
|
onHidden() {
|
||
|
$modal.remove();
|
||
|
resolve(false);
|
||
|
},
|
||
|
}).modal('show');
|
||
|
});
|
||
|
}
|