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