aboutsummaryrefslogtreecommitdiff
path: root/src/forms.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/forms.rs')
-rw-r--r--src/forms.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/forms.rs b/src/forms.rs
index 240d300..c827ccb 100644
--- a/src/forms.rs
+++ b/src/forms.rs
@@ -36,7 +36,9 @@ pub fn edit_text_form<'a, C: Controller>(
.oid
.is_some()
.then(|| action_links("edit", controller, ctx, parts)),
- body: String::new(),
+ scripts: vec![include_str!("static/edit_script.js")],
+ script_src: vec![include_str!("static/edit_script.js.sha")],
+ ..Default::default()
};
if let Some(access_info_html) = controller.access_info_html(&ctx, parts) {
page.body.push_str(&access_info_html);
@@ -70,11 +72,6 @@ pub fn edit_text_form<'a, C: Controller>(
"<input name=msg placeholder=Message value='{}' autocomplete=off></div></form>",
html_escape(data.msg.as_deref().unwrap_or_default())
));
-
- page.body.push_str(&format!(
- "<script>{}</script>",
- include_str!("static/edit_script.js")
- ));
page
}
@@ -94,8 +91,8 @@ pub fn move_form<C: Controller>(
) -> Result<Response, Error> {
let mut page = Page {
title: format!("Move {}", filename),
- body: String::new(),
header: Some(action_links("move", controller, ctx, parts)),
+ ..Default::default()
};
if let Some(error) = error {
@@ -131,5 +128,6 @@ pub fn upload_form<'a, C: Controller>(
</form>"
.into(),
header: file_exists.then(|| action_links("edit", controller, &ctx, parts)),
+ ..Default::default()
}
}