Fix group links
This commit is contained in:
parent
aa1893feb2
commit
d9b010b33a
|
@ -114,6 +114,14 @@ pub async fn start_server(
|
|||
handle_admin(req, config.clone(), templates.clone(), dbs.clone())
|
||||
}
|
||||
});
|
||||
app.at(&format!("{}admin/g/", config.root_url)).get({
|
||||
let config = config.clone();
|
||||
let templates = templates.clone();
|
||||
let dbs = dbs.clone();
|
||||
move |req: tide::Request<()>| {
|
||||
handle_admin(req, config.clone(), templates.clone(), dbs.clone())
|
||||
}
|
||||
});
|
||||
app.at(&format!("{}admin/ad/:ad", config.root_url)).get({
|
||||
let config = config.clone();
|
||||
let templates = templates.clone();
|
||||
|
@ -234,6 +242,17 @@ async fn serve_group<'a>(
|
|||
})
|
||||
.collect::<Vec<AdWithId>>(),
|
||||
),
|
||||
parent_group_name: &dbs
|
||||
.group
|
||||
.get(&group.parent)
|
||||
.unwrap()
|
||||
.map_or_else(String::new, |parent_group| {
|
||||
bincode::deserialize::<Group>(&parent_group)
|
||||
.map_or_else(
|
||||
|_| String::new(),
|
||||
|parent_group| parent_group.name,
|
||||
)
|
||||
}),
|
||||
group: &to_json(group),
|
||||
groups: &to_json(
|
||||
dbs.group_by_group
|
||||
|
@ -316,6 +335,17 @@ async fn serve_admin_group<'a>(
|
|||
})
|
||||
.collect::<Vec<AdWithId>>(),
|
||||
),
|
||||
parent_group_name: &dbs
|
||||
.group
|
||||
.get(&group.parent)
|
||||
.unwrap()
|
||||
.map_or_else(String::new, |parent_group| {
|
||||
bincode::deserialize::<Group>(&parent_group)
|
||||
.map_or_else(
|
||||
|_| String::new(),
|
||||
|parent_group| parent_group.name,
|
||||
)
|
||||
}),
|
||||
group: &to_json(group),
|
||||
groups: &to_json(
|
||||
dbs.group_by_group
|
||||
|
|
|
@ -105,6 +105,7 @@ pub struct GroupTemplate<'a> {
|
|||
pub ads: &'a Json,
|
||||
pub group: &'a Json,
|
||||
pub groups: &'a Json,
|
||||
pub parent_group_name: &'a str,
|
||||
pub new_ad_form_refill: Option<NewAdQuery>,
|
||||
}
|
||||
|
||||
|
@ -115,6 +116,7 @@ pub struct AdminGroupTemplate<'a> {
|
|||
pub ads: &'a Json,
|
||||
pub group: &'a Json,
|
||||
pub groups: &'a Json,
|
||||
pub parent_group_name: &'a str,
|
||||
pub new_group_form_refill: Option<AdminNewGroupQuery>,
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
{{/if}}
|
||||
|
||||
{{#each groups}}
|
||||
<a href="{{root_url}}admin/g/{{this.name}}">{{this.title}}</a><br/>
|
||||
<a href="{{../root_url}}admin/g/{{this.name}}">{{this.title}}</a><br/>
|
||||
{{/each}}
|
||||
|
||||
{{#if ads}}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<h1>Administration – {{title}}</h1>
|
||||
<h2>{{group.title}}</h2>
|
||||
|
||||
<a href="{{root_url}}admin/g/{{group.parent}}">Groupe parent</a><br/>
|
||||
<a href="{{root_url}}admin/g/{{parent_group_name}}">Groupe parent</a><br/>
|
||||
|
||||
{{#if errors}}
|
||||
<div id="errors">
|
||||
|
@ -31,7 +31,7 @@
|
|||
{{/if}}
|
||||
|
||||
{{#each groups}}
|
||||
<a href="{{root_url}}admin/g/{{this.name}}">{{this.title}}</a><br/>
|
||||
<a href="{{../root_url}}admin/g/{{this.name}}">{{this.title}}</a><br/>
|
||||
{{/each}}
|
||||
|
||||
{{#if ads}}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<h1>{{title}}</h1>
|
||||
<h2>{{group.title}}</h2>
|
||||
|
||||
<a href="{{root_url}}admin/g/{{group.parent}}">Groupe parent</a><br/>
|
||||
<a href="{{root_url}}admin/g/{{parent_group_name}}">Groupe parent</a><br/>
|
||||
|
||||
{{#if errors}}
|
||||
<div id="errors">
|
||||
|
@ -31,7 +31,7 @@
|
|||
{{/if}}
|
||||
|
||||
{{#each groups}}
|
||||
<a href="{{root_url}}g/{{this.name}}">{{this.title}}</a><br/>
|
||||
<a href="{{../root_url}}g/{{this.name}}">{{this.title}}</a><br/>
|
||||
{{/each}}
|
||||
|
||||
{{#if ads}}
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<p>Ceci est une démo du nouveau site ĞMarché en développement.</p>
|
||||
|
||||
{{#each groups}}
|
||||
<a href="{{root_url}}g/{{this.name}}">{{this.title}}</a><br/>
|
||||
<a href="{{../root_url}}g/{{this.name}}">{{this.title}}</a><br/>
|
||||
{{/each}}
|
||||
|
||||
{{#if ads}}
|
||||
|
|
Loading…
Reference in New Issue