diff options
author | Kjetil Orbekk <kjetil.orbekk@gmail.com> | 2017-06-17 22:31:27 -0400 |
---|---|---|
committer | Kjetil Orbekk <kjetil.orbekk@gmail.com> | 2017-06-17 22:31:27 -0400 |
commit | 76b90acb735d3ed2b3052abc1d2403287af83619 (patch) | |
tree | 857de2ebee3d2b6ea802aa1ef249ea34bb0e0908 /src/render/mod.rs | |
parent | 1e5f237c20310cbf6ace17b6a7b05298429aca46 (diff) |
rustfmt: Reformatted all the code.
Diffstat (limited to 'src/render/mod.rs')
-rw-r--r-- | src/render/mod.rs | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/render/mod.rs b/src/render/mod.rs index fe0053a..b47ee55 100644 --- a/src/render/mod.rs +++ b/src/render/mod.rs @@ -5,14 +5,15 @@ use horrorshow::Raw; #[derive(Debug)] pub struct Renderer { - pub user: Option<String> + pub user: Option<String>, } impl Renderer { fn render_in_page<'a>(&self, content: Box<RenderBox + 'a>) -> String { info!("Rendering page with context: {:?}", self); let login_box: Box<RenderBox> = match self.user { - Some(ref user) => box_html!{ + Some(ref user) => { + box_html!{ : "Logged in as "; : user; : " ("; @@ -20,12 +21,15 @@ impl Renderer { : "log out" } : ")"; - }, - None => box_html! { + } + } + None => { + box_html! { a(href="login") { // TODO Get base url from context : "Login" } } + } }; (html!{ @@ -55,7 +59,9 @@ impl Renderer { } } } - }).into_string().unwrap() + }) + .into_string() + .unwrap() } pub fn login_page(&self, is_retry: bool) -> String { @@ -99,7 +105,7 @@ impl Renderer { table { tr { th { - : "Unit" + : "Unit" } th { : "Active" @@ -112,8 +118,7 @@ impl Renderer { } } - pub fn system_status(&self, sections: &[(String, Vec<&unit::Unit>)]) - -> String { + pub fn system_status(&self, sections: &[(String, Vec<&unit::Unit>)]) -> String { self.render_in_page(box_html! { @ for &(ref type_, ref units) in sections { h1 { |