From ba19d67f66a51aebf7144bb46ca26cc82109c79b Mon Sep 17 00:00:00 2001 From: Hubert Date: Sat, 24 Jul 2021 08:27:53 +0200 Subject: [PATCH] save --- src/web/repo.rs | 17 +++++++++++++++-- templates/git.html | 4 ++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/web/repo.rs b/src/web/repo.rs index 40d9675..9b45fb9 100644 --- a/src/web/repo.rs +++ b/src/web/repo.rs @@ -45,7 +45,7 @@ where for <'a> &'a TS : IntoIterator, { repo : Repository, browse : TS, - root_query : GitWebQ, + query : GitWebQ, breadcrumb: BREADCRUMB, user_opt : Option, revisions_nbr : u32, @@ -68,16 +68,29 @@ impl GitWebQ { res.commit = commit; return res; } + fn clone_with_path(&self, path : Option) -> GitWebQ { let mut res = self.clone(); res.path = path; return res; } + fn clone_with_branch(&self, branch : Option) -> GitWebQ { let mut res = self.clone(); res.branch = branch; return res; } + + fn root_query(&self) -> GitWebQ { + self.clone_with_path(None) + } + + fn add_path(&self, name : &&String) -> GitWebQ { + match &self.path { + None => {self.clone_with_path(Some(name.to_string()))} + Some(path) => {self.clone_with_path()} + } + } } impl Display for GitWebQ{ @@ -158,7 +171,7 @@ pub async fn git_main( Ok(GitMainTemplate { repo, browse : entries, - root_query : query_struct.clone_with_path(None), + query : query_struct, breadcrumb: path, user_opt : user, revisions_nbr : gitrepo.get_revisions_nbr(), diff --git a/templates/git.html b/templates/git.html index c1ad377..f83df8b 100644 --- a/templates/git.html +++ b/templates/git.html @@ -60,7 +60,7 @@