Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Network/Gitit/Layout.hs
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,14 @@ defaultRenderPage :: T.StringTemplate String -> PageLayout -> Html -> Handler
defaultRenderPage templ layout htmlContents = do
cfg <- getConfig
base' <- getWikiBase
user <- getLoggedInUser
ok . setContentType "text/html; charset=utf-8" . toResponse . T.render .
filledPageTemplate base' cfg layout htmlContents $ templ
filledPageTemplate user base' cfg layout htmlContents $ templ

-- | Returns a page template with gitit variables filled in.
filledPageTemplate :: String -> Config -> PageLayout -> Html ->
filledPageTemplate :: Maybe User -> String -> Config -> PageLayout -> Html ->
T.StringTemplate String -> T.StringTemplate String
filledPageTemplate base' cfg layout htmlContents templ =
filledPageTemplate user base' cfg layout htmlContents templ =
let rev = pgRevision layout
page = pgPageName layout
prefixedScript x = case x of
Expand Down Expand Up @@ -101,6 +102,7 @@ filledPageTemplate base' cfg layout htmlContents templ =
setBoolAttr "ispage" (isPage page) .
setBoolAttr "pagetools" (pgShowPageTools layout) .
setBoolAttr "sitenav" (pgShowSiteNav layout) .
maybe id (T.setAttribute "loggedinuser" . uUsername) user .
maybe id (T.setAttribute "markuphelp") (pgMarkupHelp layout) .
setBoolAttr "printable" (pgPrintable layout) .
maybe id (T.setAttribute "revision") rev .
Expand Down
14 changes: 0 additions & 14 deletions data/templates/getuser.st

This file was deleted.

1 change: 0 additions & 1 deletion data/templates/page.st
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,5 @@
</div>
$javascripts$
$expire()$
$getuser()$
</body>
</html>
10 changes: 4 additions & 6 deletions data/templates/userbox.st
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<div id="userbox">
<noscript>
<a href="$base$/_login">Login</a>
<a href="$base$/_logout">Logout</a>
</noscript>
&nbsp;
$if(loggedinuser)$
<a id="logoutlink" class="login" href="$base$/_logout">Logout <span id="logged_in_user">$loggedinuser$</span></a>
$else$
<a id="loginlink" class="login" href="$base$/_login">Login / Get an account</a>
<a id="logoutlink" class="login" href="$base$/_logout">Logout <span id="logged_in_user"></span></a>
$else$
</div>
2 changes: 1 addition & 1 deletion gitit.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ data-files: data/static/css/screen.css, data/static/css/print.css,
data/templates/logo.st, data/templates/markuphelp.st,
data/templates/pagetools.st, data/templates/sitenav.st,
data/templates/messages.st, data/templates/listitem.st,
data/templates/expire.st, data/templates/getuser.st,
data/templates/expire.st,
data/markupHelp/Markdown, data/markupHelp/Markdown+LHS,
data/markupHelp/RST, data/markupHelp/RST+LHS,
data/markupHelp/LaTeX, data/markupHelp/LaTeX+LHS,
Expand Down