diff options
Diffstat (limited to 'src/forms.rs')
-rw-r--r-- | src/forms.rs | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/forms.rs b/src/forms.rs index fc16d09..240d300 100644 --- a/src/forms.rs +++ b/src/forms.rs @@ -1,3 +1,4 @@ +use hyper::http::request::Parts; use serde::Deserialize; use sputnik::html_escape; @@ -19,7 +20,8 @@ pub fn edit_text_form<'a, C: Controller>( error: Option<&str>, controller: &'a C, ctx: &'a Context, -) -> Page<'a> { + parts: &Parts, +) -> Page { let mut page = Page { title: format!( "{} {}", @@ -33,12 +35,10 @@ pub fn edit_text_form<'a, C: Controller>( header: data .oid .is_some() - .then(|| action_links("edit", controller, ctx)), + .then(|| action_links("edit", controller, ctx, parts)), body: String::new(), - controller, - parts: &ctx.parts, }; - if let Some(access_info_html) = controller.access_info_html(&ctx) { + if let Some(access_info_html) = controller.access_info_html(&ctx, parts) { page.body.push_str(&access_info_html); } if let Some(hint_html) = controller.edit_hint_html(ctx) { @@ -90,13 +90,12 @@ pub fn move_form<C: Controller>( error: Option<&str>, controller: &C, ctx: &Context, + parts: &Parts, ) -> Result<Response, Error> { let mut page = Page { title: format!("Move {}", filename), - controller, - parts: &ctx.parts, body: String::new(), - header: Some(action_links("move", controller, ctx)), + header: Some(action_links("move", controller, ctx, parts)), }; if let Some(error) = error { @@ -120,7 +119,8 @@ pub fn upload_form<'a, C: Controller>( file_exists: bool, controller: &'a C, ctx: &'a Context, -) -> Page<'a> { + parts: &Parts, +) -> Page { let filename = ctx.path.file_name().unwrap().to_str().unwrap(); Page { title: format!("Uploading {}", filename), @@ -130,8 +130,6 @@ pub fn upload_form<'a, C: Controller>( <button>Upload</button>\ </form>" .into(), - header: file_exists.then(|| action_links("edit", controller, &ctx)), - controller, - parts: &ctx.parts, + header: file_exists.then(|| action_links("edit", controller, &ctx, parts)), } } |