shakespeare-js 1.0.2 and 1.1
This commit is contained in:
parent
e483547080
commit
053210da6f
@ -67,6 +67,11 @@ import Data.String (IsString (fromString))
|
||||
import Network.Wai (FilePart)
|
||||
import Data.Conduit (Source, ResourceT, Flush)
|
||||
|
||||
import qualified Data.Aeson as J
|
||||
import Data.Aeson.Encode (fromValue)
|
||||
import qualified Blaze.ByteString.Builder.Char.Utf8 as Blaze
|
||||
import Data.Text.Lazy.Builder (toLazyText)
|
||||
|
||||
data Content = ContentBuilder !Builder !(Maybe Int) -- ^ The content and optional content length.
|
||||
| ContentSource !(Source (ResourceT IO) (Flush Builder))
|
||||
| ContentFile !FilePath !(Maybe FilePart)
|
||||
@ -250,3 +255,9 @@ instance HasReps a => HasReps (DontFullyEvaluate a) where
|
||||
|
||||
instance ToContent a => ToContent (DontFullyEvaluate a) where
|
||||
toContent (DontFullyEvaluate a) = ContentDontEvaluate $ toContent a
|
||||
|
||||
instance ToContent J.Value where
|
||||
toContent = flip ContentBuilder Nothing
|
||||
. Blaze.fromLazyText
|
||||
. toLazyText
|
||||
. fromValue
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
name: yesod-core
|
||||
version: 1.1.4.2
|
||||
version: 1.1.5
|
||||
license: MIT
|
||||
license-file: LICENSE
|
||||
author: Michael Snoyman <michael@snoyman.com>
|
||||
@ -57,7 +57,7 @@ library
|
||||
, path-pieces >= 0.1.2 && < 0.2
|
||||
, hamlet >= 1.1 && < 1.2
|
||||
, shakespeare >= 1.0 && < 1.1
|
||||
, shakespeare-js >= 1.0 && < 1.1
|
||||
, shakespeare-js >= 1.0.2 && < 1.2
|
||||
, shakespeare-css >= 1.0 && < 1.1
|
||||
, shakespeare-i18n >= 1.0 && < 1.1
|
||||
, blaze-builder >= 0.2.1.4 && < 0.4
|
||||
|
||||
@ -20,10 +20,11 @@ import Yesod.Widget
|
||||
import Data.Time (Day)
|
||||
import Data.Default
|
||||
import Text.Hamlet (shamlet)
|
||||
import Text.Julius (julius)
|
||||
import Text.Julius (julius, rawJS)
|
||||
import Data.Text (Text, pack, unpack)
|
||||
import Data.Monoid (mconcat)
|
||||
import Yesod.Core (RenderMessage)
|
||||
import Data.Aeson (toJSON)
|
||||
|
||||
-- | Gets the Google hosted jQuery UI 1.8 CSS file with the given theme.
|
||||
googleHostedJqueryUiCss :: Text -> Text
|
||||
@ -73,14 +74,14 @@ $newline never
|
||||
addStylesheet' urlJqueryUiCss
|
||||
toWidget [julius|
|
||||
$(function(){
|
||||
var i = document.getElementById("#{theId}");
|
||||
var i = document.getElementById("#{rawJS theId}");
|
||||
if (i.type != "date") {
|
||||
$(i).datepicker({
|
||||
dateFormat:'yy-mm-dd',
|
||||
changeMonth:#{jsBool $ jdsChangeMonth jds},
|
||||
changeYear:#{jsBool $ jdsChangeYear jds},
|
||||
numberOfMonths:#{mos $ jdsNumberOfMonths jds},
|
||||
yearRange:"#{jdsYearRange jds}"
|
||||
numberOfMonths:#{rawJS $ mos $ jdsNumberOfMonths jds},
|
||||
yearRange:#{toJSON $ jdsYearRange jds}
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -89,8 +90,8 @@ $(function(){
|
||||
}
|
||||
where
|
||||
showVal = either id (pack . show)
|
||||
jsBool True = "true" :: Text
|
||||
jsBool False = "false" :: Text
|
||||
jsBool True = toJSON True
|
||||
jsBool False = toJSON False
|
||||
mos (Left i) = show i
|
||||
mos (Right (x, y)) = concat
|
||||
[ "["
|
||||
@ -113,7 +114,7 @@ $newline never
|
||||
addScript' urlJqueryUiJs
|
||||
addStylesheet' urlJqueryUiCss
|
||||
toWidget [julius|
|
||||
$(function(){$("##{theId}").autocomplete({source:"@{src}",minLength:2})});
|
||||
$(function(){$("##{rawJS theId}").autocomplete({source:"@{src}",minLength:2})});
|
||||
|]
|
||||
, fieldEnctype = UrlEncoded
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ import Yesod.Form
|
||||
import Yesod.Widget
|
||||
import Text.HTML.SanitizeXSS (sanitizeBalance)
|
||||
import Text.Hamlet (Html, shamlet)
|
||||
import Text.Julius (julius)
|
||||
import Text.Julius (julius, rawJS)
|
||||
#if MIN_VERSION_blaze_html(0, 5, 0)
|
||||
import Text.Blaze (preEscapedToMarkup)
|
||||
import Text.Blaze.Html.Renderer.String (renderHtml)
|
||||
@ -46,10 +46,10 @@ $newline never
|
||||
toWidget $
|
||||
case jsLoader master of
|
||||
BottomOfHeadBlocking -> [julius|
|
||||
bkLib.onDomLoaded(function(){new nicEditor({fullPanel:true}).panelInstance("#{theId}")});
|
||||
bkLib.onDomLoaded(function(){new nicEditor({fullPanel:true}).panelInstance("#{rawJS theId}")});
|
||||
|]
|
||||
_ -> [julius|
|
||||
(function(){new nicEditor({fullPanel:true}).panelInstance("#{theId}")})();
|
||||
(function(){new nicEditor({fullPanel:true}).panelInstance("#{rawJS theId}")})();
|
||||
|]
|
||||
, fieldEnctype = UrlEncoded
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ library
|
||||
, time >= 1.1.4
|
||||
, hamlet >= 1.1 && < 1.2
|
||||
, shakespeare-css >= 1.0 && < 1.1
|
||||
, shakespeare-js >= 1.0 && < 1.1
|
||||
, shakespeare-js >= 1.0.2 && < 1.2
|
||||
, persistent >= 1.0 && < 1.1
|
||||
, template-haskell
|
||||
, transformers >= 0.2.2 && < 0.4
|
||||
@ -36,6 +36,7 @@ library
|
||||
, blaze-markup >= 0.5.1 && < 0.6
|
||||
, attoparsec >= 0.10 && < 0.11
|
||||
, crypto-api >= 0.8 && < 0.11
|
||||
, aeson
|
||||
|
||||
exposed-modules: Yesod.Form
|
||||
Yesod.Form.Class
|
||||
|
||||
@ -51,11 +51,13 @@ import Network.Wai.Parse (parseHttpAccept)
|
||||
import qualified Data.ByteString.Char8 as B8
|
||||
import Safe (headMay)
|
||||
|
||||
#if !MIN_VERSION_yesod_core(1, 1, 5)
|
||||
instance ToContent J.Value where
|
||||
toContent = flip ContentBuilder Nothing
|
||||
. Blaze.fromLazyText
|
||||
. toLazyText
|
||||
. fromValue
|
||||
#endif
|
||||
|
||||
-- | Provide both an HTML and JSON representation for a piece of
|
||||
-- data, using the default layout for the HTML output
|
||||
@ -97,8 +99,10 @@ parseJsonBody_ = do
|
||||
J.Error s -> invalidArgs [pack s]
|
||||
J.Success a -> return a
|
||||
|
||||
#if !MIN_VERSION_shakespeare_js(1, 0, 2)
|
||||
instance ToJavascript J.Value where
|
||||
toJavascript = fromLazyText . decodeUtf8 . JE.encode
|
||||
#endif
|
||||
|
||||
-- | Convert a list of pairs to an 'J.Object'.
|
||||
object :: J.ToJSON a => [(Text, a)] -> J.Value
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
name: yesod-json
|
||||
version: 1.1.1
|
||||
version: 1.1.2
|
||||
license: MIT
|
||||
license-file: LICENSE
|
||||
author: Michael Snoyman <michael@snoyman.com>
|
||||
@ -18,7 +18,7 @@ library
|
||||
, yesod-routes >= 1.1 && < 1.2
|
||||
, aeson >= 0.5
|
||||
, text >= 0.8 && < 1.0
|
||||
, shakespeare-js >= 1.0 && < 1.1
|
||||
, shakespeare-js >= 1.0 && < 1.2
|
||||
, vector >= 0.9
|
||||
, containers >= 0.2
|
||||
, blaze-builder
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
name: yesod
|
||||
version: 1.1.3.2
|
||||
version: 1.1.4
|
||||
license: MIT
|
||||
license-file: LICENSE
|
||||
author: Michael Snoyman <michael@snoyman.com>
|
||||
@ -27,7 +27,7 @@ extra-source-files:
|
||||
|
||||
library
|
||||
build-depends: base >= 4.3 && < 5
|
||||
, yesod-core >= 1.1 && < 1.2
|
||||
, yesod-core >= 1.1.5 && < 1.2
|
||||
, yesod-auth >= 1.1 && < 1.2
|
||||
, yesod-json >= 1.1 && < 1.2
|
||||
, yesod-persistent >= 1.1 && < 1.2
|
||||
@ -38,7 +38,7 @@ library
|
||||
, wai >= 1.3 && < 1.4
|
||||
, wai-extra >= 1.3 && < 1.4
|
||||
, hamlet >= 1.1 && < 1.2
|
||||
, shakespeare-js >= 1.0 && < 1.1
|
||||
, shakespeare-js >= 1.0.2 && < 1.2
|
||||
, shakespeare-css >= 1.0 && < 1.1
|
||||
, warp >= 1.3 && < 1.4
|
||||
, blaze-html >= 0.5 && < 0.6
|
||||
@ -76,7 +76,7 @@ executable yesod
|
||||
, text >= 0.11
|
||||
, shakespeare-text >= 1.0 && < 1.1
|
||||
, shakespeare >= 1.0.2 && < 1.1
|
||||
, shakespeare-js >= 1.0.1 && < 1.1
|
||||
, shakespeare-js >= 1.0.2 && < 1.2
|
||||
, shakespeare-css >= 1.0.2 && < 1.1
|
||||
, bytestring >= 0.9.1.4
|
||||
, time >= 1.1.4
|
||||
|
||||
Loading…
Reference in New Issue
Block a user