aboutsummaryrefslogtreecommitdiff
path: root/src/pages/repo
diff options
context:
space:
mode:
authorKatharina Fey <kookie@spacekookie.de>2019-12-29 16:34:39 +0100
committerKatharina Fey <kookie@spacekookie.de>2019-12-29 16:34:39 +0100
commit8b38bdd1478baf6fd53b9a8a53eb3a183c59b781 (patch)
treecd0a417fd84befa98b660310a248f4f5172463bc /src/pages/repo
parentc896fcdab70f101a6eaaa4fd6f7f03f9b1324e81 (diff)
data: adding a small wrapper around libgit2
Diffstat (limited to 'src/pages/repo')
-rw-r--r--src/pages/repo/about.rs36
-rw-r--r--src/pages/repo/mod.rs3
2 files changed, 39 insertions, 0 deletions
diff --git a/src/pages/repo/about.rs b/src/pages/repo/about.rs
new file mode 100644
index 0000000..adfa46e
--- /dev/null
+++ b/src/pages/repo/about.rs
@@ -0,0 +1,36 @@
+//! The "repository/about" subpage
+
+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,
+}
+
+pub 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,
+ }
+ .render()
+ .unwrap();
+ Ok(HttpResponse::Ok().content_type("text/html").body(repo))
+}
diff --git a/src/pages/repo/mod.rs b/src/pages/repo/mod.rs
new file mode 100644
index 0000000..c339350
--- /dev/null
+++ b/src/pages/repo/mod.rs
@@ -0,0 +1,3 @@
+//! The repository page subtree
+
+pub mod about;