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

update shared components

This commit is contained in:
Luke Pulverenti 2016-02-22 13:25:45 -05:00
parent 912bd57ca0
commit 39fe608c2d
7 changed files with 122 additions and 62 deletions

View file

@ -15,12 +15,12 @@
},
"devDependencies": {},
"ignore": [],
"version": "1.0.90",
"_release": "1.0.90",
"version": "1.0.92",
"_release": "1.0.92",
"_resolution": {
"type": "version",
"tag": "1.0.90",
"commit": "2722d205b177e50517bb46b4d416b8ea2e8e2e3b"
"tag": "1.0.92",
"commit": "31046563fca4f28a30c1ae6f6d124a2714649398"
},
"_source": "git://github.com/MediaBrowser/emby-webcomponents.git",
"_target": "~1.0.0",

View file

@ -1,4 +1,4 @@
define(['paperdialoghelper', 'layoutManager', 'paper-button', 'css!./actionsheet'], function (paperdialoghelper, layoutManager) {
define(['paperdialoghelper', 'layoutManager', 'dialogText', 'paper-button', 'css!./actionsheet'], function (paperdialoghelper, layoutManager, dialogText) {
function parentWithClass(elem, className) {
@ -103,7 +103,7 @@
// If any items have an icon, give them all an icon just to make sure they're all lined up evenly
var renderIcon = itemsWithIcons.length;
var center = options.title && (!itemsWithIcons.length);
var center = options.title && (!itemsWithIcons.length || itemsWithIcons.length != options.items.length);
if (center) {
dlg.classList.add('centered');
@ -141,7 +141,7 @@
if (options.showCancel) {
html += '<div class="buttons">';
html += '<paper-button dialog-dismiss>' + Globalize.translate('core#ButtonCancel') + '</paper-button>';
html += '<paper-button dialog-dismiss>' + dialogText.get('Cancel') + '</paper-button>';
html += '</div>';
}
html += '</div>';

View file

@ -0,0 +1,61 @@
define(['layoutManager', 'dialogText'], function (layoutManager, dialogText) {
function showTvConfirm(options) {
return new Promise(function (resolve, reject) {
require(['actionsheet'], function (actionSheet) {
var items = [];
items.push({
name: dialogText.get('Ok'),
id: 'ok'
});
items.push({
name: dialogText.get('Cancel'),
id: 'cancel'
});
actionsheet.show({
title: options.title,
items: items
}).then(function (id) {
switch (id) {
case 'ok':
resolve();
break;
default:
reject();
break;
}
}, reject);
});
});
}
function showConfirm(options) {
}
return function (options) {
if (typeof options === 'string') {
options = {
title: '',
text: options
};
}
if (layoutManager.tv) {
return showTvConfirm(options);
}
return showConfirm(options);
};
});

View file

@ -0,0 +1,20 @@
define([], function () {
return function (options) {
if (typeof options === 'string') {
options = {
title: '',
text: options
};
}
var result = confirm(options.text);
if (result) {
return Promise.resolve();
} else {
return Promise.reject();
}
};
});

View file

@ -2,23 +2,19 @@ define([], function () {
return function (options) {
return new Promise(function (resolve, reject) {
if (typeof options === 'string') {
options = {
label: '',
text: options
};
}
if (typeof options === 'string') {
options = {
label: '',
text: options
};
}
var result = prompt(options.label || '', options.text || '');
if (result) {
resolve(result);
} else {
reject(result);
}
});
var result = prompt(options.label || '', options.text || '');
if (result) {
return Promise.resolve(result);
} else {
return Promise.reject(result);
}
};
});

View file

@ -1,6 +1,13 @@
define(['paperdialoghelper', 'layoutManager', 'globalize', 'dialogText', 'html!./icons.html', 'css!./style.css', 'paper-button', 'paper-input'], function (paperdialoghelper, layoutManager, globalize, dialogText) {
define(['paperdialoghelper', 'layoutManager', 'dialogText', 'html!./icons.html', 'css!./style.css', 'paper-button', 'paper-input'], function (paperdialoghelper, layoutManager, dialogText) {
function show(options, resolve, reject) {
return function (options) {
if (typeof options === 'string') {
options = {
title: '',
text: options
};
}
var dialogOptions = {
removeOnClose: true
@ -50,11 +57,11 @@ define(['paperdialoghelper', 'layoutManager', 'globalize', 'dialogText', 'html!.
html += '<br/>';
if (raisedButtons) {
html += '<paper-button raised class="btnSubmit"><iron-icon icon="dialog:check"></iron-icon><span>' + globalize.translate(dialogText.buttonOk) + '</span></paper-button>';
html += '<paper-button raised class="btnSubmit"><iron-icon icon="dialog:check"></iron-icon><span>' + dialogText.get('Ok') + '</span></paper-button>';
} else {
html += '<div style="text-align:right;">';
html += '<paper-button class="btnSubmit">' + globalize.translate(dialogText.buttonOk) + '</paper-button>';
html += '<paper-button class="btnPromptExit">' + globalize.translate(dialogText.buttonCancel) + '</paper-button>';
html += '<paper-button class="btnSubmit">' + dialogText.get('Ok') + '</paper-button>';
html += '<paper-button class="btnPromptExit">' + dialogText.get('Cancel') + '</paper-button>';
html += '</div>';
}
html += '</form>';
@ -90,32 +97,13 @@ define(['paperdialoghelper', 'layoutManager', 'globalize', 'dialogText', 'html!.
paperdialoghelper.close(dlg);
});
dlg.addEventListener('iron-overlay-closed', function () {
return paperdialoghelper.open(dlg).then(function () {
var value = submitValue;
if (value) {
resolve(value);
return value;
} else {
reject();
return Promise.reject();
}
});
paperdialoghelper.open(dlg);
}
return function (options) {
return new Promise(function (resolve, reject) {
if (typeof options === 'string') {
options = {
title: '',
text: options
};
}
show(options, resolve, reject);
});
};
});

View file

@ -713,18 +713,12 @@ var Dashboard = {
if (!apiClient) {
return new Promise(function (resolve, reject) {
reject();
});
return Promise.reject();
}
var cachedInfo = Dashboard.pluginSecurityInfo;
if (cachedInfo) {
return new Promise(function (resolve, reject) {
resolve(cachedInfo);
});
return Promise.resolve(cachedInfo);
}
return apiClient.ajax({
@ -2002,14 +1996,15 @@ var AppInfo = {};
return Globalize;
});
define('dialogText', [], getDialogText());
define('dialogText', ['globalize'], getDialogText());
}
function getDialogText() {
return function () {
return function (globalize) {
return {
buttonOk: 'ButtonOk',
buttonCancel: 'ButtonCancel'
get: function (text) {
return globalize.translate('Button' + text);
}
};
};
}