Widgets combine HTML with JS and CSS dependencies with a unique identifier generator, allowing you to create truly modular HTML components.
- type GWidget s m = GGWidget m (GHandler s m)
- newtype GGWidget m monad a = GWidget {
- unGWidget :: GWInner m monad a
- data PageContent url = PageContent {}
- whamlet :: QuasiQuoter
- whamletFile :: FilePath -> Q Exp
- ihamletToRepHtml :: (Monad mo, RenderMessage master message) => IHamlet message (Route master) -> GGHandler sub master mo RepHtml
- setTitle :: Monad m => Html -> GGWidget master m ()
- setTitleI :: (RenderMessage master msg, Monad m) => msg -> GGWidget master (GGHandler sub master m) ()
- addHamletHead :: Monad m => Hamlet (Route master) -> GGWidget master m ()
- addHtmlHead :: Monad m => Html -> GGWidget master m ()
- addHamlet :: Monad m => Hamlet (Route master) -> GGWidget master m ()
- addHtml :: Monad m => Html -> GGWidget master m ()
- addWidget :: Monad mo => GGWidget m mo () -> GGWidget m mo ()
- addSubWidget :: YesodSubRoute sub master => sub -> GWidget sub master a -> GWidget sub' master a
- addCassius :: Monad m => Cassius (Route master) -> GGWidget master m ()
- addCassiusMedia :: Monad m => Text -> Cassius (Route master) -> GGWidget master m ()
- addLucius :: Monad m => Lucius (Route master) -> GGWidget master m ()
- addLuciusMedia :: Monad m => Text -> Lucius (Route master) -> GGWidget master m ()
- addStylesheet :: Monad m => Route master -> GGWidget master m ()
- addStylesheetAttrs :: Monad m => Route master -> [(Text, Text)] -> GGWidget master m ()
- addStylesheetRemote :: Monad m => Text -> GGWidget master m ()
- addStylesheetRemoteAttrs :: Monad m => Text -> [(Text, Text)] -> GGWidget master m ()
- addStylesheetEither :: Monad m => Either (Route master) Text -> GGWidget master m ()
- addJulius :: Monad m => Julius (Route master) -> GGWidget master m ()
- addJuliusBody :: Monad m => Julius (Route master) -> GGWidget master m ()
- addCoffee :: MonadIO m => Coffee (Route master) -> GGWidget master (GGHandler sub master m) ()
- addCoffeeBody :: MonadIO m => Coffee (Route master) -> GGWidget master (GGHandler sub master m) ()
- addScript :: Monad m => Route master -> GGWidget master m ()
- addScriptAttrs :: Monad m => Route master -> [(Text, Text)] -> GGWidget master m ()
- addScriptRemote :: Monad m => Text -> GGWidget master m ()
- addScriptRemoteAttrs :: Monad m => Text -> [(Text, Text)] -> GGWidget master m ()
- addScriptEither :: Monad m => Either (Route master) Text -> GGWidget master m ()
- extractBody :: Monad mo => GGWidget m mo () -> GGWidget m mo (Hamlet (Route m))
Datatype
newtype GGWidget m monad a Source
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.
(a ~ (), Monad monad) => Monad (HamletMonad (GGWidget m monad a)) | |
MonadTrans (GGWidget m) | |
Monad monad => Monad (GGWidget m monad) | |
Functor monad => Functor (GGWidget m monad) | |
(Monad monad, Functor monad) => Applicative (GGWidget m monad) | |
MonadIO monad => MonadIO (GGWidget m monad) | |
MonadControlIO monad => MonadControlIO (GGWidget m monad) | |
(a ~ (), Monad monad) => Monoid (GGWidget master monad a) | |
(a ~ (), Monad monad) => HamletValue (GGWidget m monad a) |
data PageContent url Source
Content for a web page. By providing this datatype, we can easily create generic site templates, which would have the type signature:
PageContent url -> Hamlet url
Special Hamlet quasiquoter/TH for Widgets
whamletFile :: FilePath -> Q ExpSource
ihamletToRepHtml :: (Monad mo, RenderMessage master message) => IHamlet message (Route master) -> GGHandler sub master mo RepHtmlSource
Wraps the Content
generated by hamletToContent
in a RepHtml
.
Creating
Head of page
setTitle :: Monad m => Html -> GGWidget master m ()Source
Set the page title. Calling setTitle
multiple times overrides previously
set values.
setTitleI :: (RenderMessage master msg, Monad m) => msg -> GGWidget master (GGHandler sub master m) ()Source
Set the page title. Calling setTitle
multiple times overrides previously
set values.
addHamletHead :: Monad m => Hamlet (Route master) -> GGWidget master m ()Source
Add a Hamlet
to the head tag.
Body
addHamlet :: Monad m => Hamlet (Route master) -> GGWidget master m ()Source
Add a Hamlet
to the body tag.
addWidget :: Monad mo => GGWidget m mo () -> GGWidget m mo ()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 :: Monad m => Cassius (Route master) -> GGWidget master m ()Source
Add some raw CSS to the style tag. Applies to all media types.
addCassiusMedia :: Monad m => Text -> Cassius (Route master) -> GGWidget master m ()Source
Add some raw CSS to the style tag, for a specific media type.
addLuciusMedia :: Monad m => Text -> Lucius (Route master) -> GGWidget master m ()Source
Identical to addCassiusMedia
.
addStylesheet :: Monad m => Route master -> GGWidget master m ()Source
Link to the specified local stylesheet.
addStylesheetAttrs :: Monad m => Route master -> [(Text, Text)] -> GGWidget master m ()Source
Link to the specified local stylesheet.
addStylesheetRemote :: Monad m => Text -> GGWidget master m ()Source
Link to the specified remote stylesheet.
addStylesheetRemoteAttrs :: Monad m => Text -> [(Text, Text)] -> GGWidget master m ()Source
Link to the specified remote stylesheet.
Javascript
addJulius :: Monad m => Julius (Route master) -> GGWidget master m ()Source
Include raw Javascript in the page's script tag.
addJuliusBody :: Monad m => Julius (Route master) -> GGWidget master m ()Source
Add a new script tag to the body with the contents of this Julius
template.
addCoffee :: MonadIO m => Coffee (Route master) -> GGWidget master (GGHandler sub master m) ()Source
Add Coffesscript to the page's script tag. Requires the coffeescript executable to be present at runtime.
addCoffeeBody :: MonadIO m => Coffee (Route master) -> GGWidget master (GGHandler sub master m) ()Source
Add a new script tag to the body with the contents of this Coffesscript template. Requires the coffeescript executable to be present at runtime.
addScript :: Monad m => Route master -> GGWidget master m ()Source
Link to the specified local script.
addScriptAttrs :: Monad m => Route master -> [(Text, Text)] -> GGWidget master m ()Source
Link to the specified local script.
addScriptRemote :: Monad m => Text -> GGWidget master m ()Source
Link to the specified remote script.
addScriptRemoteAttrs :: Monad m => Text -> [(Text, Text)] -> GGWidget master m ()Source
Link to the specified remote script.