Simplify template types
This commit is contained in:
parent
7d314b98ae
commit
729b3ba672
3 changed files with 6 additions and 6 deletions
|
|
@ -8,13 +8,13 @@ use crate::{config::Config, somehow};
|
||||||
struct CommitTemplate {
|
struct CommitTemplate {
|
||||||
base: String,
|
base: String,
|
||||||
repo_name: String,
|
repo_name: String,
|
||||||
current: String,
|
current: &'static str,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn get(State(config): State<&'static Config>) -> somehow::Result<impl IntoResponse> {
|
pub async fn get(State(config): State<&'static Config>) -> somehow::Result<impl IntoResponse> {
|
||||||
Ok(CommitTemplate {
|
Ok(CommitTemplate {
|
||||||
base: config.web.base(),
|
base: config.web.base(),
|
||||||
repo_name: config.repo.name(),
|
repo_name: config.repo.name(),
|
||||||
current: "commit".to_string(),
|
current: "commit",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ impl Commit {
|
||||||
struct CommitIdTemplate {
|
struct CommitIdTemplate {
|
||||||
base: String,
|
base: String,
|
||||||
repo_name: String,
|
repo_name: String,
|
||||||
current: String,
|
current: &'static str,
|
||||||
hash: String,
|
hash: String,
|
||||||
author: String,
|
author: String,
|
||||||
author_date: String,
|
author_date: String,
|
||||||
|
|
@ -100,7 +100,7 @@ pub async fn get(
|
||||||
Ok(CommitIdTemplate {
|
Ok(CommitIdTemplate {
|
||||||
base: config.web.base(),
|
base: config.web.base(),
|
||||||
repo_name: config.repo.name(),
|
repo_name: config.repo.name(),
|
||||||
current: "commit".to_string(),
|
current: "commit",
|
||||||
hash: commit.hash,
|
hash: commit.hash,
|
||||||
author: commit.author,
|
author: commit.author,
|
||||||
author_date: util::format_time(commit.author_date)?,
|
author_date: util::format_time(commit.author_date)?,
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ struct Ref {
|
||||||
struct IndexTemplate {
|
struct IndexTemplate {
|
||||||
base: String,
|
base: String,
|
||||||
repo_name: String,
|
repo_name: String,
|
||||||
current: String,
|
current: &'static str,
|
||||||
tracked_refs: Vec<Ref>,
|
tracked_refs: Vec<Ref>,
|
||||||
untracked_refs: Vec<Ref>,
|
untracked_refs: Vec<Ref>,
|
||||||
}
|
}
|
||||||
|
|
@ -56,7 +56,7 @@ pub async fn get(
|
||||||
Ok(IndexTemplate {
|
Ok(IndexTemplate {
|
||||||
base: config.web.base(),
|
base: config.web.base(),
|
||||||
repo_name: config.repo.name(),
|
repo_name: config.repo.name(),
|
||||||
current: "index".to_string(),
|
current: "index",
|
||||||
tracked_refs,
|
tracked_refs,
|
||||||
untracked_refs,
|
untracked_refs,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue