Move files around
This commit is contained in:
parent
008f7b0db4
commit
bb2dbc3b79
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,7 +1,7 @@
|
|||||||
dist*
|
dist*
|
||||||
static/tmp/
|
static/tmp/
|
||||||
static/combined/
|
static/combined/
|
||||||
config/client_session_key.aes
|
client_session_key.aes
|
||||||
*.hi
|
*.hi
|
||||||
*.o
|
*.o
|
||||||
*.sqlite3
|
*.sqlite3
|
||||||
|
|||||||
@ -6,6 +6,4 @@
|
|||||||
|
|
||||||
/ HomeR GET POST
|
/ HomeR GET POST
|
||||||
|
|
||||||
/comments CommentR POST
|
|
||||||
|
|
||||||
/profile ProfileR GET
|
/profile ProfileR GET
|
||||||
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
@ -68,7 +68,7 @@ library:
|
|||||||
executables:
|
executables:
|
||||||
uniworx:
|
uniworx:
|
||||||
main: main.hs
|
main: main.hs
|
||||||
source-dirs: app
|
source-dirs: exe
|
||||||
ghc-options:
|
ghc-options:
|
||||||
- -threaded
|
- -threaded
|
||||||
- -rtsopts
|
- -rtsopts
|
||||||
|
|||||||
@ -56,7 +56,7 @@ data MenuTypes
|
|||||||
-- This function also generates the following type synonyms:
|
-- This function also generates the following type synonyms:
|
||||||
-- type Handler = HandlerT App IO
|
-- type Handler = HandlerT App IO
|
||||||
-- type Widget = WidgetT App IO ()
|
-- type Widget = WidgetT App IO ()
|
||||||
mkYesodData "App" $(parseRoutesFile "config/routes")
|
mkYesodData "App" $(parseRoutesFile "app/routes")
|
||||||
|
|
||||||
-- | A convenient synonym for creating forms.
|
-- | A convenient synonym for creating forms.
|
||||||
type Form x = Html -> MForm (HandlerT App IO) (FormResult x, Widget)
|
type Form x = Html -> MForm (HandlerT App IO) (FormResult x, Widget)
|
||||||
@ -75,7 +75,7 @@ instance Yesod App where
|
|||||||
-- default session idle timeout is 120 minutes
|
-- default session idle timeout is 120 minutes
|
||||||
makeSessionBackend _ = Just <$> defaultClientSessionBackend
|
makeSessionBackend _ = Just <$> defaultClientSessionBackend
|
||||||
120 -- timeout in minutes
|
120 -- timeout in minutes
|
||||||
"config/client_session_key.aes"
|
"client_session_key.aes"
|
||||||
|
|
||||||
-- Yesod Middleware allows you to run code before and after each handler function.
|
-- Yesod Middleware allows you to run code before and after each handler function.
|
||||||
-- The defaultYesodMiddleware adds the response header "Vary: Accept, Accept-Language" and performs authorization checks.
|
-- The defaultYesodMiddleware adds the response header "Vary: Accept, Accept-Language" and performs authorization checks.
|
||||||
|
|||||||
@ -1,16 +0,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
|
|
||||||
@ -15,8 +15,8 @@ import Import
|
|||||||
getFaviconR :: Handler TypedContent
|
getFaviconR :: Handler TypedContent
|
||||||
getFaviconR = do cacheSeconds $ 60 * 60 * 24 * 30 -- cache for a month
|
getFaviconR = do cacheSeconds $ 60 * 60 * 24 * 30 -- cache for a month
|
||||||
return $ TypedContent "image/x-icon"
|
return $ TypedContent "image/x-icon"
|
||||||
$ toContent $(embedFile "config/favicon.ico")
|
$ toContent $(embedFile "embedded/favicon.ico")
|
||||||
|
|
||||||
getRobotsR :: Handler TypedContent
|
getRobotsR :: Handler TypedContent
|
||||||
getRobotsR = return $ TypedContent typePlain
|
getRobotsR = return $ TypedContent typePlain
|
||||||
$ toContent $(embedFile "config/robots.txt")
|
$ toContent $(embedFile "embedded/robots.txt")
|
||||||
|
|||||||
@ -4,4 +4,3 @@ module Import
|
|||||||
|
|
||||||
import Foundation as Import
|
import Foundation as Import
|
||||||
import Import.NoFoundation as Import
|
import Import.NoFoundation as Import
|
||||||
import ModelData as Import
|
|
||||||
|
|||||||
@ -7,20 +7,23 @@
|
|||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
{-# LANGUAGE TemplateHaskell #-}
|
||||||
{-# LANGUAGE TypeFamilies #-}
|
{-# LANGUAGE TypeFamilies #-}
|
||||||
module Model where
|
module Model
|
||||||
|
( module Model
|
||||||
|
, module Model.Types
|
||||||
|
) where
|
||||||
|
|
||||||
import ClassyPrelude.Yesod
|
import ClassyPrelude.Yesod
|
||||||
import Database.Persist.Quasi
|
import Database.Persist.Quasi
|
||||||
-- import Data.Time
|
-- import Data.Time
|
||||||
-- import Data.ByteString
|
-- import Data.ByteString
|
||||||
import ModelData
|
import Model.Types
|
||||||
|
|
||||||
-- You can define all of your database entities in the entities file.
|
-- You can define all of your database entities in the entities file.
|
||||||
-- You can find more information on persistent and how to declare entities
|
-- You can find more information on persistent and how to declare entities
|
||||||
-- at:
|
-- at:
|
||||||
-- http://www.yesodweb.com/book/persistent/
|
-- http://www.yesodweb.com/book/persistent/
|
||||||
share [mkPersist sqlSettings, mkMigrate "migrateAll"]
|
share [mkPersist sqlSettings, mkMigrate "migrateAll"]
|
||||||
$(persistFileWith lowerCaseSettings "config/models")
|
$(persistFileWith lowerCaseSettings "app/models")
|
||||||
|
|
||||||
instance Show Term where
|
instance Show Term where
|
||||||
show = ClassyPrelude.Yesod.unpack . termName
|
show = ClassyPrelude.Yesod.unpack . termName
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{-# LANGUAGE NamedFieldPuns #-}
|
{-# LANGUAGE NamedFieldPuns #-}
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
{-# LANGUAGE TemplateHaskell #-}
|
||||||
module ModelData where
|
module Model.Types where
|
||||||
|
|
||||||
import Database.Persist.TH
|
import Database.Persist.TH
|
||||||
|
|
||||||
@ -28,4 +28,4 @@ instance PersistField Term where
|
|||||||
fromPersistValue (Term {season, year}) = undefined
|
fromPersistValue (Term {season, year}) = undefined
|
||||||
sqlType _ = SqlInteger
|
sqlType _ = SqlInteger
|
||||||
isNullable _ = False
|
isNullable _ = False
|
||||||
-}
|
-}
|
||||||
Loading…
Reference in New Issue
Block a user