mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
First separation commit.
Added LICENSE, README.md, CONTRIBUTORS.md
This commit is contained in:
parent
09513af31b
commit
4678528d00
657 changed files with 422 additions and 0 deletions
39
src/bower_components/emby-webcomponents/deletehelper.js
vendored
Normal file
39
src/bower_components/emby-webcomponents/deletehelper.js
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
define(["connectionManager", "confirm", "appRouter", "globalize"], function(connectionManager, confirm, appRouter, globalize) {
|
||||
"use strict";
|
||||
|
||||
function alertText(options) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
require(["alert"], function(alert) {
|
||||
alert(options).then(resolve, resolve)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function deleteItem(options) {
|
||||
var item = options.item,
|
||||
itemId = item.Id,
|
||||
parentId = item.SeasonId || item.SeriesId || item.ParentId,
|
||||
serverId = item.ServerId,
|
||||
msg = globalize.translate("sharedcomponents#ConfirmDeleteItem"),
|
||||
title = globalize.translate("sharedcomponents#HeaderDeleteItem"),
|
||||
apiClient = connectionManager.getApiClient(item.ServerId);
|
||||
return confirm({
|
||||
title: title,
|
||||
text: msg,
|
||||
confirmText: globalize.translate("sharedcomponents#Delete"),
|
||||
primary: "cancel"
|
||||
}).then(function() {
|
||||
return apiClient.deleteItem(itemId).then(function() {
|
||||
options.navigate && (parentId ? appRouter.showItem(parentId, serverId) : appRouter.goHome())
|
||||
}, function(err) {
|
||||
var result = function() {
|
||||
return Promise.reject(err)
|
||||
};
|
||||
return alertText(globalize.translate("sharedcomponents#ErrorDeletingItem")).then(result, result)
|
||||
})
|
||||
})
|
||||
}
|
||||
return {
|
||||
deleteItem: deleteItem
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue