Factor out page header and body.

Commit
c366e7377b7de5f333741d1c64c49cb848cad05c
Author
Marius Peter <marius.peter@tutanota.com>
Author date
Committer
Marius Peter <marius.peter@tutanota.com>
Committer date
lib/views.ml
index d2f4501d..9345bf05 100644..100644
@@ -49,28 +49,29 @@
49 49 let footer_text = Printf.sprintf "Copyright %s %s" year config.user in
50 50 HTML.footer [] [ txt "%s" footer_text ]
51 51
52 Removed: let render ?(page_title = "Ogit") body_data =
52 Added: let head page_title =
53 53 let open HTML in
54 Removed: let bd = body_data in
55 Removed: html []
54 Added: head []
56 55 [
57 Removed: head []
58 Removed: [
59 Removed: title [] "%s" page_title;
60 Removed: link [ rel "stylesheet"; href "/static/styles.css" ];
61 Removed: link
62 Removed: [ rel "icon"; type_ "image/x-icon"; href "/static/git_icon.svg" ];
63 Removed: ];
64 Removed: body []
65 Removed: [
66 Removed: page_header bd.title bd.subtitle;
67 Removed: (match bd.repo with
68 Removed: | None -> HTML.null []
69 Removed: | Some repo -> Components.topnav ~active:bd.active repo);
70 Removed: div [ id "main" ] bd.content;
71 Removed: page_footer ();
72 Removed: ];
56 Added: title [] "%s" page_title;
57 Added: link [ rel "stylesheet"; href "/static/styles.css" ];
58 Added: link [ rel "icon"; type_ "image/x-icon"; href "/static/git_icon.svg" ];
73 59 ]
60 Added:
61 Added: let body bd =
62 Added: let open HTML in
63 Added: body []
64 Added: [
65 Added: page_header bd.title bd.subtitle;
66 Added: (match bd.repo with
67 Added: | None -> HTML.null []
68 Added: | Some repo -> Components.topnav ~active:bd.active repo);
69 Added: div [ id "main" ] bd.content;
70 Added: page_footer ();
71 Added: ]
72 Added:
73 Added: let render ?(page_title = "Ogit") body_data =
74 Added: HTML.html [] [ head page_title; body body_data ]
74 75 end
75 76
76 77 let root () =
@@ -240,13 +241,7 @@
240 241 respond
241 242 @@ html []
242 243 [
243 Removed: head []
244 Removed: [
245 Removed: title [] "Fatal error";
246 Removed: link [ rel "stylesheet"; href "/static/styles.css" ];
247 Removed: link
248 Removed: [ rel "icon"; type_ "image/x-icon"; href "/static/git_icon.svg" ];
249 Removed: ];
244 Added: Page.head "Fatal Error";
250 245 body []
251 246 [
252 247 h1 [] [ txt "Fatal Error" ];