save
This commit is contained in:
parent
f9bc5b2e39
commit
ba19d67f66
|
@ -45,7 +45,7 @@ where for <'a> &'a TS : IntoIterator<Item = &'a Entry>,
|
||||||
{
|
{
|
||||||
repo : Repository,
|
repo : Repository,
|
||||||
browse : TS,
|
browse : TS,
|
||||||
root_query : GitWebQ,
|
query : GitWebQ,
|
||||||
breadcrumb: BREADCRUMB,
|
breadcrumb: BREADCRUMB,
|
||||||
user_opt : Option<User>,
|
user_opt : Option<User>,
|
||||||
revisions_nbr : u32,
|
revisions_nbr : u32,
|
||||||
|
@ -68,16 +68,29 @@ impl GitWebQ {
|
||||||
res.commit = commit;
|
res.commit = commit;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn clone_with_path(&self, path : Option<String>) -> GitWebQ {
|
fn clone_with_path(&self, path : Option<String>) -> GitWebQ {
|
||||||
let mut res = self.clone();
|
let mut res = self.clone();
|
||||||
res.path = path;
|
res.path = path;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn clone_with_branch(&self, branch : Option<String>) -> GitWebQ {
|
fn clone_with_branch(&self, branch : Option<String>) -> GitWebQ {
|
||||||
let mut res = self.clone();
|
let mut res = self.clone();
|
||||||
res.branch = branch;
|
res.branch = branch;
|
||||||
return res;
|
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{
|
impl Display for GitWebQ{
|
||||||
|
@ -158,7 +171,7 @@ pub async fn git_main<T : AuthValidator>(
|
||||||
Ok(GitMainTemplate {
|
Ok(GitMainTemplate {
|
||||||
repo,
|
repo,
|
||||||
browse : entries,
|
browse : entries,
|
||||||
root_query : query_struct.clone_with_path(None),
|
query : query_struct,
|
||||||
breadcrumb: path,
|
breadcrumb: path,
|
||||||
user_opt : user,
|
user_opt : user,
|
||||||
revisions_nbr : gitrepo.get_revisions_nbr(),
|
revisions_nbr : gitrepo.get_revisions_nbr(),
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
<div class="w3-cell-row">
|
<div class="w3-cell-row">
|
||||||
<div class="w3-cell">
|
<div class="w3-cell">
|
||||||
<ul class="breadcrumb">
|
<ul class="breadcrumb">
|
||||||
<li><a href="{{root_query}}">{{repo.name}}.git</a></li>
|
<li><a href="{{query.root_query()}}">{{repo.name}}.git</a></li>
|
||||||
{% for (dir, prev) in breadcrumb %}
|
{% for (dir, prev) in breadcrumb %}
|
||||||
<li><a href="{{prev}}">{{dir}}</a></li>
|
<li><a href="{{prev}}">{{dir}}</a></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -77,7 +77,7 @@
|
||||||
{% for entry in browse %}
|
{% for entry in browse %}
|
||||||
{% match entry %}
|
{% match entry %}
|
||||||
{% when Entry::Dir with (name) %}
|
{% when Entry::Dir with (name) %}
|
||||||
<li><i class="fa fa-folder"></i> {{ name }}</li>
|
<li><i class="fa fa-folder"></i> <a href="{{query.add_path(name)}}">{{ name }}</a></li>
|
||||||
{% when Entry::File with (name) %}
|
{% when Entry::File with (name) %}
|
||||||
<li><i class="fa fa-file"></i> {{ name }}</li>
|
<li><i class="fa fa-file"></i> {{ name }}</li>
|
||||||
{% endmatch %}
|
{% endmatch %}
|
||||||
|
|
Loading…
Reference in New Issue