{# # This file is part of Invenio. # Copyright (C) 2014, 2015, 2016 CERN. # # Invenio is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. # # Invenio is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Invenio; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. #} {%- import "invenio_github/settings/helpers.html" as helpers with context %} {%- from "invenio_github/helpers.html" import doi_badge with context -%} {%- extends config.GITHUB_SETTINGS_TEMPLATE %} {%- block javascript %} {{ super() }} {% assets "invenio_github_js" %}{% endassets %} {%- endblock %} {%- block settings_content %} {%- set github_rel_url = 'https://github.com/{0}/releases/new'.format(repo.name) %} {%- set latest_success_pid = None %} {%- set latest_published = repo.latest_release(status='D') %} {%- if latest_published %} {%- set latest_success_pid = latest_published|release_pid %} {%- endif %}
{{helpers.repo_switch(repo, repo.github_id, size='normal')}}

 {{ repo.name }}

{%- if latest_success_pid %}

{{ doi_badge(latest_success_pid.pid_value, github_id=repo.github_id) }}

{%- endif %} {{ helpers.panel_start( _('GitHub / Releases'), with_body=False, btn='Create release ...', btn_icon='fa fa-github', btn_href=github_rel_url, ) }} {%- if not releases %} {%- if repo.enabled %} {%- block repo_getstarted scoped %}

{{_('Get started!')}}

{{_('Go to GitHub and make your first release.')}}

{{ repo.name }}

{%- endblock repo_getstarted %} {%- else -%} {%- block repo_enable scoped %}

{{_('Get started!')}}

1 Flip the switch


Toggle the switch below to turn on/off automatic preservation of your repository.

2 Create a release


Go to GitHub and create a release. {{config.THEME_SITENAME | default('Invenio') }} will automatically download a .zip-ball of each new release and register a DOI.
{{helpers.repo_switch(repo, repo.github_id, size='large')}}
{%- endblock repo_enable %} {%- endif -%} {%- else %} {%- block repo_releases scoped %} {%- for release in releases %}
{%- block release_header scoped %}
{%- block release_status scoped %}
{{release.model.status.title}}
{{ release.model.created|naturaltime }} {%- endblock release_status %}
{%- endblock release_header %} {%- block release_body scoped %}
{%- if release.event %} {%- block releasetab_payload scoped %}
{{_('Received')}} {{release.event.created|datetimeformat}}.

GitHub Payload

{{ release.event.payload|tojson|prettyjson }}
{%- endblock releasetab_payload %} {%- endif %} {%- if release.status == 'D' %} {%- block releasetab_metadata scoped %}

{{_('JSON Export')}}

{{config.THEME_SITENAME | default('Invenio')}} automatically extracts metadata about your repository from GitHub APIs. For example, the authors are determined from the repository's contributor statistics. The automatic extraction is solely a best guess. Add a {{config.GITHUB_METADATA_FILE}} file the root of your repository to explicit define the metadata. The format of file is the same as for our REST API (use e.g. below JSON to get started).

{{ serializer.serialize(release.pid, release.record)|prettyjson }}
{%- endblock releasetab_metadata %} {%- endif %} {%- if release.model.errors %} {%- block releasetab_errors scoped %}

{{ _('Errors') }}

{{ release.model.errors|tojson|prettyjson }}
{%- endblock releasetab_errors %} {%- endif %}
{%- endblock release_body %} {%- set is_last = loop.last %} {%- block release_footer scoped %} {%- if not is_last %}
{%- endif %} {%- endblock release_footer %} {%- endfor %} {%- endblock repo_releases %} {%- endif %} {{ helpers.panel_end() }}
{%- endblock %}