clckwrks 0.13.2 → 0.14.2
raw patch · 4 files changed
+19/−21 lines, 4 filesdep ~web-plugins
Dependency ranges changed: web-plugins
Files
- Clckwrks/Monad.hs +6/−6
- Clckwrks/Plugin.hs +2/−2
- Clckwrks/ProfileData/EditProfileData.hs +9/−11
- clckwrks.cabal +2/−2
Clckwrks/Monad.hs view
@@ -57,7 +57,7 @@ import Control.Concurrent.STM (TVar, readTVar, writeTVar, atomically) import Data.Acid (AcidState, EventState, EventResult, QueryEvent, UpdateEvent) import Data.Acid.Advanced (query', update')-import Data.Attoparsec.Text.Lazy (Parser, parseOnly, char, stringCI, try, takeWhile, takeWhile1)+import Data.Attoparsec.Text.Lazy (Parser, parseOnly, char, asciiCI, try, takeWhile, takeWhile1) import qualified Data.HashMap.Lazy as HashMap import qualified Data.List as List import qualified Data.Map as Map@@ -202,14 +202,14 @@ type ClckForm url = Form (ClckT url (ServerPartT IO)) [Input] ClckFormError [XMLGenT (ClckT url (ServerPartT IO)) XML] () -- | update the 'currentPage' field of 'ClckState'-setCurrentPage :: PageId -> Clck url ()+setCurrentPage :: (MonadIO m) => PageId -> ClckT url m () setCurrentPage pid = modify $ \s -> s { currentPage = pid } -- getPrefix :: Clck url Prefix -- getPrefix = componentPrefix <$> get -setUnique :: Integer -> Clck url ()+setUnique :: (Functor m, MonadIO m) => Integer -> ClckT url m () setUnique i = do u <- uniqueId <$> get liftIO $ atomically $ writeTVar u i@@ -217,7 +217,7 @@ -- | get a unique 'Integer'. -- -- Only unique for the current request-getUnique :: Clck url Integer+getUnique :: (Functor m, MonadIO m) => ClckT url m Integer getUnique = do u <- uniqueId <$> get liftIO $ atomically $ do i <- readTVar u@@ -243,7 +243,7 @@ type Clck url = ClckT url (ServerPartT IO) -instance IntegerSupply (Clck url) where+instance (Functor m, MonadIO m) => IntegerSupply (ClckT url m) where nextInteger = getUnique instance ToJExpr Text.Text where@@ -522,7 +522,7 @@ cmd :: T.Text -> Parser cmd -> Parser (Segment cmd) cmd n p = do char '{'- ((try $ do stringCI n+ ((try $ do asciiCI n char '|' r <- p char '}'
Clckwrks/Plugin.hs view
@@ -20,7 +20,8 @@ import Paths_clckwrks (getDataDir) themeTemplate :: ( EmbedAsChild (ClckT ClckURL (ServerPartT IO)) headers- , EmbedAsChild (ClckT ClckURL (ServerPartT IO)) body) =>+ , EmbedAsChild (ClckT ClckURL (ServerPartT IO)) body+ ) => ClckPlugins -> Text -> headers@@ -31,7 +32,6 @@ case mTheme of Nothing -> escape $ internalServerError $ toResponse $ ("No theme package is loaded." :: Text) (Just theme) -> fmap toResponse $ unXMLGenT $ (_themeTemplate theme ttl hdrs bdy)- clckHandler :: (ClckURL -> [(Text, Maybe Text)] -> Text) -> ClckPlugins
Clckwrks/ProfileData/EditProfileData.hs view
@@ -10,7 +10,7 @@ import qualified Data.Text as Text import Happstack.Auth (UserId) import Text.Reform ((++>), transformEitherM)-import Text.Reform.HSP.Text (form, inputText, inputSubmit, label, fieldset, ol, li)+import Text.Reform.HSP.Text (form, inputText, inputSubmit, label, fieldset, ol, li, errorList) import Text.Reform.Happstack (reform) -- FIXME: this currently uses the admin template. Which is sort of right, and sort of not.@@ -38,19 +38,17 @@ profileDataFormlet :: ProfileData -> ClckForm ProfileDataURL () profileDataFormlet pd@ProfileData{..} =- ((,) <$> (li $ label "username:" ) ++> (li $ inputText username)+ errorList ++> ((,) <$> (li $ label "username:" ) ++> (li $ inputText username) <*> (li $ label" email (optional):") ++> (li $ inputText (fromMaybe Text.empty email)) <* inputSubmit (pack "update")) `transformEitherM` updateProfileData where updateProfileData :: (Text, Text) -> Clck ProfileDataURL (Either ClckFormError ()) updateProfileData (usrnm, eml) =- if Text.null usrnm- then do return (Left EmptyUsername)- else do let newPd = pd { username = usrnm- , email = if Text.null eml then Nothing else (Just eml)- }- merr <- update (SetProfileData newPd)- case merr of- Nothing -> return $ Right ()- (Just err) -> return $ Left (PDE err)+ do let newPd = pd { username = usrnm+ , email = if Text.null eml then Nothing else (Just eml)+ }+ merr <- update (SetProfileData newPd)+ case merr of+ Nothing -> return $ Right ()+ (Just err) -> return $ Left (PDE err)
clckwrks.cabal view
@@ -1,5 +1,5 @@ Name: clckwrks-Version: 0.13.2+Version: 0.14.2 Synopsis: A secure, reliable content management system (CMS) and blogging platform Description: clckwrks (pronounced, clockworks) aims to compete directly with popular PHP-based blogging and CMS@@ -109,7 +109,7 @@ unordered-containers >= 0.1 && < 0.3, utf8-string == 0.3.*, vector >= 0.9,- web-plugins == 0.1.*,+ web-plugins >= 0.1 && < 0.3, web-routes, web-routes-happstack, web-routes-hsp,