update to new confirm pattern

This commit is contained in:
Luke Pulverenti 2016-02-22 14:12:06 -05:00
parent a42596f118
commit 166a16b60d
11 changed files with 46 additions and 55 deletions

View File

@ -119,17 +119,18 @@
var type = this.getAttribute('data-imagetype');
var index = this.getAttribute('data-index');
index = index == "null" ? null : parseInt(index);
Dashboard.confirm(Globalize.translate('DeleteImageConfirmation'), Globalize.translate('HeaderDeleteImage'), function (result) {
if (result) {
require(['confirm'], function (confirm) {
confirm(Globalize.translate('DeleteImageConfirmation'), Globalize.translate('HeaderDeleteImage')).then(function () {
ApiClient.deleteItemImage(currentItem.Id, type, index).then(function () {
hasChanges = true;
reload(page);
});
}
});
});
});

View File

@ -30,9 +30,9 @@
var location = virtualFolder.Locations[index];
Dashboard.confirm(Globalize.translate('MessageConfirmRemoveMediaLocation'), Globalize.translate('HeaderRemoveMediaLocation'), function (confirmResult) {
require(['confirm'], function (confirm) {
if (confirmResult) {
confirm(Globalize.translate('MessageConfirmRemoveMediaLocation'), Globalize.translate('HeaderRemoveMediaLocation')).then(function () {
var refreshAfterChange = currentOptions.refresh;
@ -45,7 +45,7 @@
Dashboard.alert(Globalize.translate('DefaultErrorMessage'));
});
}
});
});
}

View File

@ -64,9 +64,9 @@
var msg = Globalize.translate('MessageAreYouSureDeleteSubtitles');
Dashboard.confirm(msg, Globalize.translate('HeaderConfirmDeletion'), function (result) {
require(['confirm'], function (confirm) {
if (result) {
confirm(msg, Globalize.translate('HeaderConfirmDeletion')).then(function () {
Dashboard.showLoadingMsg();
@ -82,8 +82,7 @@
reload(page, itemId);
});
}
});
});
}

View File

@ -32,9 +32,9 @@
var message = Globalize.translate('MessageFileWillBeDeleted') + '<p style="word-wrap:break-word;">' + item.OriginalPath + '</p><p>' + Globalize.translate('MessageSureYouWishToProceed') + '</p>';
Dashboard.confirm(message, Globalize.translate('HeaderDeleteFile'), function (confirmResult) {
require(['confirm'], function (confirm) {
if (confirmResult) {
confirm(message, Globalize.translate('HeaderDeleteFile')).then(function () {
Dashboard.showLoadingMsg();
@ -45,8 +45,7 @@
reloadItems(page);
}, onApiFailure);
}
});
});
}
@ -91,9 +90,9 @@
message += '<p>' + Globalize.translate('MessageSureYouWishToProceed') + '</p>';
Dashboard.confirm(message, Globalize.translate('HeaderOrganizeFile'), function (confirmResult) {
require(['confirm'], function (confirm) {
if (confirmResult) {
confirm(message, Globalize.translate('HeaderOrganizeFile')).then(function () {
Dashboard.showLoadingMsg();
@ -104,7 +103,7 @@
reloadItems(page);
}, onApiFailure);
}
});
});
}

View File

