mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update alerts
This commit is contained in:
parent
d74e699177
commit
3e161d7edb
11 changed files with 143 additions and 79 deletions
|
@ -15,12 +15,12 @@
|
|||
},
|
||||
"devDependencies": {},
|
||||
"ignore": [],
|
||||
"version": "1.0.97",
|
||||
"_release": "1.0.97",
|
||||
"version": "1.0.99",
|
||||
"_release": "1.0.99",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "1.0.97",
|
||||
"commit": "40f6e65dd5743493289d2abc451536c191ab4dd0"
|
||||
"tag": "1.0.99",
|
||||
"commit": "21544fe9ee7a66c5ae65f7defa5247ff2688967d"
|
||||
},
|
||||
"_source": "git://github.com/MediaBrowser/emby-webcomponents.git",
|
||||
"_target": "~1.0.0",
|
||||
|
|
81
dashboard-ui/bower_components/emby-webcomponents/alert/alert.js
vendored
Normal file
81
dashboard-ui/bower_components/emby-webcomponents/alert/alert.js
vendored
Normal file
|
@ -0,0 +1,81 @@
|
|||
define(['paperdialoghelper', 'layoutManager', 'dialogText', 'html!./../prompt/icons.html', 'css!./../prompt/style.css', 'paper-button', 'paper-input'], function (paperdialoghelper, layoutManager, dialogText) {
|
||||
|
||||
return function (options) {
|
||||
|
||||
if (typeof options === 'string') {
|
||||
options = {
|
||||
title: '',
|
||||
text: options
|
||||
};
|
||||
}
|
||||
|
||||
var dialogOptions = {
|
||||
removeOnClose: true
|
||||
};
|
||||
|
||||
var backButton = false;
|
||||
var raisedButtons = false;
|
||||
|
||||
if (layoutManager.tv) {
|
||||
dialogOptions.size = 'fullscreen';
|
||||
backButton = true;
|
||||
raisedButtons = true;
|
||||
} else {
|
||||
|
||||
dialogOptions.modal = false;
|
||||
dialogOptions.entryAnimationDuration = 160;
|
||||
dialogOptions.exitAnimationDuration = 200;
|
||||
}
|
||||
|
||||
var dlg = paperdialoghelper.createDialog(dialogOptions);
|
||||
|
||||
dlg.classList.add('promptDialog');
|
||||
|
||||
var html = '';
|
||||
|
||||
html += '<div class="promptDialogContent">';
|
||||
if (backButton) {
|
||||
html += '<paper-icon-button tabindex="-1" icon="dialog:arrow-back" class="btnPromptExit"></paper-icon-button>';
|
||||
}
|
||||
|
||||
if (options.title) {
|
||||
html += '<h2>';
|
||||
html += options.title;
|
||||
html += '</h2>';
|
||||
}
|
||||
|
||||
if (options.text) {
|
||||
|
||||
if (options.title) {
|
||||
html += '<p style="margin-top:2em;">';
|
||||
} else {
|
||||
html += '<p>';
|
||||
}
|
||||
|
||||
html += options.text;
|
||||
html += '</p>';
|
||||
}
|
||||
|
||||
var buttonText = options.type == 'error' ? 'Ok' : 'GotIt';
|
||||
if (raisedButtons) {
|
||||
html += '<paper-button raised class="btnSubmit"><iron-icon icon="dialog:check"></iron-icon><span>' + dialogText.get(buttonText) + '</span></paper-button>';
|
||||
} else {
|
||||
html += '<div style="text-align:right;">';
|
||||
html += '<paper-button class="btnSubmit">' + dialogText.get(buttonText) + '</paper-button>';
|
||||
html += '</div>';
|
||||
}
|
||||
|
||||
html += '</div>';
|
||||
|
||||
dlg.innerHTML = html;
|
||||
|
||||
document.body.appendChild(dlg);
|
||||
|
||||
dlg.querySelector('.btnSubmit').addEventListener('click', function (e) {
|
||||
|
||||
paperdialoghelper.close(dlg);
|
||||
});
|
||||
|
||||
return paperdialoghelper.open(dlg);
|
||||
};
|
||||
});
|
22
dashboard-ui/bower_components/emby-webcomponents/alert/nativealert.js
vendored
Normal file
22
dashboard-ui/bower_components/emby-webcomponents/alert/nativealert.js
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
define([], function () {
|
||||
|
||||
function replaceAll(str, find, replace) {
|
||||
|
||||
return str.split(find).join(replace);
|
||||
}
|
||||
|
||||
return function (options) {
|
||||
|
||||
if (typeof options === 'string') {
|
||||
options = {
|
||||
text: options
|
||||
};
|
||||
}
|
||||
|
||||
var text = replaceAll(options.text || '', '<br/>', '\n');
|
||||
|
||||
alert(text);
|
||||
|
||||
return Promise.resolve();
|
||||
};
|
||||
});
|
|
@ -29,14 +29,14 @@
|
|||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||
},
|
||||
"ignore": [],
|
||||
"homepage": "https://github.com/PolymerElements/iron-behaviors",
|
||||
"homepage": "https://github.com/polymerelements/iron-behaviors",
|
||||
"_release": "1.0.13",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.0.13",
|
||||
"commit": "a7bc3428a6da2beed21987b3a8028206826a12bc"
|
||||
},
|
||||
"_source": "git://github.com/PolymerElements/iron-behaviors.git",
|
||||
"_source": "git://github.com/polymerelements/iron-behaviors.git",
|
||||
"_target": "^1.0.0",
|
||||
"_originalSource": "PolymerElements/iron-behaviors"
|
||||
"_originalSource": "polymerelements/iron-behaviors"
|
||||
}
|
|
@ -34,10 +34,11 @@
|
|||
|
||||
if ($('#selectVideoDecoder', form).val()) {
|
||||
|
||||
Dashboard.alert({
|
||||
callback: onDecoderConfirmed,
|
||||
require(['alert'], function (alert) {
|
||||
alert({
|
||||
title: Globalize.translate('TitleHardwareAcceleration'),
|
||||
message: Globalize.translate('HardwareAccelerationWarning')
|
||||
text: Globalize.translate('HardwareAccelerationWarning')
|
||||
}).then(onDecoderConfirmed);
|
||||
});
|
||||
|
||||
} else {
|
||||
|
|
|
@ -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);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -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')
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
require(['alert'], function (alert) {
|
||||
alert({
|
||||
title: options.title || Globalize.translate('HeaderAlert'),
|
||||
text: options.message
|
||||
}).then(options.callback || function () { });
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -959,5 +959,7 @@
|
|||
"HeaderSelectCodecIntrosPath": "Select Codec Intros Path",
|
||||
"ButtonLocalRefresh": "Local refresh",
|
||||
"ButtonAddMissingData": "Add missing data only",
|
||||
"ButtonFullRefresh": "Full refresh"
|
||||
"ButtonFullRefresh": "Full refresh",
|
||||
"ValueExample": "1:00 PM",
|
||||
"ButtonGotIt": "Got It"
|
||||
}
|
|
@ -970,5 +970,6 @@
|
|||
"ButtonLocalRefresh": "Local refresh",
|
||||
"ButtonAddMissingData": "Add missing data only",
|
||||
"ButtonFullRefresh": "Full refresh",
|
||||
"ValueExample": "1:00 PM"
|
||||
"ValueExample": "1:00 PM",
|
||||
"ButtonGotIt": "Got It"
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue