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

34 lines
752 B
JavaScript
Raw Normal View History

2016-07-20 06:56:24 -07:00
define(['dialog', 'globalize'], function (dialog, globalize) {
2016-10-01 23:46:32 -07:00
'use strict';
2016-05-06 10:49:58 -07:00
2016-07-20 06:56:24 -07:00
return function (text, title) {
2016-05-06 10:49:58 -07:00
2016-07-20 06:56:24 -07:00
var options;
if (typeof text === 'string') {
2016-02-26 13:29:27 -07:00
options = {
2016-07-20 06:56:24 -07:00
title: title,
text: text
2016-02-26 13:29:27 -07:00
};
} else {
2016-07-20 06:56:24 -07:00
options = text;
2016-02-26 13:29:27 -07:00
}
2016-07-20 06:56:24 -07:00
var items = [];
2016-02-26 13:29:27 -07:00
2016-07-20 06:56:24 -07:00
items.push({
2016-09-12 11:10:09 -07:00
name: globalize.translate('sharedcomponents#ButtonGotIt'),
2016-09-08 23:59:23 -07:00
id: 'ok',
type: 'submit'
2016-07-20 06:56:24 -07:00
});
2016-04-09 19:27:09 -07:00
2016-07-20 06:56:24 -07:00
options.buttons = items;
2016-02-26 13:29:27 -07:00
2016-07-20 06:56:24 -07:00
return dialog(options).then(function (result) {
2016-10-01 23:46:32 -07:00
if (result === 'ok') {
2016-07-20 06:56:24 -07:00
return Promise.resolve();
2016-02-26 13:29:27 -07:00
}
2016-07-20 06:56:24 -07:00
return Promise.reject();
2016-02-26 13:29:27 -07:00
});
};
});