mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-17 19:08:18 -07:00
added delete method for virtual items
This commit is contained in:
parent
7e34533cae
commit
e674b68b00
14
ApiClient.js
14
ApiClient.js
@ -1163,6 +1163,20 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
|
||||
});
|
||||
};
|
||||
|
||||
self.deleteItem = function (itemId) {
|
||||
|
||||
if (!itemId) {
|
||||
throw new Error("null itemId");
|
||||
}
|
||||
|
||||
var url = self.getUrl("Items/" + itemId);
|
||||
|
||||
return self.ajax({
|
||||
type: "DELETE",
|
||||
url: url
|
||||
});
|
||||
};
|
||||
|
||||
self.updateItemImageIndex = function (itemId, itemType, itemName, imageType, imageIndex, newIndex) {
|
||||
|
||||
if (!imageType) {
|
||||
|
@ -32,12 +32,15 @@
|
||||
</div>
|
||||
|
||||
<button id="btnRefresh" type="button" data-icon="refresh" data-mini="true" data-theme="b" data-inline="true">Refresh</button>
|
||||
|
||||
<div id="fldRecursive" style="display: none; vertical-align: bottom;">
|
||||
<label for="chkRecursive">Refresh child items</label>
|
||||
<input type="checkbox" id="chkRecursive" name="chkRecursive" data-mini="true" checked="checked" data-inline="true" />
|
||||
</div>
|
||||
<div id="fldDelete" style="vertical-align: bottom;">
|
||||
<button id="btnDelete" type="button" data-icon="delete" data-mini="true" data-theme="a" data-inline="true">Delete</button>
|
||||
<div style="display: inline-block;">
|
||||
<div id="fldDelete" style="vertical-align: bottom; display: none;">
|
||||
<button id="btnDelete" type="button" data-icon="delete" data-mini="true" data-theme="a" data-inline="true">Delete</button>
|
||||
</div>
|
||||
</div>
|
||||
<div style="margin: .5em 0 1em;">
|
||||
<div class="fieldDescription">A refresh will cause internet metadata to be re-downloaded (if enabled, and dependent on metadata settings).</div>
|
||||
|
@ -350,17 +350,24 @@
|
||||
}
|
||||
|
||||
$('#btnRefresh', page).button('enable');
|
||||
$('#btnDelete', page).button('enable');
|
||||
|
||||
$('#refreshLoading', page).hide();
|
||||
|
||||
currentItem = item;
|
||||
|
||||
if (item.IsFolder) {
|
||||
$('#fldRecursive', page).css("display", "inline-block")
|
||||
$('#fldRecursive', page).css("display", "inline-block");
|
||||
} else {
|
||||
$('#fldRecursive', page).hide();
|
||||
}
|
||||
|
||||
if (item.LocationType == "Virtual") {
|
||||
$('#fldDelete', page).show();
|
||||
} else {
|
||||
$('#fldDelete', page).hide();
|
||||
}
|
||||
|
||||
LibraryBrowser.renderName(item, $('.itemName', page), true);
|
||||
|
||||
updateTabs(page, item);
|
||||
@ -1143,7 +1150,8 @@
|
||||
|
||||
$('#btnRefresh', this).on('click', function () {
|
||||
|
||||
$(this).button('disable');
|
||||
$('#btnDelete', page).button('disable');
|
||||
$('#btnRefresh', page).button('disable');
|
||||
|
||||
$('#refreshLoading', page).show();
|
||||
|
||||
@ -1180,6 +1188,28 @@
|
||||
});
|
||||
});
|
||||
|
||||
$('#btnDelete', this).on('click', function () {
|
||||
|
||||
Dashboard.confirm("Are you sure you wish to delete this item?", "Confirm Deletion", function (result) {
|
||||
|
||||
if (result) {
|
||||
|
||||
$('#btnDelete', page).button('disable');
|
||||
$('#btnRefresh', page).button('disable');
|
||||
|
||||
$('#refreshLoading', page).show();
|
||||
|
||||
ApiClient.deleteItem(currentItem.Id).done(function () {
|
||||
|
||||
Dashboard.navigate('edititemmetadata.html?id=' + currentItem.ParentId);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$('.libraryTree', page).on('itemclicked', function (event, data) {
|
||||
|
||||
if (data.id != currentItem.Id) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.179" targetFramework="net45" />
|
||||
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.180" targetFramework="net45" />
|
||||
<package id="ServiceStack.Common" version="3.9.62" targetFramework="net45" />
|
||||
<package id="ServiceStack.Text" version="3.9.62" targetFramework="net45" />
|
||||
</packages>
|
Loading…
Reference in New Issue
Block a user