💾 Archived View for lists.flounder.online › patches › threads › 20210315175744.6493-3-johann@qwertqw… captured on 2022-04-28 at 19:25:26. Gemini links have been rewritten to link to archived content

View Raw

More Information

-=-=-=-=-=-=-

[PATCH mygit 3/5] use repo_name filter everywhere

[PATCH mygit 3/5] use repo_name filter everywhere

From: johann@qwertqwefsday.eu

Date: Mon, 15 Mar 2021 18:57:42 +0100

Message-Id: 20210315175744.6493-3-johann@qwertqwefsday.eu

To: <~aw/patches@lists.sr.ht>

In-Reply-To: 20210315175744.6493-1-johann@qwertqwefsday.eu

Cc: "Johann150" <johann@qwertqwefsday.eu>

Reply

Export

--------------------------------------

From: Johann150 <johann@qwertqwefsday.eu>

---

templates/commit.html | 5 ++---

templates/log.html | 3 +--

templates/refs.html | 5 ++---

templates/repo-navbar.html | 4 ++--

templates/repo.html | 1 -

templates/tree.html | 1 -

6 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/templates/commit.html b/templates/commit.html

index 5137b92..1e140c9 100644

--- 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

index 730d245..382196a 100644

--- 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

index c048961..15b7bfc 100644

--- 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

index effeb08..e902449 100644

--- 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

index 85733e4..e2fcd0e 100644

--- 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

index 06a38c3..8f39c30 100644

--- 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 %}

--

2.20.1