Widgets combine HTML with JS and CSS dependencies with a unique identifier generator, allowing you to create truly modular HTML components.
- newtype GWidget s m a = GWidget {
- unGWidget :: GWInner s m a
- liftHandler :: GHandler sub master a -> GWidget sub master a
- setTitle :: Html -> GWidget sub master ()
- addHamletHead :: Hamlet (Route master) -> GWidget sub master ()
- addHtmlHead :: Html -> GWidget sub master ()
- addHamlet :: Hamlet (Route master) -> GWidget sub master ()
- addHtml :: Html -> GWidget sub master ()
- addWidget :: GWidget s m () -> GWidget s m ()
- addSubWidget :: YesodSubRoute sub master => sub -> GWidget sub master a -> GWidget sub' master a
- addCassius :: Cassius (Route master) -> GWidget sub master ()
- addStylesheet :: Route master -> GWidget sub master ()
- addStylesheetRemote :: String -> GWidget sub master ()
- addStylesheetEither :: Either (Route master) String -> GWidget sub master ()
- addJulius :: Julius (Route master) -> GWidget sub master ()
- addScript :: Route master -> GWidget sub master ()
- addScriptRemote :: String -> GWidget sub master ()
- addScriptEither :: Either (Route master) String -> GWidget sub master ()
- extractBody :: GWidget s m () -> GWidget s m (Hamlet (Route m))
- newIdent :: GWidget sub master String
Datatype
A generic widget, allowing specification of both the subsite and master
site datatypes. This is basically a large WriterT
stack keeping track of
dependencies along with a StateT
to track unique identifiers.
Monad (HamletMonad (GWidget s m ())) | |
Monad (GWidget s m) | |
Functor (GWidget s m) | |
Applicative (GWidget s m) | |
MonadInvertIO (GWidget s m) | |
MonadIO (GWidget s m) | |
Monoid (GWidget sub master ()) | |
HamletValue (GWidget s m ()) |
liftHandler :: GHandler sub master a -> GWidget sub master aSource
Creating
Head of page
setTitle :: Html -> GWidget sub master ()Source
Set the page title. Calling setTitle
multiple times overrides previously
set values.
Body
addWidget :: GWidget s m () -> GWidget s m ()Source
Add another widget. This is defined as id
, by can help with types, and
makes widget blocks look more consistent.
addSubWidget :: YesodSubRoute sub master => sub -> GWidget sub master a -> GWidget sub' master aSource
CSS
addCassius :: Cassius (Route master) -> GWidget sub master ()Source
Add some raw CSS to the style tag.
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.
Javascript
addJulius :: Julius (Route master) -> GWidget sub master ()Source
Include raw Javascript in the page's script tag.
addScriptRemote :: String -> GWidget sub master ()Source
Link to the specified remote script.