@ -971,27 +971,27 @@
restart: function () {
Dashboard.confirm(Globalize.translate('MessageConfirmRestart'), Globalize.translate('HeaderRestart'), function (result) {
require(['confirm'], function (confirm) {
confirm(Globalize.translate('MessageConfirmRestart'), Globalize.translate('HeaderRestart')).then(function () {
if (result) {
$('#btnRestartServer').buttonEnabled(false);
$('#btnShutdown').buttonEnabled(false);
Dashboard.restartServer();
}
});
});
},
shutdown: function () {
Dashboard.confirm(Globalize.translate('MessageConfirmShutdown'), Globalize.translate('HeaderShutdown'), function (result) {
require(['confirm'], function (confirm) {
confirm(Globalize.translate('MessageConfirmShutdown'), Globalize.translate('HeaderShutdown')).then(function () {
if (result) {
$('#btnRestartServer').buttonEnabled(false);
$('#btnShutdown').buttonEnabled(false);
ApiClient.shutdownServer();
}
});
});
}
};

View File

@ -1886,9 +1886,9 @@
var id = getParameterByName('id');
Dashboard.confirm("Are you sure you wish to split the media sources into separate items?", "Split Media Apart", function (confirmResult) {
require(['confirm'], function (confirm) {
if (confirmResult) {
confirm("Are you sure you wish to split the media sources into separate items?", "Split Media Apart").then(function () {
Dashboard.showLoadingMsg();
@ -1902,7 +1902,7 @@
reload(page);
});
}
});
});
}
@ -1951,9 +1951,9 @@
function deleteTimer(page, id) {
Dashboard.confirm(Globalize.translate('MessageConfirmRecordingCancellation'), Globalize.translate('HeaderConfirmRecordingCancellation'), function (result) {
require(['confirm'], function (confirm) {
if (result) {
confirm(Globalize.translate('MessageConfirmRecordingCancellation'), Globalize.translate('HeaderConfirmRecordingCancellation')).then(function () {
Dashboard.showLoadingMsg();
@ -1963,8 +1963,7 @@
reload(page);
});
}
});
});
}

View File

@ -4,9 +4,9 @@
function remove(page, index) {
Dashboard.confirm(Globalize.translate('MessageConfirmPathSubstitutionDeletion'), Globalize.translate('HeaderConfirmDeletion'), function (result) {
require(['confirm'], function (confirm) {
if (result) {
confirm(Globalize.translate('MessageConfirmPathSubstitutionDeletion'), Globalize.translate('HeaderConfirmDeletion')).then(function () {
ApiClient.getServerConfiguration().then(function (config) {
@ -17,11 +17,8 @@
reload(page);
});
});
}
});
});
}
function addSubstitution(page, config) {

View File

@ -4,9 +4,9 @@
function deleteTimer(page, id) {
Dashboard.confirm(Globalize.translate('MessageConfirmRecordingCancellation'), Globalize.translate('HeaderConfirmRecordingCancellation'), function (result) {
require(['confirm'], function (confirm) {
if (result) {
confirm(Globalize.translate('MessageConfirmRecordingCancellation'), Globalize.translate('HeaderConfirmRecordingCancellation')).then(function () {
Dashboard.showLoadingMsg();
@ -17,8 +17,7 @@
reload(page);
});
}
});
});
}

View File

@ -8,9 +8,9 @@
function deleteSeriesTimer(page, id) {
Dashboard.confirm(Globalize.translate('MessageConfirmSeriesCancellation'), Globalize.translate('HeaderConfirmSeriesCancellation'), function (result) {
require(['confirm'], function (confirm) {
if (result) {
confirm(Globalize.translate('MessageConfirmSeriesCancellation'), Globalize.translate('HeaderConfirmSeriesCancellation')).then(function () {
Dashboard.showLoadingMsg();
@ -20,8 +20,7 @@
reload(page);
});
}
});
});
}

View File

@ -4,9 +4,9 @@
function deleteTimer(page, id) {
Dashboard.confirm(Globalize.translate('MessageConfirmRecordingCancellation'), Globalize.translate('HeaderConfirmRecordingCancellation'), function (result) {
require(['confirm'], function (confirm) {
if (result) {
confirm(Globalize.translate('MessageConfirmRecordingCancellation'), Globalize.translate('HeaderConfirmRecordingCancellation')).then(function () {
Dashboard.showLoadingMsg();
@ -16,8 +16,7 @@
Dashboard.navigate('livetv.html');
});
}
});
});
}

View File

@ -53,17 +53,16 @@
msg += virtualFolder.Locations.join("<br/>");
}
Dashboard.confirm(msg, Globalize.translate('HeaderRemoveMediaFolder'), function (confirmResult) {
require(['confirm'], function (confirm) {
if (confirmResult) {
confirm(msg, Globalize.translate('HeaderRemoveMediaFolder')).then(function () {
var refreshAfterChange = shouldRefreshLibraryAfterChanges(page);
ApiClient.removeVirtualFolder(virtualFolder.Name, refreshAfterChange).then(function () {
reloadLibrary(page);
});
}
});
});
}