Remove example code I don't need
This commit is contained in:
parent
f4dcf17f3f
commit
3da488b3a2
6 changed files with 0 additions and 66 deletions
|
@ -19,5 +19,3 @@
|
|||
/robots.txt RobotsR GET
|
||||
|
||||
/ HomeR GET POST
|
||||
|
||||
/comments CommentR POST
|
||||
|
|
|
@ -51,7 +51,6 @@ import System.Log.FastLogger (defaultBufSize, newStdoutLoggerSet,
|
|||
-- Don't forget to add new modules to your cabal file!
|
||||
import Handler.Common
|
||||
import Handler.Home
|
||||
import Handler.Comment
|
||||
|
||||
-- This line actually creates our YesodDispatch instance. It is the second half
|
||||
-- of the call to mkYesodData which occurs in Foundation.hs. Please see the
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
{- This file is part of Vervis.
|
||||
-
|
||||
- Written in 2016 by fr33domlover <fr33domlover@riseup.net>.
|
||||
-
|
||||
- ♡ Copying is an act of love. Please copy, reuse and share.
|
||||
-
|
||||
- The author(s) have dedicated all copyright and related and neighboring
|
||||
- rights to this software to the public domain worldwide. This software is
|
||||
- distributed without any warranty.
|
||||
-
|
||||
- You should have received a copy of the CC0 Public Domain Dedication along
|
||||
- with this software. If not, see
|
||||
- <http://creativecommons.org/publicdomain/zero/1.0/>.
|
||||
-}
|
||||
|
||||
module Handler.Comment where
|
||||
|
||||
import Import
|
||||
|
||||
postCommentR :: Handler Value
|
||||
postCommentR = do
|
||||
-- requireJsonBody will parse the request body into the appropriate type, or return a 400 status code if the request JSON is invalid.
|
||||
-- (The ToJSON and FromJSON instances are derived in the config/models file).
|
||||
comment <- (requireJsonBody :: Handler Comment)
|
||||
|
||||
-- The YesodAuth instance in Foundation.hs defines the UserId to be the type used for authentication.
|
||||
maybeCurrentUserId <- maybeAuthId
|
||||
let comment' = comment { commentUserId = maybeCurrentUserId }
|
||||
|
||||
insertedComment <- runDB $ insertEntity comment'
|
||||
returnJson insertedComment
|
|
@ -18,7 +18,6 @@ module Handler.Home where
|
|||
import Import
|
||||
import Yesod.Form.Bootstrap3 (BootstrapFormLayout (..), renderBootstrap3,
|
||||
withSmallInput)
|
||||
import Text.Julius (RawJS (..))
|
||||
|
||||
-- This is a handler function for the GET request method on the HomeR
|
||||
-- resource pattern. All of your resource patterns are defined in
|
||||
|
@ -33,7 +32,6 @@ getHomeR = do
|
|||
let submission = Nothing :: Maybe (FileInfo, Text)
|
||||
handlerName = "getHomeR" :: Text
|
||||
defaultLayout $ do
|
||||
let (commentFormId, commentTextareaId, commentListId) = commentIds
|
||||
aDomId <- newIdent
|
||||
setTitle "Welcome To Yesod!"
|
||||
$(widgetFile "homepage")
|
||||
|
@ -47,7 +45,6 @@ postHomeR = do
|
|||
_ -> Nothing
|
||||
|
||||
defaultLayout $ do
|
||||
let (commentFormId, commentTextareaId, commentListId) = commentIds
|
||||
aDomId <- newIdent
|
||||
setTitle "Welcome To Yesod!"
|
||||
$(widgetFile "homepage")
|
||||
|
@ -56,6 +53,3 @@ sampleForm :: Form (FileInfo, Text)
|
|||
sampleForm = renderBootstrap3 BootstrapBasicForm $ (,)
|
||||
<$> fileAFormReq "Choose a file"
|
||||
<*> areq textField (withSmallInput "What's on the file?") Nothing
|
||||
|
||||
commentIds :: (Text, Text, Text)
|
||||
commentIds = ("js-commentForm", "js-createCommentTextarea", "js-commentList")
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
h1 {
|
||||
text-align: center;
|
||||
margin-bottom: 30px
|
||||
}
|
||||
h2##{aDomId} {
|
||||
color: #990
|
||||
}
|
||||
li {
|
||||
line-height: 2em;
|
||||
font-size: 16px
|
||||
}
|
||||
ol {
|
||||
margin-bottom: 30px
|
||||
}
|
||||
footer {
|
||||
text-align: center
|
||||
}
|
||||
.input-sm {
|
||||
margin-left: 20px
|
||||
}
|
||||
|
||||
##{commentTextareaId} {
|
||||
width: 400px;
|
||||
height: 100px;
|
||||
}
|
|
@ -43,7 +43,6 @@ library
|
|||
Settings.StaticFiles
|
||||
Handler.Common
|
||||
Handler.Home
|
||||
Handler.Comment
|
||||
-- other-modules:
|
||||
default-extensions: TemplateHaskell
|
||||
QuasiQuotes
|
||||
|
|
Loading…
Reference in a new issue