packages feed

yesod-examples 0.5.1 → 0.6.0

raw patch · 9 files changed

+32/−32 lines, 9 filesdep ~persistentdep ~yesod

Dependency ranges changed: persistent, yesod

Files

yesod-examples.cabal view
@@ -1,5 +1,5 @@ Name:                yesod-examples-Version:             0.5.1+Version:             0.6.0 Synopsis:            Example programs using the Yesod Web Framework. Description:         These are the same examples and tutorials found on the documentation site. Homepage:            http://docs.yesodweb.com/@@ -17,7 +17,7 @@ Executable blog   Main-is:             yesod/tutorial/blog.lhs   Build-depends:       base >= 4 && < 5,-                       yesod >= 0.5.0.1 && < 0.6+                       yesod >= 0.6 && < 0.7  Executable ajax   Main-is:             yesod/tutorial/ajax.lhs@@ -47,9 +47,10 @@   Main-is:             yesod/tutorial/form.lhs  Executable mkToForm-  Main-is:             yesod/tutorial/mkToForm.hs+  Main-is:             mkToForm.hs   Build-depends:       time,-                       persistent >= 0.2.0.1 && < 0.3+                       persistent >= 0.3 && < 0.4+  hs-source-dirs:      yesod/tutorial  Executable persistent-synopsis   Main-is:             synopsis/persistent.lhs
yesod/tutorial/ajax.lhs view
@@ -86,7 +86,7 @@ >       [] -> notFound >       page:_ -> defaultLayoutJson (do >           setTitle $ string $ pageName page->           addBody $ html page+>           addHamlet $ html page >           ) (json page) >  where >   html page = [$hamlet|
yesod/tutorial/file-echo.lhs view
@@ -13,7 +13,7 @@  > getHomepage = defaultLayout $ do >   setTitle $ string "Upload a file"->   addBody [$hamlet|+>   addHamlet [$hamlet| > %form!method=post!action=.!enctype=multipart/form-data >   File name: >   %input!type=file!name=file
yesod/tutorial/form.lhs view
@@ -35,7 +35,7 @@  <p>extractBody returns the HTML of a widget and "passes" all of the other declarations (the CSS, Javascript, etc) up to the parent widget. The rest of this is just standard Hamlet code and our main function.</p> ->         addBody [$hamlet|+>         addHamlet [$hamlet| > %p Last result: $show.res$ > %form!enctype=$enctype$ >     %table
yesod/tutorial/generalized-hamlet.lhs view
@@ -16,17 +16,18 @@ > data NewHamlet = NewHamlet > mkYesod "NewHamlet" [$parseRoutes|/ RootR GET|] > instance Yesod NewHamlet where approot _ = ""+> type Widget = GWidget NewHamlet NewHamlet >  > myHtml :: Html > myHtml = [$hamlet|%p Just don't use any URLs in here!|] >-> myInnerWidget :: Widget NewHamlet ()+> myInnerWidget :: Widget () > myInnerWidget = do->     addBody [$hamlet|+>     addHamlet [$hamlet| >   #inner Inner widget >   $myHtml$ > |]->     addStyle [$cassius|+>     addCassius [$cassius| >#inner >     color: red|] > @@ -36,12 +37,12 @@ >     %a!href=@RootR@ Link to home > |] > -> myWidget :: Widget NewHamlet ()+> myWidget :: Widget () > myWidget = [$hamlet| >     %h1 Embed another widget >     ^myInnerWidget^ >     %h1 Embed a Hamlet->     ^addBody.myPlainTemplate^+>     ^addHamlet.myPlainTemplate^ > |] >  > getRootR :: GHandler NewHamlet NewHamlet RepHtml
yesod/tutorial/i18n.lhs view
@@ -27,7 +27,7 @@ >             ] >     defaultLayout $ do >       setTitle $ string "I18N Homepage"->       addBody [$hamlet|+>       addHamlet [$hamlet| > %h1 $hello$ > %p In other languages: > %ul
yesod/tutorial/mkToForm.hs view
@@ -8,14 +8,11 @@ import Database.Persist.Sqlite import Database.Persist.TH import Data.Time (Day)+import MkToForm -share2 mkToForm mkPersist [$persist|-Entry-    title String-    day Day Desc toFormField=YesodJquery.jqueryDayField-    content Html toFormField=YesodNic.nicHtmlField-    deriving-|]+jqueryDayField' :: YesodJquery m => FormFieldSettings -> FormletField s m Day+jqueryDayField' = jqueryDayField def+mkToForm (undefined :: Entry)  instance Item Entry where     itemTitle = entryTitle@@ -44,7 +41,7 @@     entries <- runDB $ selectList [] [EntryDayDesc] 0 0     defaultLayout $ do         setTitle $ string "Yesod Blog Tutorial Homepage"-        addBody [$hamlet|+        addHamlet [$hamlet| %h1 Archive %ul     $forall entries entry@@ -58,7 +55,7 @@     entry <- runDB $ get404 entryid     defaultLayout $ do         setTitle $ string $ entryTitle entry-        addBody [$hamlet|+        addHamlet [$hamlet| %h1 $entryTitle.entry$ %h2 $show.entryDay.entry$ $entryContent.entry$
yesod/tutorial/session.lhs view
@@ -9,7 +9,7 @@ > |] > getRoot :: Handler RepHtml > getRoot = do->     sess <- reqSession `fmap` getRequest+>     sess <- getSession >     hamletToRepHtml [$hamlet| > %form!method=post >     %input!type=text!name=key
yesod/tutorial/widgets.lhs view
@@ -21,17 +21,17 @@ > #wrapper ^h^ > %footer Brought to you by Yesod Widgets&trade; > |]-> getRootR = defaultLayout $ flip wrapWidget wrapper $ do+> getRootR = defaultLayout $ wrapper $ do >     i <- newIdent >     setTitle $ string "Hello Widgets"->     addStyle [$cassius|+>     addCassius [$cassius| >   #$i$ >       color: red|] >     addStylesheet $ StaticR $ StaticRoute ["style.css"] [] >     addStylesheetRemote "http://localhost:3000/static/style2.css" >     addScriptRemote "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" >     addScript $ StaticR $ StaticRoute ["script.js"] []->     addBody [$hamlet|+>     addHamlet [$hamlet| > %h1#$i$ Welcome to my first widget!!! > %p >     %a!href=@RootR@ Recursive link.@@ -39,14 +39,14 @@ >     %a!href=@FormR@ Check out the form. > %p.noscript Your script did not load. :( > |]->     addHead [$hamlet|%meta!keywords=haskell|]+>     addHtmlHead [$hamlet|%meta!keywords=haskell|] >  > handleFormR = do->     (res, form, enctype) <- runFormPost $ fieldsToTable $ (,,,,,,,,)+>     (res, form, enctype, nonce) <- runFormPost $ fieldsToTable $ (,,,,,,,,) >         <$> stringField "My Field" Nothing >         <*> stringField "Another field" (Just "some default text") >         <*> intField "A number field" (Just 5)->         <*> jqueryDayField "A day field" Nothing+>         <*> jqueryDayField def "A day field" Nothing >         <*> timeField "A time field" Nothing >         <*> boolField "A checkbox" (Just False) >         <*> jqueryAutocompleteField AutoCompleteR "Autocomplete" Nothing@@ -57,19 +57,20 @@ >                     FormSuccess (_, _, _, _, _, _, _, x, _) -> Just x >                     _ -> Nothing >     defaultLayout $ do->         addStyle [$cassius|+>         addCassius [$cassius| > .tooltip >     color: #666 >     font-style: italic > textarea.html >     width: 300px >     height: 150px|]->         wrapWidget form $ \h -> [$hamlet|+>         addWidget [$hamlet| > %form!method=post!enctype=$enctype$ >     %table->         ^h^+>         ^form^ >         %tr >             %td!colspan=2+>                 $nonce$ >                 %input!type=submit >     $maybe mhtml html >         $html$