mygit

[UNMAINTAINED] A cgit/webgit alternative, written in Rust
Log | Files | Refs | README | LICENSE

commit bb3bf0e79138e99743860ab80eae8a1f10a958dd
parent fe09c2bde2463c9550ea9dce93f8ed3fe575bfda
Author: Johann150 <johann@qwertqwefsday.eu>
Date:   Mon, 15 Mar 2021 18:57:42 +0100

use repo_name filter everywhere

Diffstat:
Mtemplates/commit.html | 5++---
Mtemplates/log.html | 3+--
Mtemplates/refs.html | 5++---
Mtemplates/repo-navbar.html | 4++--
Mtemplates/repo.html | 1-
Mtemplates/tree.html | 1-
6 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/templates/commit.html b/templates/commit.html @@ -1,11 +1,10 @@ {% extends "base.html" %} {% block content %} - {% let name = repo.workdir().unwrap().file_name().unwrap().to_str().unwrap() %} {% include "repo-navbar.html" %} - <b>Commit:</b> <div class="commit-hash">{{commit.id()}}</div> (<a href="/{{name}}/tree/{{parent.id()}}">tree</a>) + <b>Commit:</b> <div class="commit-hash">{{commit.id()}}</div> (<a href="/{{repo|repo_name|urlencode_strict}}/tree/{{parent.id()}}">tree</a>) <br> - <b>Parent:</b> <a href="/{{name}}/commit/{{parent.id()}}"><div class="commit-hash">{{parent.id()}}</div></a> (<a href="/{{name}}/tree/{{parent.id()}}">tree</a>) + <b>Parent:</b> <a href="/{{repo|repo_name|urlencode_strict}}/commit/{{parent.id()}}"><div class="commit-hash">{{parent.id()}}</div></a> (<a href="/{{repo|repo_name|urlencode_strict}}/tree/{{parent.id()}}">tree</a>) <br> <b>Author:</b> {{commit.author().name().unwrap()}} &lt;<a href="mailto:{{commit.author().email().unwrap()}}">{{commit.author().email().unwrap()}}</a>&gt; <br> diff --git a/templates/log.html b/templates/log.html @@ -1,12 +1,11 @@ {% extends "base.html" %} {% block content %} - {% let name = repo.workdir().unwrap().file_name().unwrap().to_str().unwrap() %} {% include "repo-navbar.html" %} <table> {% for commit in commits %} <tr> - <td class="commit-hash"><a href="/{{name}}/commit/{{commit.id()}}">{{commit.id().to_string()[..7]}}</a></td> + <td class="commit-hash"><a href="/{{repo|repo_name|urlencode_strict}}/commit/{{commit.id()}}">{{commit.id().to_string()[..7]}}</a></td> {% let summary = commit.summary().unwrap_or("")|truncate(72) %} <td class="commit-summary">{{summary}}</td> <td class="commit-author-email"><a href="mailto:{{commit.author().email().unwrap_or("")}}">{{commit.author().name().unwrap_or("")}}</a></td> diff --git a/templates/refs.html b/templates/refs.html @@ -1,14 +1,13 @@ {% extends "base.html" %} {% block content %} - {% let name = repo.workdir().unwrap().file_name().unwrap().to_str().unwrap() %} {% include "repo-navbar.html" %} <h2>Branches</h2> <table> {% for branch in branches %} <tr> <td class="git-reference"> - <a href="/{{name}}/log/{{branch.shorthand().unwrap()}}">{{ branch.shorthand().unwrap() }}</a> + <a href="/{{repo|repo_name|urlencode_strict}}/log/{{branch.shorthand().unwrap()}}">{{ branch.shorthand().unwrap() }}</a> </td> </tr> {% endfor %} @@ -16,7 +15,7 @@ <h2>Tags</h2> <table> {% for tag in tags %} - <tr><td class="git-reference"><a href="/{{name}}/commit/{{tag.shorthand().unwrap()}}">{{ tag.shorthand().unwrap() }}</a></td></tr> + <tr><td class="git-reference"><a href="/{{repo|repo_name|urlencode_strict}}/commit/{{tag.shorthand().unwrap()}}">{{ tag.shorthand().unwrap() }}</a></td></tr> {% endfor %} </table> {% endblock %} diff --git a/templates/repo-navbar.html b/templates/repo-navbar.html @@ -1,5 +1,5 @@ -<h1><a href="/">index</a>/{{name}}</h1> +<h1><a href="/">index</a>/{{repo|repo_name}}</h1> <div>My cool repo</div> <div class="clone-url">git clone git.alexwennerberg.com/repo </div> -<div class="navbar"><a href="/{{name}}">README</a> | <a href="/{{name}}/tree">tree</a> | <a href="/{{name}}/log">log</a> | <a href="/{{name}}/refs">refs</a></div> +<div class="navbar"><a href="/{{repo|repo_name|urlencode_strict}}">README</a> | <a href="/{{repo|repo_name|urlencode_strict}}/tree">tree</a> | <a href="/{{repo|repo_name|urlencode_strict}}/log">log</a> | <a href="/{{repo|repo_name|urlencode_strict}}/refs">refs</a></div> <hr class='thin'> diff --git a/templates/repo.html b/templates/repo.html @@ -1,7 +1,6 @@ {% extends "base.html" %} {% block content %} - {% let name = repo.workdir().unwrap().file_name().unwrap().to_str().unwrap() %} {% include "repo-navbar.html" %} {{ readme_text|safe }} {% endblock %} diff --git a/templates/tree.html b/templates/tree.html @@ -1,7 +1,6 @@ {% extends "base.html" %} {% block content %} - {% let name = repo.workdir().unwrap().file_name().unwrap().to_str().unwrap() %} {% include "repo-navbar.html" %} <table> {% for entry in tree %}