packages feed

yesod-colonnade 1.1.0 → 1.2.0

raw patch · 2 files changed

+33/−39 lines, 2 filesdep ~colonnadePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: colonnade

API changes (from Hackage documentation)

- Yesod.Colonnade: encodeHeadedCellTable :: Foldable f => Attribute -> Colonnade Headed a (Cell site) -> f a -> WidgetT site IO ()
- Yesod.Colonnade: encodeHeadedWidgetTable :: Foldable f => Attribute -> Colonnade Headed a (WidgetT site IO ()) -> f a -> WidgetT site IO ()
- Yesod.Colonnade: encodeHeadlessCellTable :: Foldable f => Attribute -> Colonnade Headless a (Cell site) -> f a -> WidgetT site IO ()
- Yesod.Colonnade: encodeHeadlessWidgetTable :: Foldable f => Attribute -> Colonnade Headless a (WidgetT site IO ()) -> f a -> WidgetT site IO ()
+ Yesod.Colonnade: anchorWidget :: (a -> Route site) -> (a -> WidgetT site IO ()) -> a -> WidgetT site IO ()
+ Yesod.Colonnade: encodeCellTable :: (Foldable f, Headedness h) => Attribute -> Colonnade h a (Cell site) -> f a -> WidgetT site IO ()
+ Yesod.Colonnade: encodeWidgetTable :: (Foldable f, Headedness h) => Attribute -> Colonnade h a (WidgetT site IO ()) -> f a -> WidgetT site IO ()

Files

