Made sure only content libraries can be upgraded.

namespaces
Frode Petterson 2014-08-22 12:00:06 +02:00
parent 89d437774e
commit 4a9e6d620f
1 changed files with 9 additions and 6 deletions

View File

@ -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;
});
}