[web-devel] using YesodJquery with other jquery plugins

Greg Weber greg at gregweber.info
Fri Dec 24 13:32:42 CET 2010


Hi Max,

I have:

instance YesodJquery APPNAME where
  urlJqueryJs _ = Left $ StaticR js_jquery_1_4_4_min_js
  urlJqueryUiJs _ = Left $ StaticR js_jquery_ui_1_8_6_custom_min_js
  urlJqueryUiCss _ = Left $ StaticR css_jquery_ui_1_8_6_custom_css

instance Yesod APPNAME where
  defaultLayout widget = do
    mmsg <- getMessage
    y <- getYesod
    pc <- widgetToPageContent $ do
        addWidget widget
        addScriptEither $ urlJqueryJs y
        addScriptEither $ urlJqueryUiJs y
        addStylesheetEither $ urlJqueryUiCss y


!!!
%html
  %head
    ^pageHead.pc^
    ...


This kind of system should fix your problems. This does seem
like unnecessary boiler plate though.

Greg Weber
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/web-devel/attachments/20101224/9751a521/attachment.htm>


More information about the web-devel mailing list