summaryrefslogtreecommitdiff
path: root/menu.ur
diff options
context:
space:
mode:
authorGravatar Benjamin Barenblat <bbaren@mit.edu>2013-03-16 16:25:45 -0400
committerGravatar Benjamin Barenblat <bbaren@mit.edu>2013-03-16 16:25:45 -0400
commit5b8b76078ca1eb04ad787b1884b1c1e79b2273c8 (patch)
tree88f1e5a960781b16d93ecc63f351c721bf55503f /menu.ur
parent963ab32b176228017635e4ef1bb60555c4022142 (diff)
Decouple a bunch of stuff into Config and Template
Diffstat (limited to 'menu.ur')
-rw-r--r--menu.ur19
1 files changed, 7 insertions, 12 deletions
diff --git a/menu.ur b/menu.ur
index 4be6d3d..83d6176 100644
--- a/menu.ur
+++ b/menu.ur
@@ -25,30 +25,25 @@ and it's no more unsafe than anything you'd do in a "normal" Web framework. *)
open Styles
-con pageName = variant (mapU unit [Main, Forum])
-
(* Generates the link text *)
-fun getName (n : pageName) : xbody =
+fun getName (n : Config.pageName) : xbody =
match n { Main = fn () => <xml>Main</xml>,
Forum = fn () => <xml>Forum</xml> }
(* Generates the link URL *)
-fun getUrl (n : pageName) : url =
- let val base = "/urweb/6.947"
- in
- match n { Main = fn () => bless (base ^ "/index"),
- Forum = fn () => bless (base ^ "/forum") }
- end
+fun getUrl (n : Config.pageName) : url =
+ match n { Main = fn () => bless (Config.baseUrlS ^ "/index"),
+ Forum = fn () => bless (Config.baseUrlS ^ "/forum") }
(* Actual title and menu generation code *)
-fun header (current : pageName) : xbody =
- let fun item (target : pageName) =
+fun header (current : Config.pageName) : xbody =
+ let fun item (target : Config.pageName) =
if Variant.eq current target
then <xml><li class={active}>{getName target}</li></xml>
else <xml><li><a href={getUrl target}>{getName target}</a></li></xml>
in
<xml>
- <h1 class={siteTitle}><a href={getUrl (make [#Main] ())}>6.947 &ndash; Functional Programming Project Laboratory</a></h1>
+ <h1 class={siteTitle}><a href={getUrl (make [#Main] ())}>{Config.siteTitle}</a></h1>
<ul class={navBar}>
{item (make [#Main] ())}
{item (make [#Forum] ())}