1
1
mirror of https://github.com/aelve/guide.git synced 2024-11-27 10:10:50 +03:00

Serve Javascript as a pseudo-file

This commit is contained in:
Artyom 2016-03-04 15:05:03 +03:00
parent aaf8af5de5
commit a0308d093c

View File

@ -515,6 +515,10 @@ addMethods = Spock.subcomponent "add" $ do
otherMethods :: SpockM () () (IORef GlobalState) ()
otherMethods = do
-- Javascript
Spock.get "js.js" $
Spock.text (fromJS allJSFunctions)
-- Search
Spock.post "search" $ do
query <- param' "query"
@ -599,8 +603,9 @@ renderRoot globalState = do
includeJS "https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"
includeCSS "/css.css"
-- Include definitions of all Javascript functions that we have defined in
-- this file.
script_ (fromJS allJSFunctions)
-- this file. (This isn't an actual file, so don't look for it in the
-- static folder it's generated and served in 'otherMethods'.)
includeJS "/js.js"
h1_ "Collaborative notes on Haskell libraries and tools"
-- By default help is rendered hidden, and then showOrHideHelp reads a
-- value from local storage and decides whether to show help or not. On one