jellyfin-web/dashboard-ui/bower_components/emby-webcomponents/confirm/confirm.js

39 lines
889 B
JavaScript
Raw Normal View History

2016-07-19 23:23:18 -07:00
define(['dialog', 'globalize'], function (dialog, globalize) {
2016-02-22 11:25:45 -07:00
2016-02-22 12:31:28 -07:00
return function (text, title) {
2016-02-22 11:25:45 -07:00
2016-02-22 12:31:28 -07:00
var options;
if (typeof text === 'string') {
2016-02-22 11:25:45 -07:00
options = {
2016-02-22 12:31:28 -07:00
title: title,
text: text
2016-02-22 11:25:45 -07:00
};
2016-02-22 12:31:28 -07:00
} else {
options = text;
2016-02-22 11:25:45 -07:00
}
2016-07-19 23:23:18 -07:00
var items = [];
items.push({
name: globalize.translate('sharedcomponents#ButtonOk'),
2016-09-08 23:59:23 -07:00
id: 'ok',
type: 'submit'
2016-07-19 23:23:18 -07:00
});
2016-02-22 11:25:45 -07:00
2016-07-19 23:23:18 -07:00
items.push({
name: globalize.translate('sharedcomponents#ButtonCancel'),
2016-09-08 23:59:23 -07:00
id: 'cancel',
type: 'cancel'
2016-07-19 23:23:18 -07:00
});
options.buttons = items;
return dialog(options).then(function (result) {
if (result == 'ok') {
return Promise.resolve();
}
return Promise.reject();
});
2016-02-22 11:25:45 -07:00
};
});