1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00
jellyfin-web/src/components/confirm/confirm.js

41 lines
962 B
JavaScript
Raw Normal View History

define(['dialog', 'globalize'], function (dialog, globalize) {
'use strict';
return function (text, title) {
2018-10-23 01:05:09 +03:00
var options;
if (typeof text === 'string') {
options = {
title: title,
text: text
};
} else {
options = text;
}
2018-10-23 01:05:09 +03:00
var items = [];
items.push({
name: options.cancelText || globalize.translate('ButtonCancel'),
id: 'cancel',
type: 'cancel'
});
items.push({
name: options.confirmText || globalize.translate('ButtonOk'),
id: 'ok',
type: options.primary === 'delete' ? 'delete' : 'submit'
});
options.buttons = items;
return dialog(options).then(function (result) {
if (result === 'ok') {
return Promise.resolve();
}
return Promise.reject();
});
};
2019-09-01 18:24:56 +03:00
});