~edwargix/git.sr.ht

58f956ab09791279c8f39cd12b0a2d03f51b1bd1 — Arsen Arsenović 2 years ago 1f83634
utils.html: Add a permalink breadcrumb
M gitsrht/templates/blame.html => gitsrht/templates/blame.html +1 -1
@@ 18,7 18,7 @@ pre, body {
<div class="header-extension" style="margin-bottom: 0;">
  <div class="blob container-fluid">
    <span>
      {{ utils.breadcrumb(ref, repo, path, entry, view, path_join, stat, pygit2, humanize) }}
      {{ utils.breadcrumb(ref, commit.id, repo, path, entry, view, path_join, stat, pygit2, humanize) }}
    </span>
    <div class="commit">
      <a

M gitsrht/templates/blob.html => gitsrht/templates/blob.html +1 -1
@@ 14,7 14,7 @@ pre {
<div class="header-extension" style="margin-bottom: 0;">
  <div class="blob container-fluid">
    <span>
      {{ utils.breadcrumb(ref, repo, path, entry, view, path_join, stat, pygit2, humanize) }}
      {{ utils.breadcrumb(ref, commit.id, repo, path, entry, view, path_join, stat, pygit2, humanize) }}
    </span>
    {% if commit %}
    <div class="commit">

M gitsrht/templates/log.html => gitsrht/templates/log.html +1 -1
@@ 25,7 25,7 @@
<div class="header-extension">
  <div class="container">
    <span style="padding-left: 1rem">
      {{ utils.breadcrumb(ref, repo, path, entry, view, path_join, stat, pygit2, humanize) }}
      {{ utils.breadcrumb(ref, commits[0].id, repo, path, entry, view, path_join, stat, pygit2, humanize) }}
    </span>
    <div class="clearfix"></div>
  </div>

M gitsrht/templates/tree.html => gitsrht/templates/tree.html +1 -1
@@ 7,7 7,7 @@
<div class="header-extension">
  <div class="container tree-header">
    <div class="breadcrumb">
      {{ utils.breadcrumb(ref, repo, path, entry, view, path_join, stat, pygit2, humanize) }}
      {{ utils.breadcrumb(ref, commit.id, repo, path, entry, view, path_join, stat, pygit2, humanize) }}
    </div>
    <div class="commit-info">
      <a

M gitsrht/templates/utils.html => gitsrht/templates/utils.html +7 -1
@@ 1,4 1,4 @@
{% macro breadcrumb(ref, repo, path, entry, view, path_join, stat, pygit2, humanize) %}
{% macro breadcrumb(ref, permaref, repo, path, entry, view, path_join, stat, pygit2, humanize) %}
{% set ref_s = ref.decode("utf-8", "replace") %}
{% if ref_s != repo.git_repo.default_branch_name() %}
<span style="margin-right: 1rem">


@@ 67,6 67,12 @@ endif %}{% endfor %}
                repo=repo.name, ref=ref, path=path)}}">View raw</a>
      </li>
    {% endif %}
    <li class="nav-item">
      <a class="nav-link"
         {%- set args = request.view_args.copy() -%}
         {%- do args.update(dict(ref=permaref)) -%}
         href="{{url_for(request.endpoint, **args)}}">Permalink</a>
    </li>
  </ul>
</div>
{% endmacro %}