packages feed

yesod-goodies 0.0.4.1 → 0.0.4.1.1

raw patch · 2 files changed

+23/−3 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

Yesod/Goodies/Paginate.hs view
@@ -83,6 +83,9 @@     let prev' = if length prev > 10 then drop (length prev - 10) prev else prev     let next' = if length next > 10 then take 10 next else next +    -- current GET params+    rgps <- lift $ return . reqGetParams =<< getRequest+     [hamlet|         ^{doShow items} @@ -92,15 +95,32 @@              $forall p <- prev'                 <li .previous_pages>-                    <a href="?p=#{show p}">#{show p}+                    <a href="#{updateGetParam rgps $ mkParam p}">#{show p}              <li .this_page>#{show this}              $forall n <- next'                 <li .next_pages>-                    <a href="?p=#{show n}">#{show n}+                    <a href="#{updateGetParam rgps $ mkParam n}">#{show n}              $if (/=) next next'                 <li .next_pages_more>...          |]++    where +        mkParam :: Int -> (T.Text, T.Text)+        mkParam = (,) "p" . T.pack . show++        -- preserves existing get params, updates the passed key/value +        -- or adds it if it's not there+        updateGetParam :: [(T.Text,T.Text)] -> (T.Text,T.Text) -> T.Text+        updateGetParam getParams (p, n) =+            -- prefix with ? and splice in &+            (T.cons '?') . T.intercalate "&"++            -- join the key, value pairs+            . map (\(k,v) -> k `T.append` "=" `T.append` v)++            -- add/update our key+            . (++ [(p, n)]) . filter ((/= p) . fst) $ getParams
yesod-goodies.cabal view
@@ -1,5 +1,5 @@ name:                yesod-goodies-version:             0.0.4.1+version:             0.0.4.1.1 description:         A collection of various small helpers useful in any yesod application. synopsis:            A collection of various small helpers useful in any yesod application. homepage:            http://github.com/pbrisbin/yesod-goodies