diff --git a/js/h5p-library-list.js b/js/h5p-library-list.js index a238d39..cfadf0d 100644 --- a/js/h5p-library-list.js +++ b/js/h5p-library-list.js @@ -47,14 +47,17 @@ var H5PLibraryList= H5PLibraryList || {}; ' ]); - 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; }); }