diff --git a/themes/grav/js/admin-all.js b/themes/grav/js/admin-all.js index ddbb6d01..3e83443e 100644 --- a/themes/grav/js/admin-all.js +++ b/themes/grav/js/admin-all.js @@ -248,12 +248,18 @@ $(function () { if (details){ var slug = $('[data-gpm-' + type + ']').data('gpm-' + type), - Type = type.charAt(0).toUpperCase() + type.substring(1); + Type = type.charAt(0).toUpperCase() + type.substring(1), + resource = resources[type + 's'][slug]; - content = 'v{available} of this ' + type + ' is now available!'; - content = jQuery.substitute(content, {available: resources[type + 's'][slug].available}); - button = jQuery.substitute(button, {Type: Type, location: GravAdmin.config.base_url_relative + '/' + type + 's/' + slug}); - $(details).html('

' + icon + content + button + '

'); + if (resource) { + content = 'v{available} of this ' + type + ' is now available!'; + content = jQuery.substitute(content, { available: resource.available }); + button = jQuery.substitute(button, { + Type: Type, + location: GravAdmin.config.base_url_relative + '/' + type + 's/' + slug + }); + $(details).html('

' + icon + content + button + '

'); + } } } }