diff --git a/yesod-examples/.gitignore b/yesod-examples/.gitignore deleted file mode 100644 index 1cd91990..00000000 --- a/yesod-examples/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -client_session_key.aes -dist -cabal-dev/ diff --git a/yesod-examples/LICENSE b/yesod-examples/LICENSE deleted file mode 100644 index d9f04179..00000000 --- a/yesod-examples/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2012 Michael Snoyman, http://www.yesodweb.com/ - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/yesod-examples/README b/yesod-examples/README deleted file mode 100644 index e69de29b..00000000 diff --git a/yesod-examples/Setup.hs b/yesod-examples/Setup.hs deleted file mode 100644 index cd7dc327..00000000 --- a/yesod-examples/Setup.hs +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env runhaskell -import Distribution.Simple -main = defaultMain diff --git a/yesod-examples/src/MkToForm2.hs b/yesod-examples/src/MkToForm2.hs deleted file mode 100644 index 1cedbeb5..00000000 --- a/yesod-examples/src/MkToForm2.hs +++ /dev/null @@ -1,15 +0,0 @@ -{-# LANGUAGE TypeFamilies, QuasiQuotes, GeneralizedNewtypeDeriving #-} -{-# LANGUAGE FlexibleInstances #-} -{-# LANGUAGE MultiParamTypeClasses #-} -module MkToForm2 where - -import Yesod -import Data.Time (Day) - -mkPersist [$persist| -Entry - title String - day Day Desc toFormField=YesodJquery.jqueryDayField' - content Html toFormField=YesodNic.nicHtmlField - deriving -|] diff --git a/yesod-examples/src/ajax.lhs b/yesod-examples/src/ajax.lhs deleted file mode 100644 index 9396aef1..00000000 --- a/yesod-examples/src/ajax.lhs +++ /dev/null @@ -1,116 +0,0 @@ -
We're going to write a very simple AJAX application. It will be a simple site with a few pages and a navbar; when you have Javascript, clicking on the links will load the pages via AJAX. Otherwise, it will use static HTML.
- -We're going to use jQuery for the Javascript, though anything would work just fine. Also, the AJAX responses will be served as JSON. Let's get started.
- -> {-# LANGUAGE TypeFamilies, QuasiQuotes, TemplateHaskell, MultiParamTypeClasses, OverloadedStrings #-} -> import Yesod -> import Yesod.Static -> import Data.Text (Text, unpack) - -Like the blog example, we'll define some data first. - -> data Page = Page -> { pageName :: Text -> , pageSlug :: Text -> , pageContent :: Text -> } - -> loadPages :: IO [Page] -> loadPages = return -> [ Page "Page 1" "page-1" "My first page" -> , Page "Page 2" "page-2" "My second page" -> , Page "Page 3" "page-3" "My third page" -> ] - -> data Ajax = Ajax -> { ajaxPages :: [Page] -> , ajaxStatic :: Static -> } - -Next we'll generate a function for each file in our static folder. This way, we get a compiler warning when trying to using a file which does not exist. - -> staticFiles "static/yesod/ajax" - -Now the routes; we'll have a homepage, a pattern for the pages, and use a static subsite for the Javascript and CSS files. - -> mkYesod "Ajax" [parseRoutes| -> / HomeR GET -> /page/#Text PageR GET -> /static StaticR Static ajaxStatic -> |] - -That third line there is the syntax for a subsite: Static is the datatype for the subsite argument; siteStatic returns the site itself (parse, render and dispatch functions); and ajaxStatic gets the subsite argument from the master argument.
- -Now, we'll define the Yesod instance. We'll still use a dummy approot value, but we're also going to define a default layout.
- -> instance Yesod Ajax where -> approot _ = "" -> defaultLayout widget = do -> Ajax pages _ <- getYesod -> content <- widgetToPageContent widget -> hamletToRepHtml [hamlet| -> \ -> -> -> ->