From 0d3a9e2533658d84c77ce6f68f7968e11f1c09f0 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Mon, 1 Oct 2018 17:26:18 -0400 Subject: [PATCH] Polish --- gitsrht/app.py | 5 ++++ gitsrht/templates/blob.html | 49 +++++++++++++++++++++++----------- gitsrht/templates/commit.html | 7 +++-- gitsrht/templates/log.html | 7 +++-- gitsrht/templates/refs.html | 5 ++-- gitsrht/templates/summary.html | 7 +++-- gitsrht/templates/tree.html | 11 +++++++- gitsrht/templates/utils.html | 15 +++++++---- 8 files changed, 73 insertions(+), 33 deletions(-) diff --git a/gitsrht/app.py b/gitsrht/app.py index 3f9fc90..f4c41bb 100644 --- a/gitsrht/app.py +++ b/gitsrht/app.py @@ -2,6 +2,7 @@ import humanize import stat import os from flask import session +from functools import lru_cache from srht.flask import SrhtFlask from srht.config import cfg from srht.database import DbSession @@ -15,6 +16,9 @@ db.init() import gitsrht.oauth from gitsrht.git import commit_time, trim_commit +def lookup_user(email): + return User.query.filter(User.email == email).one_or_none() + class GitApp(SrhtFlask): def __init__(self): super().__init__("git.sr.ht", __name__) @@ -46,6 +50,7 @@ class GitApp(SrhtFlask): "commit_time": commit_time, "trim_commit": trim_commit, "humanize": humanize, + "lookup_user": lookup_user, "stat": stat, "notice": notice, "path_join": os.path.join diff --git a/gitsrht/templates/blob.html b/gitsrht/templates/blob.html index a530ead..fd03801 100644 --- a/gitsrht/templates/blob.html +++ b/gitsrht/templates/blob.html @@ -1,5 +1,8 @@ {% extends "repo.html" %} {% import "utils.html" as utils %} +{% block title %} +{{repo.owner.canonical_name}}/{{repo.name}}: {{path_join(*path)}} - {{cfg("sr.ht", "site-name")}} git +{% endblock %} {% block content %}