Made sure only content libraries can be upgraded.
parent
89d437774e
commit
4a9e6d620f
|
@ -47,14 +47,17 @@ var H5PLibraryList= H5PLibraryList || {};
|
|||
</div>'
|
||||
]);
|
||||
|
||||
if (library.upgradeUrl !== null && library.numContent !== 0) {
|
||||
if (library.upgradeUrl === null) {
|
||||
$('.h5p-admin-upgrade-library', $libraryRow).remove();
|
||||
}
|
||||
else if (library.upgradeUrl === false || library.numContent === 0) {
|
||||
$('.h5p-admin-upgrade-library', $libraryRow).attr('disabled', true);
|
||||
}
|
||||
else {
|
||||
$('.h5p-admin-upgrade-library', $libraryRow).attr('title', t.upgradeLibrary).click(function () {
|
||||
window.location.href = library.upgradeUrl;
|
||||
});
|
||||
}
|
||||
else {
|
||||
$('.h5p-admin-upgrade-library', $libraryRow).attr('disabled', true);
|
||||
}
|
||||
|
||||
// Open details view when clicked
|
||||
$('.h5p-admin-view-library', $libraryRow).on('click', function () {
|
||||
|
@ -64,11 +67,11 @@ var H5PLibraryList= H5PLibraryList || {};
|
|||
var $deleteButton = $('.h5p-admin-delete-library', $libraryRow);
|
||||
if (library.numContent !== 0 || library.numContentDependencies !== 0 || library.numLibraryDependencies !== 0) {
|
||||
// Disabled delete if content.
|
||||
$deleteButton.attr('disabled', true).attr('title', t.deleteLibrary);
|
||||
$deleteButton.attr('disabled', true);
|
||||
}
|
||||
else {
|
||||
// Go to delete page om click.
|
||||
$deleteButton.on('click', function () {
|
||||
$deleteButton.attr('title', t.deleteLibrary).on('click', function () {
|
||||
window.location.href = library.deleteUrl;
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue