mygit

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

commit 06c01109b573c98c83eac2b2383038db6add264a
parent 1ab3d96c1e70d6c6f6c5275b33902345776e389a
Author: Johann150 <johann@qwertqwefsday.eu>
Date:   Mon, 19 Jul 2021 13:03:10 +0200

add RSS feed links, unify styles

All h3's are no longer full width so we do not have to use CSS float's
which are hacks and mess up the tab order.

Diffstat:
Msrc/main.rs | 5+++++
Mtemplates/base.html | 1+
Mtemplates/file.html | 2+-
Mtemplates/log.html | 7+++++--
Mtemplates/refs.html | 7+++++--
Mtemplates/static/style.css | 13+++++++++++--
6 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/src/main.rs b/src/main.rs @@ -832,6 +832,10 @@ async fn static_resource(req: Request<()>) -> tide::Result { File::open("templates/static/robots.txt").unwrap(), http::mime::PLAIN, )), + "/Feed-icon.svg" => Some(( + File::open("templates/static/Feed-icon.svg").unwrap(), + http::mime::SVG, + )), _ => None, }; @@ -1043,6 +1047,7 @@ async fn main() -> Result<(), std::io::Error> { app.at("/style.css").get(static_resource); app.at("/robots.txt").get(static_resource); + app.at("/Feed-icon.svg").get(static_resource); // Raw files, patch files app.at("/mail").get(mail::list_threads); diff --git a/templates/base.html b/templates/base.html @@ -8,6 +8,7 @@ <link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>{{crate::CONFIG.emoji_favicon}}</text></svg>"> <meta name="description" content="My self-hosted git repositories"> <title>{% block title %}{{crate::CONFIG.site_name}}{% endblock %}</title> + {% block head %}{% endblock %} </head> <body> <div id="content"> diff --git a/templates/file.html b/templates/file.html @@ -4,7 +4,7 @@ {% block content %} {% include "repo-navbar.html" %} - <h3 style="display:inline-block;">{{path.display()}}@<a href="/{{repo|repo_name|urlencode_strict}}/tree/{{spec}}">{{spec}}</a></h3> + <h3>{{path.display()}}@<a href="/{{repo|repo_name|urlencode_strict}}/tree/{{spec}}">{{spec}}</a></h3> <a href="/{{repo|repo_name|urlencode_strict}}/tree/{{spec}}/raw/{{path.display()}}">raw</a> {% include "last-commit.html" %} {{file_text|safe}} diff --git a/templates/log.html b/templates/log.html @@ -2,12 +2,15 @@ {% block title %}{{repo|repo_name}} log at {{branch}} - {{crate::CONFIG.site_name}}{% endblock %} +{% block head %}<link rel="alternate" type="application/rss+xml" title="{{repo|repo_name}} {{branch}} commits" href="log.xml">{% endblock %} + {% block content %} {% include "repo-navbar.html" %} + <h3>{{branch}}</h3> + <a href="log.xml" class="feed"><img src="/Feed-icon.svg" alt="RSS feed icon"/></a> {% if next_page.is_some() %} - <a href="{{next_page.as_ref().unwrap()}}" style="float:right;">older commits &rarr;</a> + <a href="{{next_page.as_ref().unwrap()}}">older commits &rarr;</a> {% endif %} - <h3>{{branch}}</h3> <table> {% for commit in commits %} {% include "commit-tr.html" %} diff --git a/templates/refs.html b/templates/refs.html @@ -2,9 +2,11 @@ {% block title %}{{repo|repo_name}} refs - {{crate::CONFIG.site_name}}{% endblock %} +{% block head %}<link rel="alternate" type="application/rss+xml" title="{{repo|repo_name}} tags" href="refs.xml">{% endblock %} + {% block content %} {% include "repo-navbar.html" %} - <h2>Branches</h2> + <h3>Branches</h3> <table> {% for branch in branches %} <tr> @@ -14,7 +16,8 @@ </tr> {% endfor %} </table> - <h2>Tags</h2> + <h3>Tags</h3> + <a href="log.xml" class="feed"><img src="/Feed-icon.svg" alt="RSS feed icon"/></a> <table> {% for (link, tag, signature) in tags %} <tr> diff --git a/templates/static/style.css b/templates/static/style.css @@ -60,6 +60,11 @@ h1, h2, h3 { margin: 0; } +h3 { + display: inline-block; + margin-right: 2em; +} + pre { line-height: 1.2; font-size: 1rem; @@ -85,11 +90,15 @@ table.core { } .badge { - padding: .2em; + padding: .2em; } .commit-summary { - width: 100%; + width: 100%; +} + +a.feed>img { + height: 1em; } @media only screen and (max-width: 600px) {