aboutsummaryrefslogtreecommitdiff
path: root/src/pages
diff options
context:
space:
mode:
authorKatharina Fey <kookie@spacekookie.de>2020-06-22 06:23:04 +0200
committerKatharina Fey <kookie@spacekookie.de>2020-06-22 06:23:04 +0200
commite30713b84bc9e66f7a8e8d2f51e953472cac28e4 (patch)
tree3098b1c77a978dcad0c828f57386d1c8999aa26b /src/pages
parent84a9a0ccee713e26a28ff5e54ea3776085d93b5f (diff)
Committing all the libgit2 progress before throwing it away
I don't think libgit2 is the way forward to make any of this work. There's so much work involved in parsing the git k-v store, and the library itself is essentially of zero help for most of the heavy lifting.
Diffstat (limited to 'src/pages')
-rw-r--r--src/pages/repo/about.rs33
-rw-r--r--src/pages/repo/details.rs50
-rw-r--r--src/pages/repo/mod.rs8
3 files changed, 38 insertions, 53 deletions
diff --git a/src/pages/repo/about.rs b/src/pages/repo/about.rs
index fa88eb1..1f207e2 100644
--- a/src/pages/repo/about.rs
+++ b/src/pages/repo/about.rs
@@ -1,32 +1,23 @@
-use super::RepoWrapper;
-use crate::types::RepoData;
+use crate::templ_data::repo::*;
use actix_web::{web, HttpRequest, HttpResponse, Result};
use askama::Template;
-#[derive(Template)]
-#[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> {
- let repo = AboutRepo {
+ let repo = pages::About {
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(),
- },
+ repo: 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(),
},
+ base: Default::default(),
}
.render()
.unwrap();
diff --git a/src/pages/repo/details.rs b/src/pages/repo/details.rs
index 4745e96..d5822d6 100644
--- a/src/pages/repo/details.rs
+++ b/src/pages/repo/details.rs
@@ -1,34 +1,36 @@
-use super::RepoWrapper;
-use crate::types::{BranchData, CommitData, RepoData};
+use crate::templ_data::repo::*;
use actix_web::{web, HttpRequest, HttpResponse, Result};
use askama::Template;
-#[derive(Template)]
-#[template(path = "repo/details.html")]
-struct AboutRepo {
- repo: RepoWrapper,
- branches: Vec<BranchData>,
- commits: Vec<CommitData>,
-}
-
/// Renders the "repository/about" subpage
pub async fn render(req: HttpRequest, path: web::Path<String>) -> Result<HttpResponse> {
- let repo = AboutRepo {
- branches: vec![],
- commits: vec![],
- 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(),
- },
+ let last_commit = CommitData {
+ hash: "84a9a0".into(),
+ message: "Updating just like... a bunch of shit".into(),
+ author: "Katharina Fey".into(),
+ date: "Today".into(),
+ diff: (125, 55)
+ };
+
+ let repo = pages::Details {
+ branches: vec![ BranchData {
+ name: "develop".into(),
+ last_commit: last_commit.clone(),
+ }
+ ],
+ commits: vec![ last_commit ],
+ repo: 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(),
},
+ base: Default::default(),
}
.render()
.unwrap();
diff --git a/src/pages/repo/mod.rs b/src/pages/repo/mod.rs
index 7d90c97..2b93592 100644
--- a/src/pages/repo/mod.rs
+++ b/src/pages/repo/mod.rs
@@ -5,11 +5,3 @@ mod details;
pub use about::render as about;
pub use details::render as details;
-
-use crate::types::RepoData;
-
-/// A template wrapper for repository data
-pub(self) struct RepoWrapper {
- pub(self) data: RepoData,
- pub(self) logo: String,
-}