update confirm
This commit is contained in:
parent
166a16b60d
commit
1ea5d5f307
191 changed files with 8714 additions and 48569 deletions
|
@ -17,15 +17,15 @@ define(['layoutManager', 'dialogText'], function (layoutManager, dialogText) {
|
|||
id: 'cancel'
|
||||
});
|
||||
|
||||
actionsheet.show({
|
||||
actionSheet.show({
|
||||
|
||||
title: options.title,
|
||||
title: options.text,
|
||||
items: items
|
||||
|
||||
}).then(function (id) {
|
||||
|
||||
switch (id) {
|
||||
|
||||
|
||||
case 'ok':
|
||||
resolve();
|
||||
break;
|
||||
|
@ -39,17 +39,79 @@ define(['layoutManager', 'dialogText'], function (layoutManager, dialogText) {
|
|||
});
|
||||
}
|
||||
|
||||
function showConfirm(options) {
|
||||
function showConfirmInternal(options, paperdialoghelper, resolve, reject) {
|
||||
|
||||
var dialogOptions = {
|
||||
removeOnClose: true
|
||||
};
|
||||
|
||||
var backButton = false;
|
||||
|
||||
if (layoutManager.tv) {
|
||||
dialogOptions.size = 'fullscreen';
|
||||
backButton = true;
|
||||
dialogOptions.autoFocus = true;
|
||||
} else {
|
||||
|
||||
dialogOptions.modal = false;
|
||||
dialogOptions.entryAnimationDuration = 160;
|
||||
dialogOptions.exitAnimationDuration = 200;
|
||||
dialogOptions.autoFocus = false;
|
||||
}
|
||||
|
||||
var dlg = paperdialoghelper.createDialog(dialogOptions);
|
||||
var html = '';
|
||||
|
||||
if (options.title) {
|
||||
html += '<h2>' + options.title + '</h2>';
|
||||
}
|
||||
|
||||
if (options.text) {
|
||||
html += '<div>' + options.text + '</div>';
|
||||
}
|
||||
|
||||
html += '<div class="buttons">';
|
||||
|
||||
html += '<paper-button class="btnConfirm" dialog-confirm autofocus>' + dialogText.get('Ok') + '</paper-button>';
|
||||
|
||||
html += '<paper-button dialog-dismiss>' + dialogText.get('Cancel') + '</paper-button>';
|
||||
|
||||
html += '</div>';
|
||||
|
||||
dlg.innerHTML = html;
|
||||
document.body.appendChild(dlg);
|
||||
|
||||
paperdialoghelper.open(dlg).then(function () {
|
||||
|
||||
var confirmed = dlg.closingReason.confirmed;
|
||||
|
||||
if (confirmed) {
|
||||
resolve();
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return function (options) {
|
||||
function showConfirm(options) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
if (typeof options === 'string') {
|
||||
require(['paperdialoghelper', 'paper-button'], function (paperdialoghelper) {
|
||||
showConfirmInternal(options, paperdialoghelper, resolve, reject);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return function (text, title) {
|
||||
|
||||
var options;
|
||||
if (typeof text === 'string') {
|
||||
options = {
|
||||
title: '',
|
||||
text: options
|
||||
title: title,
|
||||
text: text
|
||||
};
|
||||
} else {
|
||||
options = text;
|
||||
}
|
||||
|
||||
if (layoutManager.tv) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue