clckwrks-plugin-page 0.3.6 → 0.3.10
raw patch · 6 files changed
+57/−46 lines, 6 filesdep +hsx2hsdep +time-locale-compatdep −utf8-stringdep ~attoparsecdep ~basedep ~clckwrks
Dependencies added: hsx2hs, time-locale-compat
Dependencies removed: utf8-string
Dependency ranges changed: attoparsec, base, clckwrks, filepath, happstack-server, random, template-haskell, text, time
Files
- Clckwrks/Page/Acid.hs +1/−1
- Clckwrks/Page/Admin/EditFeedConfig.hs +1/−0
- Clckwrks/Page/Admin/EditPage.hs +4/−0
- Clckwrks/Page/Atom.hs +28/−28
- Clckwrks/Page/PreProcess.hs +5/−0
- clckwrks-plugin-page.cabal +18/−17
Clckwrks/Page/Acid.hs view
@@ -87,7 +87,7 @@ Create an Account ----------------- -Go [here](/clck/auth/auth/create) and create an account for yourself.+Go [here](/authenticate/login) and create an account for yourself. Give yourself Administrator permissions -------------------------------
Clckwrks/Page/Admin/EditFeedConfig.hs view
@@ -45,6 +45,7 @@ ) `transformEither` toFeedConfig where+ label' :: Text -> PageForm () label' str = (labelText str `setAttrs` [("class":="control-label") :: Attr Text Text]) divHorizontal = mapView (\xml -> [<div class="form-horizontal"><% xml %></div>]) divControlGroup = mapView (\xml -> [<div class="control-group"><% xml %></div>])
Clckwrks/Page/Admin/EditPage.hs view
@@ -69,13 +69,17 @@ ) `transformEitherM` toPage where+ inputSubmit' :: Text.Text -> PageForm (Maybe Text.Text) inputSubmit' str = inputSubmit str `setAttrs` [("class":="btn") :: Attr Text Text]+ inputCheckboxLabel :: Text -> Bool -> PageForm Bool inputCheckboxLabel lbl b = mapView (\xml -> [<label class="checkbox"><% xml %><% lbl %></label>]) (inputCheckbox b) + label' :: Text -> PageForm () label' str = (labelText str `setAttrs` [("class":="control-label") :: Attr Text Text]) + labelCB :: Text -> PageForm () labelCB str = labelText str `setAttrs` [("class":="checkbox") :: Attr Text Text] -- divInline = mapView (\xml -> [<div class="checkbox inline"><% xml %></div>]) divFormActions = mapView (\xml -> [<div class="form-actions"><% xml %></div>])
Clckwrks/Page/Atom.hs view
@@ -1,30 +1,29 @@-{-# LANGUAGE RecordWildCards, OverloadedStrings #-}-{-# OPTIONS_GHC -F -pgmFhsx2hs #-}+{-# LANGUAGE RecordWildCards, OverloadedStrings, QuasiQuotes #-} module Clckwrks.Page.Atom where -import Control.Monad.Trans (liftIO)-import Clckwrks.Monad (Clck, Content(..), query, withAbs)+import Control.Monad.Trans (liftIO)+import Clckwrks.Monad (Clck, Content(..), query, withAbs) import Clckwrks.Page.Acid-import Clckwrks.Page.Monad (PageM, markupToContent)+import Clckwrks.Page.Monad (PageM, markupToContent) import Clckwrks.Page.Types import Clckwrks.ProfileData.Acid import Clckwrks.Page.URL-import qualified Data.ByteString.Lazy.UTF8 as UTF8-import Data.Maybe (fromMaybe)-import Data.Monoid ((<>))-import Data.String (fromString)-import qualified Data.Text as Text-import Data.Text.Lazy (Text)+import Data.Maybe (fromMaybe)+import Data.Monoid ((<>))+import Data.String (fromString)+import qualified Data.Text as Text+import Data.Text.Lazy (Text) import qualified Data.Text.Lazy.Encoding as TL-import Data.Time-import Data.Time.Clock.POSIX (posixSecondsToUTCTime)-import Data.Time.Format (formatTime)-import Data.UUID (toString)-import Happstack.Server (Happstack, Response, ok, toResponseBS)+import Data.Time (UTCTime)+import Data.Time.Clock.POSIX (posixSecondsToUTCTime)+import Data.Time.Format (formatTime)+import Data.UUID (toString)+import Happstack.Server (Happstack, Response, ok, toResponseBS) import HSP.XMLGenerator-import HSP.XML (XML, cdata, renderXML, fromStringLit)-import System.Locale (defaultTimeLocale)-import Web.Routes (showURL)+import HSP.XML (XML, cdata, renderXML, fromStringLit)+import Language.Haskell.HSX.QQ (hsx)+import Data.Time.Locale.Compat (defaultTimeLocale)+import Web.Routes (showURL) atom :: FeedConfig -- ^ feed configuration -> [Page] -- ^ pages to publish in feed@@ -32,7 +31,8 @@ atom FeedConfig{..} pages = do blogURL <- withAbs $ showURL Blog atomURL <- withAbs $ showURL AtomFeed- unXMLGenT $ <feed xmlns="http://www.w3.org/2005/Atom">+ unXMLGenT $ [hsx|+ <feed xmlns="http://www.w3.org/2005/Atom"> <title><% feedTitle %></title> <link type="text/html" href=blogURL /> <link rel="self" type="application/atom+xml" href=atomURL />@@ -42,7 +42,7 @@ <updated><% atomDate $ mostRecentUpdate pages %></updated> <id><% "urn:uuid:" ++ toString feedUUID %></id> <% mapM entry pages %>- </feed>+ </feed> |] mostRecentUpdate :: [Page] -- ^ pages to consider -> UTCTime -- ^ most recent updated time@@ -54,14 +54,14 @@ -> PageM XML entry Page{..} = do viewPageSlug <- withAbs $ showURL (ViewPageSlug pageId (toSlug pageTitle pageSlug))- unXMLGenT $ <entry>+ unXMLGenT $ [hsx| <entry> <title><% pageTitle %></title> <link href=viewPageSlug /> <id><% "urn:uuid:" ++ toString pageUUID %></id> <% author %> <updated><% atomDate pageUpdated %></updated> <% atomContent pageSrc %>- </entry>+ </entry> |] where author :: XMLGenT PageM XML author =@@ -71,10 +71,10 @@ (Just n) | Text.null n -> return $ cdata ""- | otherwise ->+ | otherwise -> [hsx| <author> <name><% n %></name>- </author>+ </author> |] atomDate :: UTCTime -> String atomDate time =@@ -85,13 +85,13 @@ do c <- markupToContent markup case c of (PlainText txt) ->- unXMLGenT $ <content type="text"><% txt %></content>+ unXMLGenT $ [hsx| <content type="text"><% txt %></content> |] (TrustedHtml html) ->- unXMLGenT $ <content type="html"><% html %></content>+ unXMLGenT $ [hsx| <content type="html"><% html %></content> |] handleAtomFeed :: PageM Response handleAtomFeed = do ps <- query AllPosts feedConfig <- query GetFeedConfig xml <- atom feedConfig ps- ok $ toResponseBS (fromString "application/atom+xml;charset=utf-8") ((UTF8.fromString $ "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n") <> (TL.encodeUtf8 $ renderXML xml))+ ok $ toResponseBS "application/atom+xml;charset=utf-8" ((TL.encodeUtf8 $ "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n") <> (TL.encodeUtf8 $ renderXML xml))
Clckwrks/Page/PreProcess.hs view
@@ -67,6 +67,11 @@ do b <- transform (applyCmd pageAcid clckShowURL) segments return $ B.toLazyText b +applyCmd :: (Functor m, MonadIO m) =>+ AcidState PageState+ -> (PageURL -> [(Text, Maybe Text)] -> Text)+ -> PageCmd+ -> ClckT url m Builder applyCmd pageAcid clckShowURL l@(PageTitle pid) = do mttl <- query' pageAcid (GetPageTitle pid) case mttl of
clckwrks-plugin-page.cabal view
@@ -1,5 +1,5 @@ name: clckwrks-plugin-page-version: 0.3.6+version: 0.3.10 synopsis: support for CMS/Blogging in clckwrks homepage: http://www.clckwrks.com/ license: BSD3@@ -37,31 +37,32 @@ Clckwrks.Page.Atom other-modules: Clckwrks.Page.Verbatim- build-depends: base >= 4.3 && < 4.8,+ build-depends: base >= 4.3 && < 4.9, aeson >= 0.6 && < 0.9, acid-state == 0.12.*,- attoparsec >= 0.10 && < 0.13,- clckwrks >= 0.21 && < 0.23,- containers >= 0.4 && < 0.6,- directory >= 1.1 && < 1.3,- filepath >= 1.2 && < 1.4,- happstack-hsp >= 7.2 && < 7.4,- happstack-server >= 7.0 && < 7.4,- hsp >= 0.9 && < 0.11,+ attoparsec >= 0.10 && < 0.14,+ clckwrks >= 0.21 && < 0.24,+ containers >= 0.4 && < 0.6,+ directory >= 1.1 && < 1.3,+ filepath >= 1.2 && < 1.5,+ happstack-hsp >= 7.2 && < 7.4,+ happstack-server >= 7.0 && < 7.5,+ hsp >= 0.9 && < 0.11,+ hsx2hs >= 0.13 && < 0.14, ixset == 1.0.*,- mtl >= 2.0 && < 2.3,+ mtl >= 2.0 && < 2.3, old-locale == 1.0.*,- random == 1.0.*,+ random >= 1.0 && < 1.2, reform == 0.2.*, reform-happstack == 0.2.*, reform-hsp == 0.2.*, safecopy == 0.8.*, tagsoup == 0.13.*,- text >= 0.11 && < 1.2,- time == 1.4.*,- template-haskell >= 2.7 && <= 2.10,- uuid >= 1.2 && <= 1.4,- utf8-string == 0.3.*,+ text >= 0.11 && < 1.3,+ time >= 1.4 && < 1.6,+ time-locale-compat >= 0.1 && < 0.2,+ template-haskell >= 2.7 && <= 2.11,+ uuid >= 1.2 && <= 1.4, web-plugins == 0.2.*, web-routes == 0.27.*, web-routes-happstack == 0.23.*,