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

update alerts

This commit is contained in:
Luke Pulverenti 2016-02-26 15:29:27 -05:00
parent d74e699177
commit 3e161d7edb
11 changed files with 143 additions and 79 deletions

View file

@ -34,10 +34,11 @@
if ($('#selectVideoDecoder', form).val()) {
Dashboard.alert({
callback: onDecoderConfirmed,
title: Globalize.translate('TitleHardwareAcceleration'),
message: Globalize.translate('HardwareAccelerationWarning')
require(['alert'], function (alert) {
alert({
title: Globalize.translate('TitleHardwareAcceleration'),
text: Globalize.translate('HardwareAccelerationWarning')
}).then(onDecoderConfirmed);
});
} else {

View file

@ -802,15 +802,13 @@
self.showPlaybackInfoErrorMessage = function (errorCode) {
// This timeout is messy, but if jqm is in the act of hiding a popup, it will not show a new one
// If we're coming from the popup play menu, this will be a problem
setTimeout(function () {
Dashboard.alert({
message: Globalize.translate('MessagePlaybackError' + errorCode),
title: Globalize.translate('HeaderPlaybackError')
require(['alert'], function (alert) {
alert({
title: Globalize.translate('HeaderPlaybackError'),
text: Globalize.translate('MessagePlaybackError' + errorCode),
type: 'error'
});
}, 300);
});
};

View file

@ -2,9 +2,11 @@
function changeCollectionType(page, virtualFolder) {
Dashboard.alert({
message: Globalize.translate('HeaderChangeFolderTypeHelp'),
title: Globalize.translate('HeaderChangeFolderType')
require(['alert'], function (alert) {
alert({
title: Globalize.translate('HeaderChangeFolderType'),
text: Globalize.translate('HeaderChangeFolderTypeHelp')
});
});
}

View file

@ -540,59 +540,12 @@ var Dashboard = {
return;
}
if (browserInfo.mobile && options.message.indexOf('<') == -1) {
alert(options.message);
if (options.callback) {
options.callback();
}
} else {
require(['paper-dialog', 'fade-in-animation', 'fade-out-animation'], function () {
Dashboard.confirmInternal(options.message, options.title || Globalize.translate('HeaderAlert'), false, options.callback);
});
}
},
confirmInternal: function (message, title, showCancel, callback) {
var dlg = document.createElement('paper-dialog');
dlg.setAttribute('with-backdrop', 'with-backdrop');
dlg.setAttribute('role', 'alertdialog');
dlg.entryAnimation = 'fade-in-animation';
dlg.exitAnimation = 'fade-out-animation';
dlg.setAttribute('with-backdrop', 'with-backdrop');
var html = '';
html += '<h2>' + title + '</h2>';
html += '<div>' + message + '</div>';
html += '<div class="buttons">';
html += '<paper-button class="btnConfirm" dialog-confirm autofocus>' + Globalize.translate('ButtonOk') + '</paper-button>';
if (showCancel) {
html += '<paper-button dialog-dismiss>' + Globalize.translate('ButtonCancel') + '</paper-button>';
}
html += '</div>';
dlg.innerHTML = html;
document.body.appendChild(dlg);
// Has to be assigned a z-index after the call to .open()
dlg.addEventListener('iron-overlay-closed', function (e) {
var confirmed = dlg.closingReason.confirmed;
dlg.parentNode.removeChild(dlg);
if (callback) {
callback(confirmed);
}
require(['alert'], function (alert) {
alert({
title: options.title || Globalize.translate('HeaderAlert'),
text: options.message
}).then(options.callback || function () { });
});
dlg.open();
},
refreshSystemInfoFromServer: function () {
@ -1997,9 +1950,11 @@ var AppInfo = {};
if (browser.mobile || browser.msie) {
define("prompt", [embyWebComponentsBowerPath + "/prompt/nativeprompt"], returnFirstDependency);
define("confirm", [embyWebComponentsBowerPath + "/confirm/nativeconfirm"], returnFirstDependency);
define("alert", [embyWebComponentsBowerPath + "/alert/nativealert"], returnFirstDependency);
} else {
define("prompt", [embyWebComponentsBowerPath + "/prompt/prompt"], returnFirstDependency);
define("confirm", [embyWebComponentsBowerPath + "/confirm/confirm"], returnFirstDependency);
define("alert", [embyWebComponentsBowerPath + "/alert/alert"], returnFirstDependency);
}
}

View file

@ -340,9 +340,11 @@
msg += '<a href="useredit.html?userId=' + user.Id + '">' + Globalize.translate('ButtonLinkMyEmbyAccount') + '</a>';
msg += '<br/>';
Dashboard.alert({
message: msg,
title: Globalize.translate('HeaderInviteGuest')
require(['alert'], function (alert) {
alert({
title: Globalize.translate('HeaderInviteGuest'),
text: msg
});
});
return;
}