diff --git a/invenio_github/api.py b/invenio_github/api.py index b91ebfa..a41923d 100644 --- a/invenio_github/api.py +++ b/invenio_github/api.py @@ -323,7 +323,9 @@ def remove_hook(self, repo_id, name): def repo_last_published_release(self, repo): """Retrieves the repository last release.""" - return repo.latest_release(ReleaseStatus.PUBLISHED) + release_object = repo.latest_release(ReleaseStatus.PUBLISHED) + release_instance = current_github.release_api_class(release_object) + return release_instance def get_repository_releases(self, repo): """Retrieve repository releases. Returns API release objects.""" diff --git a/invenio_github/assets/semantic-ui/js/invenio_github/index.js b/invenio_github/assets/semantic-ui/js/invenio_github/index.js index b7c7249..ee5ed4a 100644 --- a/invenio_github/assets/semantic-ui/js/invenio_github/index.js +++ b/invenio_github/assets/semantic-ui/js/invenio_github/index.js @@ -3,6 +3,7 @@ // // Invenio Github is free software; you can redistribute it and/or modify it // under the terms of the MIT License; see LICENSE file for more details. +import $ from "jquery"; function addResultMessage(element, color, message) { element.classList.remove("hidden"); @@ -104,3 +105,7 @@ function sendEnableDisableRequest(checked, repo) { } } } + +$("#record-doi-badge").on("click", function () { + $("#doi-modal").modal("show"); +}); diff --git a/invenio_github/templates/semantic-ui/invenio_github/helpers.html b/invenio_github/templates/semantic-ui/invenio_github/helpers.html index 8a41a70..849e3af 100644 --- a/invenio_github/templates/semantic-ui/invenio_github/helpers.html +++ b/invenio_github/templates/semantic-ui/invenio_github/helpers.html @@ -6,28 +6,27 @@ Invenio is free software; you can redistribute it and/or modify it under the terms of the MIT License; see LICENSE file for more details. #} -{%- macro doi_badge(doi, github_id, modal_name='') %} +{%- macro doi_badge(doi, doi_url, github_id) %} {%- block doi_badge scoped %} - {% set doi_url = url_for('invenio_github_badge.latest_doi', github_id=github_id, _external=True) %} - {% set image_url = url_for('invenio_github_badge.index', github_id=github_id, _external=True) %} - {% set modal_name = modal_name or (doi | replace('/', '-')) %} - - {{ doi }} - -