mygit

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

commit 2b0b3cefd651e3003765c7edad162be3e2c63b27
parent 04082ef80ab084046f6faf228dfdcc365b49333a
Author: Johann150 <johann@qwertqwefsday.eu>
Date:   Tue, 23 Mar 2021 09:02:51 +0100

get site name directly from CONFIG

This reverts commit 04082ef80ab084046f6faf228dfdcc365b49333a.

Diffstat:
Msrc/main.rs | 6+-----
Mtemplates/index.html | 2+-
2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/main.rs b/src/main.rs @@ -100,7 +100,6 @@ fn args() -> Config { #[template(path = "index.html")] // using the template in this path, relative struct IndexTemplate { repos: Vec<Repository>, - site_name: String, } async fn index(_req: Request<()>) -> tide::Result { @@ -118,10 +117,7 @@ async fn index(_req: Request<()>) -> tide::Result { }) .map_err(|e| tide::log::warn!("can not read repositories: {}", e)) .unwrap_or_default(); - let index_template = IndexTemplate { - repos, - site_name: CONFIG.site_name.to_owned(), - }; + let index_template = IndexTemplate { repos }; Ok(index_template.into()) } diff --git a/templates/index.html b/templates/index.html @@ -1,7 +1,7 @@ {% extends "base.html" %} {% block content %} -<div class="page-title"><h1>{{site_name}}</h1></div> + <div class="page-title"><h1>{{crate::CONFIG.site_name}}</h1></div> <div> <table> {% for repo in repos %}