Files
xrpl-dev-portal/template/component-github-edit.html.jinja
2021-07-23 02:05:37 -07:00

29 lines
1.2 KiB
Django/Jinja

<div class="github-edit-wrap">
{% if target.github_forkurl is defined %}
{% set have_edit_link = False %}
{% if currentpage.md is defined %}
{% if currentpage.md.startswith("http://") or
currentpage.md.startswith("https://") %}
{# Leave have_edit_link = False #}
{% else %}
{% set have_edit_link = True %}
{% set githuburl = target.github_forkurl + "/edit/"
+ target.github_branch
+ "/content/" + currentpage.md %}
{% endif %}
{% elif currentpage.template is defined %}
{% set have_edit_link = True %}
{% set githuburl = target.github_forkurl + "/edit/"
+ target.github_branch + "/tool/" + currentpage.template %}
{% endif %}
{% if target.is_pr_build is defined and target.is_pr_build and have_edit_link %}
{% set githuburl = githuburl + "?pr=/XRPLF/xrpl-dev-portal/pull/"
+ target.github_pr_id %}
{% endif %}
{% if not have_edit_link %}
{% set githuburl = target.github_forkurl %}
{% endif %}
<a href="{{githuburl}}" target="_blank" class="btn btn-primary github-edit">{% trans %}Edit page{% endtrans %}</a>
{% endif %}
</div><!-- /.github-edit -->