diff options
Diffstat (limited to 'src/pages/repo/about.rs')
-rw-r--r-- | src/pages/repo/about.rs | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/src/pages/repo/about.rs b/src/pages/repo/about.rs index 8797edd..fa88eb1 100644 --- a/src/pages/repo/about.rs +++ b/src/pages/repo/about.rs @@ -1,35 +1,35 @@ +use super::RepoWrapper; +use crate::types::RepoData; use actix_web::{web, HttpRequest, HttpResponse, Result}; use askama::Template; #[derive(Template)] -#[template(path = "repo.html")] -struct Repo<'a> { - project_owner: &'a str, - project_summary: &'a str, - project_name: &'a str, - project_logo: &'a str, - project_logo_alt_text: &'a str, - first_commit: &'a str, - num_commits: usize, - num_contributors: usize, +#[template(path = "repo/about.html")] +struct AboutRepo { + repo: RepoWrapper, + readme: String, } /// Renders the "repository/about" subpage pub async fn render(req: HttpRequest, path: web::Path<String>) -> Result<HttpResponse> { - println!("Rendering path: {:#?}", path); - dbg!(req); - - let repo = Repo { - project_owner: "spacekookie", - project_summary: "A lightweight web frontend for git repositories", - project_name: "webgit", - project_logo: "rust.png", - project_logo_alt_text: "Rust logo", - first_commit: "f6ca929", - num_commits: 123, - num_contributors: 3, + let repo = AboutRepo { + readme: include_str!("../../../README").to_string(), + repo: RepoWrapper { + data: RepoData { + owner: "spacekookie".into(), + name: "octopus".into(), + tagline: "A lightweight web frontend for git repositories".into(), + num_commit: 141, + num_branch: 1, + num_tag: 0, + num_contributor: 3, + size: "13.12M".into(), + }, + logo: "fakeavi.png".into(), + }, } .render() .unwrap(); + Ok(HttpResponse::Ok().content_type("text/html").body(repo)) } |