Widgets combine HTML with JS and CSS dependencies with a unique identifier generator, allowing you to create truly modular HTML components.
- data GWidget sub master a
- type Widget y = GWidget y y
- widgetToPageContent :: Eq (Route master) => GWidget sub master () -> GHandler sub master (PageContent (Route master))
- applyLayoutW :: (Eq (Route m), Yesod m) => GWidget sub m () -> GHandler sub m RepHtml
- newIdent :: GWidget sub master String
- setTitle :: Html () -> GWidget sub master ()
- addStyle :: Hamlet (Route master) -> GWidget sub master ()
- addStylesheet :: Route master -> GWidget sub master ()
- addStylesheetRemote :: String -> GWidget sub master ()
- addScript :: Route master -> GWidget sub master ()
- addScriptRemote :: String -> GWidget sub master ()
- addHead :: Hamlet (Route master) -> GWidget sub master ()
- addBody :: Hamlet (Route master) -> GWidget sub master ()
- addJavaScript :: Hamlet (Route master) -> GWidget sub master ()
- wrapWidget :: GWidget s m a -> (Hamlet (Route m) -> Hamlet (Route m)) -> GWidget s m a
- extractBody :: GWidget s m () -> GWidget s m (Hamlet (Route m))
- urlJqueryJs :: String
- urlJqueryUiJs :: String
- urlJqueryUiCss :: String
Datatype
type Widget y = GWidget y ySource
A GWidget
specialized to when the subsite and master site are the same.
Unwrapping
widgetToPageContent :: Eq (Route master) => GWidget sub master () -> GHandler sub master (PageContent (Route master))Source
Convert a widget to a PageContent
.
applyLayoutW :: (Eq (Route m), Yesod m) => GWidget sub m () -> GHandler sub m RepHtmlSource
Apply the default layout to the given widget.
Creating
setTitle :: Html () -> GWidget sub master ()Source
Set the page title. Calling setTitle
multiple times overrides previously
set values.
addStylesheet :: Route master -> GWidget sub master ()Source
Link to the specified local stylesheet.
addStylesheetRemote :: String -> GWidget sub master ()Source
Link to the specified remote stylesheet.
addScriptRemote :: String -> GWidget sub master ()Source
Link to the specified remote script.
addJavaScript :: Hamlet (Route master) -> GWidget sub master ()Source
Include raw Javascript in the page's script tag.
Manipulating
wrapWidget :: GWidget s m a -> (Hamlet (Route m) -> Hamlet (Route m)) -> GWidget s m aSource
Modify the given GWidget
by wrapping the body tag HTML code with the
given function. You might also consider using extractBody
.
extractBody :: GWidget s m () -> GWidget s m (Hamlet (Route m))Source
Pull out the HTML tag contents and return it. Useful for performing some
manipulations. It can be easier to use this sometimes than wrapWidget
.
Default library URLs
The Google-hosted jQuery 1.4.2 file.
The Google-hosted jQuery UI 1.8.1 javascript file.
urlJqueryUiCss :: StringSource
The Google-hosted jQuery UI 1.8.1 CSS file with cupertino theme.