added jsAttributes for the script tag generated by julius files
This commit is contained in:
parent
54cc4205d8
commit
cec6f42a99
@ -254,6 +254,11 @@ class RenderRoute site => Yesod site where
|
|||||||
jsLoader :: site -> ScriptLoadPosition site
|
jsLoader :: site -> ScriptLoadPosition site
|
||||||
jsLoader _ = BottomOfBody
|
jsLoader _ = BottomOfBody
|
||||||
|
|
||||||
|
-- | Default attributes to put on the JavaScript <script> tag
|
||||||
|
-- generated for julius files
|
||||||
|
jsAttributes :: site -> [(Text, Text)]
|
||||||
|
jsAttributes _ = []
|
||||||
|
|
||||||
-- | Create a session backend. Returning 'Nothing' disables
|
-- | Create a session backend. Returning 'Nothing' disables
|
||||||
-- sessions. If you'd like to change the way that the session
|
-- sessions. If you'd like to change the way that the session
|
||||||
-- cookies are created, take a look at
|
-- cookies are created, take a look at
|
||||||
@ -570,7 +575,7 @@ widgetToPageContent w = do
|
|||||||
^{mkScriptTag s}
|
^{mkScriptTag s}
|
||||||
$maybe j <- jscript
|
$maybe j <- jscript
|
||||||
$maybe s <- jsLoc
|
$maybe s <- jsLoc
|
||||||
<script src="#{s}">
|
^{mkDefaultScriptTag s (jsAttributes master)}
|
||||||
$nothing
|
$nothing
|
||||||
<script>^{jelper j}
|
<script>^{jelper j}
|
||||||
|]
|
|]
|
||||||
@ -613,6 +618,8 @@ widgetToPageContent w = do
|
|||||||
renderLoc' _ (Remote s) = s
|
renderLoc' _ (Remote s) = s
|
||||||
|
|
||||||
addAttr x (y, z) = x ! customAttribute (textTag y) (toValue z)
|
addAttr x (y, z) = x ! customAttribute (textTag y) (toValue z)
|
||||||
|
mkDefaultScriptTag sUrl attrs _ =
|
||||||
|
foldl' addAttr TBH.script (("src", sUrl) : attrs) $ return ()
|
||||||
mkScriptTag (Script loc attrs) render' =
|
mkScriptTag (Script loc attrs) render' =
|
||||||
foldl' addAttr TBH.script (("src", renderLoc' render' loc) : attrs) $ return ()
|
foldl' addAttr TBH.script (("src", renderLoc' render' loc) : attrs) $ return ()
|
||||||
mkLinkTag (Stylesheet loc attrs) render' =
|
mkLinkTag (Stylesheet loc attrs) render' =
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user