From 3da488b3a214d8baadf8d4b319cf9a5f6ac97a9a Mon Sep 17 00:00:00 2001 From: fr33domlover Date: Sun, 14 Feb 2016 10:17:31 +0000 Subject: [PATCH] Remove example code I don't need --- config/routes | 2 -- src/Application.hs | 1 - src/Handler/Comment.hs | 31 ------------------------------- src/Handler/Home.hs | 6 ------ templates/homepage.lucius | 25 ------------------------- vervis.cabal | 1 - 6 files changed, 66 deletions(-) delete mode 100644 src/Handler/Comment.hs delete mode 100644 templates/homepage.lucius diff --git a/config/routes b/config/routes index 464cb92..79163ba 100644 --- a/config/routes +++ b/config/routes @@ -19,5 +19,3 @@ /robots.txt RobotsR GET / HomeR GET POST - -/comments CommentR POST diff --git a/src/Application.hs b/src/Application.hs index 505661f..2ca3ce1 100644 --- a/src/Application.hs +++ b/src/Application.hs @@ -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 diff --git a/src/Handler/Comment.hs b/src/Handler/Comment.hs deleted file mode 100644 index eaf272b..0000000 --- a/src/Handler/Comment.hs +++ /dev/null @@ -1,31 +0,0 @@ -{- This file is part of Vervis. - - - - Written in 2016 by fr33domlover . - - - - ♡ 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 - - . - -} - -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 diff --git a/src/Handler/Home.hs b/src/Handler/Home.hs index aebe3f2..4e20539 100644 --- a/src/Handler/Home.hs +++ b/src/Handler/Home.hs @@ -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") diff --git a/templates/homepage.lucius b/templates/homepage.lucius deleted file mode 100644 index 1e11509..0000000 --- a/templates/homepage.lucius +++ /dev/null @@ -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; -} diff --git a/vervis.cabal b/vervis.cabal index 5bb245b..2f3cc7e 100644 --- a/vervis.cabal +++ b/vervis.cabal @@ -43,7 +43,6 @@ library Settings.StaticFiles Handler.Common Handler.Home - Handler.Comment -- other-modules: default-extensions: TemplateHaskell QuasiQuotes