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

37 lines
833 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'),
id: 'ok'
});
2016-02-22 11:25:45 -07:00
2016-07-19 23:23:18 -07:00
items.push({
name: globalize.translate('sharedcomponents#ButtonCancel'),
id: 'cancel'
});
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
};
});