src/Yesod/Colonnade.hs view
@@ -13,11 +13,10 @@   , textCell   , builderCell   , anchorCell+  , anchorWidget     -- * Apply-  , encodeHeadedWidgetTable-  , encodeHeadlessWidgetTable-  , encodeHeadedCellTable-  , encodeHeadlessCellTable+  , encodeWidgetTable+  , encodeCellTable   , encodeDefinitionTable   , encodeListItems   ) where@@ -68,14 +67,23 @@ builderCell :: TBuilder.Builder -> Cell site builderCell = cell . toWidget . toHtml . LText.toStrict . TBuilder.toLazyText --- | Creata a 'Cell' whose content is hyperlinked by wrapping+-- | Create a 'Cell' whose content is hyperlinked by wrapping --   it in an @\<a\>@. anchorCell ::       (a -> Route site) -- ^ Route that will go in @href@ attribute   -> (a -> WidgetT site IO ()) -- ^ Content wrapped by @<a>@ tag   -> a -- ^ Value   -> Cell site-anchorCell getRoute getContent a = cell $ do+anchorCell getRoute getContent = cell . anchorWidget getRoute getContent++-- | Create a widget whose content is hyperlinked by wrapping+--   it in an @\<a\>@.+anchorWidget :: +     (a -> Route site) -- ^ Route that will go in @href@ attribute+  -> (a -> WidgetT site IO ()) -- ^ Content wrapped by @<a>@ tag+  -> a -- ^ Value+  -> WidgetT site IO ()+anchorWidget getRoute getContent a = do   urlRender <- getUrlRender   a_ (HA.href (toValue (urlRender (getRoute a)))) (getContent a) @@ -116,48 +124,34 @@       widgetFromCell td_ theValue     ) a --- | If you are using the bootstrap css framework, then you may want+-- | Encode an html table with attributes on the table cells.+--   If you are using the bootstrap css framework, then you may want --   to call this with the first argument as: -----   > encodeHeadedCellTable (HA.class_ "table table-striped") ...-encodeHeadedCellTable :: Foldable f-  => Attribute -- ^ Attributes of @table@ element-  -> Colonnade Headed a (Cell site) -- ^ How to encode data as a row-  -> f a -- ^ Rows of data-  -> WidgetT site IO ()-encodeHeadedCellTable = encodeTable-  (Just mempty) mempty (const mempty) widgetFromCell --encodeHeadlessCellTable :: Foldable f-  => Attribute -- ^ Attributes of @table@ element-  -> Colonnade Headless a (Cell site) -- ^ How to encode data as columns-  -> f a -- ^ Rows of data-  -> WidgetT site IO ()-encodeHeadlessCellTable = encodeTable-  Nothing mempty (const mempty) widgetFromCell --encodeHeadedWidgetTable :: Foldable f+--   > encodeCellTable (HA.class_ "table table-striped") ...+encodeCellTable :: (Foldable f, E.Headedness h)   => Attribute -- ^ Attributes of @table@ element-  -> Colonnade Headed a (WidgetT site IO ()) -- ^ How to encode data as columns+  -> Colonnade h a (Cell site) -- ^ How to encode data as a row   -> f a -- ^ Rows of data   -> WidgetT site IO ()-encodeHeadedWidgetTable = encodeTable-  (Just mempty) mempty (const mempty) ($ mempty)+encodeCellTable = encodeTable+  (E.headednessPure mempty) mempty (const mempty) widgetFromCell  -encodeHeadlessWidgetTable :: Foldable f+-- | Encode an html table.+encodeWidgetTable :: (Foldable f, E.Headedness h)   => Attribute -- ^ Attributes of @\<table\>@ element-  -> Colonnade Headless a (WidgetT site IO ()) -- ^ How to encode data as columns+  -> Colonnade h a (WidgetT site IO ()) -- ^ How to encode data as columns   -> f a -- ^ Rows of data   -> WidgetT site IO ()-encodeHeadlessWidgetTable = encodeTable-  Nothing mempty (const mempty) ($ mempty) +encodeWidgetTable = encodeTable+  (E.headednessPure mempty) mempty (const mempty) ($ mempty)   -- | Encode a table. This handles a very general case and --   is seldom needed by users. One of the arguments provided is --   used to add attributes to the generated @\<tr\>@ elements. encodeTable ::-     (Foldable f, Foldable h)-  => Maybe Attribute -- ^ Attributes of @\<thead\>@, pass 'Nothing' to omit @\<thead\>@+     (Foldable f, E.Headedness h)+  => h Attribute -- ^ Attributes of @\<thead\>@, pass 'Nothing' to omit @\<thead\>@   -> Attribute -- ^ Attributes of @\<tbody\>@ element   -> (a -> Attribute) -- ^ Attributes of each @\<tr\>@ element   -> ((Attribute -> WidgetT site IO () -> WidgetT site IO ()) -> c -> WidgetT site IO ()) -- ^ Wrap content and convert to 'Html'@@ -165,10 +159,10 @@   -> Colonnade h a c -- ^ How to encode data as a row   -> f a -- ^ Collection of data   -> WidgetT site IO ()-encodeTable mtheadAttrs tbodyAttrs trAttrs wrapContent tableAttrs colonnade xs =+encodeTable theadAttrs tbodyAttrs trAttrs wrapContent tableAttrs colonnade xs =   table_ tableAttrs $ do-    for_ mtheadAttrs $ \theadAttrs -> do-      thead_ theadAttrs $ do+    for_ E.headednessExtract $ \unhead ->+      thead_ (unhead theadAttrs) $ do         E.headerMonadicGeneral_ colonnade (wrapContent th_)     tbody_ tbodyAttrs $ do       forM_ xs $ \x -> do
yesod-colonnade.cabal view
@@ -1,5 +1,5 @@ name:                yesod-colonnade-version:             1.1.0+version:             1.2.0 synopsis:            Helper functions for using yesod with colonnade description:         Yesod and colonnade homepage:            https://github.com/andrewthad/colonnade#readme@@ -18,7 +18,7 @@     Yesod.Colonnade   build-depends:       base >= 4.7 && < 5-    , colonnade >= 1.1 && < 1.2+    , colonnade >= 1.2 && < 1.3     , yesod-core >= 1.4 && < 1.5     , text >= 1.0 && < 1.3     , blaze-markup >= 0.7 && < 0.9