Removed yepnope

This commit is contained in:
Michael Snoyman 2013-03-10 14:20:39 +02:00
parent 0e2fee8da3
commit 5b5203a275
5 changed files with 0 additions and 47 deletions

View File

@ -39,7 +39,6 @@ module Yesod.Core
, loadClientSession
, Header(..)
-- * JS loaders
, loadJsYepnope
, ScriptLoadPosition (..)
, BottomOfHeadAsync
-- * Misc

View File

@ -31,7 +31,6 @@ module Yesod.Internal.Core
-- * jsLoader
, ScriptLoadPosition (..)
, BottomOfHeadAsync
, loadJsYepnope
-- * Misc
, yesodVersion
, yesodRender
@ -49,12 +48,7 @@ import Yesod.Routes.Class
import qualified Network.Wai as W
import Yesod.Internal.Session
import Yesod.Internal.Request
import Text.Hamlet
import Text.Blaze (unsafeLazyByteString)
import Data.Text (Text)
import Data.Aeson (Value (Array, String))
import Data.Aeson.Encode (encode)
import qualified Data.Vector as Vector
import qualified Paths_yesod_core
import Data.Version (showVersion)
import System.Log.FastLogger (Logger)
@ -104,24 +98,6 @@ maybeAuthorized r isWrite = do
x <- isAuthorized r isWrite
return $ if x == Authorized then Just r else Nothing
jsonArray :: [Text] -> Html
jsonArray = unsafeLazyByteString . encode . Array . Vector.fromList . map String
-- | For use with setting 'jsLoader' to 'BottomOfHeadAsync'
loadJsYepnope :: Yesod master => Either Text (Route master) -> [Text] -> Maybe (HtmlUrl (Route master)) -> (HtmlUrl (Route master))
loadJsYepnope eyn scripts mcomplete =
[hamlet|
$newline never
$maybe yn <- left eyn
<script src=#{yn}>
$maybe yn <- right eyn
<script src=@{yn}>
$maybe complete <- mcomplete
<script>yepnope({load:#{jsonArray scripts},complete:function(){^{complete}}});
$nothing
<script>yepnope({load:#{jsonArray scripts}});
|]
-- | This class is automatically instantiated when you use the template haskell
-- mkYesod function. You should never need to deal with it directly.
class YesodDispatch sub master where

View File

@ -3,7 +3,6 @@
{-# LANGUAGE FlexibleInstances #-}
module YesodCoreTest.JsLoader (specs, Widget) where
import YesodCoreTest.JsLoaderSites.HeadAsync (HA(..))
import YesodCoreTest.JsLoaderSites.Bottom (B(..))
import Test.Hspec
@ -27,10 +26,6 @@ specs = describe "Test.JsLoader" $ do
res <- request defaultRequest
assertBody "<!DOCTYPE html>\n<html><head><title></title><script src=\"load.js\"></script></head><body></body></html>" res
it "link from head async" $ runner HA $ do
res <- request defaultRequest
assertBody "<!DOCTYPE html>\n<html><head><title></title><script src=\"yepnope.js\"></script><script>yepnope({load:[\"load.js\"]});</script></head><body></body></html>" res
it "link from bottom" $ runner B $ do
res <- request defaultRequest
assertBody "<!DOCTYPE html>\n<html><head><title></title></head><body><script src=\"load.js\"></script></body></html>" res

View File

@ -1,16 +0,0 @@
{-# LANGUAGE QuasiQuotes, TypeFamilies, TemplateHaskell, MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE FlexibleInstances #-}
module YesodCoreTest.JsLoaderSites.HeadAsync (HA(..), Widget) where
import Yesod.Core
data HA = HA
mkYesod "HA" [parseRoutes|
/ HeadAsyncR GET
|]
instance Yesod HA where
jsLoader _ = BottomOfHeadAsync $ loadJsYepnope $ Left "yepnope.js"
getHeadAsyncR :: Handler RepHtml
getHeadAsyncR = defaultLayout $ addScriptRemote "load.js"

View File

@ -25,7 +25,6 @@ extra-source-files:
test/YesodCoreTest/Json.hs
test/YesodCoreTest/JsLoader.hs
test/YesodCoreTest/JsLoaderSites/Bottom.hs
test/YesodCoreTest/JsLoaderSites/HeadAsync.hs
test/YesodCoreTest/Links.hs
test/YesodCoreTest/Media.hs
test/YesodCoreTest/MediaData.hs