aboutsummaryrefslogtreecommitdiff
path: root/src/get_routes.rs
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2021-06-24 21:07:45 +0200
committerMartin Fischer <martin@push-f.com>2021-06-24 23:14:15 +0200
commitd43543440e5d3f0e93ed1cf197601d778541c3ae (patch)
treed966b40936d7ef8cb559e2b556d3b9e01a5f824b /src/get_routes.rs
parentb019d39957bd644d9b6b856738b57eb87e0506de (diff)
generate <script> tags and CSP from Page vectors
Diffstat (limited to 'src/get_routes.rs')
-rw-r--r--src/get_routes.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/get_routes.rs b/src/get_routes.rs
index 3661896..b9ad933 100644
--- a/src/get_routes.rs
+++ b/src/get_routes.rs
@@ -56,8 +56,8 @@ fn view_blob<C: Controller>(
) -> Result<Response, Error> {
let mut page = Page {
title: ctx.file_name().unwrap().to_owned(),
- body: String::new(),
header: Some(action_links(&params.action, controller, &ctx, parts)),
+ ..Default::default()
};
if let Some(access_info_html) = controller.access_info_html(&ctx, parts) {
@@ -135,8 +135,8 @@ fn log_blob<C: Controller>(
let mut page = Page {
title: format!("Log for {}", filename),
- body: String::new(),
header: Some(action_links(&params.action, controller, &ctx, parts)),
+ ..Default::default()
};
let mut walk = ctx.repo.revwalk()?;
@@ -256,6 +256,7 @@ fn diff_blob<C: Controller>(
title: format!("Commit for {}", ctx.file_name().unwrap()),
body: "file removed".into(),
header: Some(action_links(&action_param.action, controller, &ctx, parts)),
+ ..Default::default()
}
.into());
};
@@ -279,7 +280,7 @@ fn diff_blob<C: Controller>(
ctx.file_name().unwrap()
),
header: Some(action_links(&action_param.action, controller, &ctx, parts)),
- body: String::new(),
+ ..Default::default()
};
page.body.push_str("<div>");
if params.oldid.is_none() {
@@ -400,6 +401,7 @@ fn remove_blob<C: Controller>(
<label>Message <input name=msg autofocus></label>\
<button>Remove</button></form>"
.into(),
+ ..Default::default()
};
Ok(page.into())
@@ -413,8 +415,7 @@ pub fn view_tree<C: Controller>(
) -> Result<Response, Error> {
let mut page = Page {
title: ctx.path.to_string_lossy().to_string(),
- body: String::new(),
- header: None,
+ ..Default::default()
};
page.body.push_str("<ul>");