From 77aa2bf48808a79f5db435d3fbd42eea8236656a Mon Sep 17 00:00:00 2001 From: nek0 Date: Fri, 15 Aug 2014 15:47:16 +0200 Subject: [PATCH] handler cleanup --- Handler/Activate.hs | 4 ++-- Handler/Login.hs | 6 +++--- Handler/NewAlbum.hs | 4 ++-- Handler/Signup.hs | 6 +++--- Handler/Upload.hs | 8 ++++---- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Handler/Activate.hs b/Handler/Activate.hs index f7a3429..d81761f 100644 --- a/Handler/Activate.hs +++ b/Handler/Activate.hs @@ -10,10 +10,10 @@ getActivateR token = do t <- runDB $ selectFirst [TokenToken ==. token] [] case t of Nothing -> do - setMessage $ [shamlet|
Invalid Token!|]
+      setMessage "Invalid Token!"
       redirect $ HomeR
     Just x -> do
       userId <- runDB $ insert $ tokenUser (entityVal x)
       liftIO $ createDirectory $ "data"  (unpack $ extractKey userId)
-      setMessage $ [shamlet|
User activated|]
+      setMessage $ "User activated"
       redirect $ HomeR
diff --git a/Handler/Login.hs b/Handler/Login.hs
index 627af3b..7fef18f 100644
--- a/Handler/Login.hs
+++ b/Handler/Login.hs
@@ -26,10 +26,10 @@ postLoginR = do
           case credentialsPasswd cred == userPassword (entityVal user) of
             True -> do
               setSession "userId" $ extractKey $ entityKey user
-              setMessage $ [shamlet|
Successfully logged in|]
+              setMessage "Successfully logged in"
               redirect $ HomeR
             False -> do
-              setMessage $ [shamlet|
Login error|]
+              setMessage $ "Login error"
               redirect $ LoginR
         Nothing -> do
           setMessage $ [shamlet|
User does not exist|]
@@ -43,5 +43,5 @@ loginForm = renderDivs $ Credentials
 getLogoutR :: Handler Html
 getLogoutR = do
   deleteSession "userId"
-  setMessage $ [shamlet|
Succesfully logged out|]
+  setMessage "Succesfully logged out"
   redirect $ HomeR
diff --git a/Handler/NewAlbum.hs b/Handler/NewAlbum.hs
index dec8351..134f12d 100644
--- a/Handler/NewAlbum.hs
+++ b/Handler/NewAlbum.hs
@@ -15,7 +15,7 @@ getNewAlbumR = do
       defaultLayout $ do
         $(widgetFile "newAlbum")
     Nothing -> do
-      setMessage $ [shamlet|
You need to be lgged in|]
+      setMessage "You need to be lgged in"
       redirect $ LoginR
 
 postNewAlbumR :: Handler Html
@@ -29,7 +29,7 @@ postNewAlbumR = do
         FormSuccess album -> do
           albumId <- runDB $ insert album
           liftIO $ createDirectory $ "data"  (unpack $ extractKey userId)  (unpack $ extractKey albumId)
-          setMessage $ [shamlet|
Album successfully created|]
+          setMessage $ "Album successfully created"
           redirect $ ProfileR userId
 
 albumForm :: UserId -> Form Album
diff --git a/Handler/Signup.hs b/Handler/Signup.hs
index ac9fb52..c13e43f 100644
--- a/Handler/Signup.hs
+++ b/Handler/Signup.hs
@@ -30,13 +30,13 @@ postSignupR = do
               To complete your sgnup please activate your account by visiting the following link
               #{activateLink}
             |]
-          setMessage $ [shamlet|
User created|]
+          setMessage "User created"
           redirect $ HomeR
         False -> do
-          setMessage $ [shamlet|
Username error|]
+          setMessage "Username error"
           redirect $ SignupR
     _ -> do
-      setMessage $ [shamlet|
Please try again|]
+      setMessage "Please try again"
       redirect $ SignupR
 
 signupForm :: Form User
diff --git a/Handler/Upload.hs b/Handler/Upload.hs
index f280991..e0f9b0e 100644
--- a/Handler/Upload.hs
+++ b/Handler/Upload.hs
@@ -26,7 +26,7 @@ getUploadR = do
       defaultLayout $ do
         $(widgetFile "upload")
     Nothing -> do
-      setMessage $ [shamlet|
You need to be logged in|]
+      setMessage "You need to be logged in"
       redirect $ LoginR
 
 postUploadR :: Handler Html
@@ -48,13 +48,13 @@ postUploadR = do
             (tempMediumTags temp)
             (tempMediumAlbum temp)
           mId <- runDB $ I.insert medium
-          setMessage $ [shamlet|
Image succesfully uploaded|]
+          setMessage "Image succesfully uploaded"
           redirect $ HomeR
         _ -> do
-          setMessage $ [shamlet|
There was an error uploading the file|]
+          setMessage "There was an error uploading the file"
           redirect $ UploadR
     Nothing -> do
-      setMessage $ [shamlet|
You need to be logged in|]
+      setMessage "You need to be logged in"
       redirect $ LoginR
 
 writeOnDrive :: FileInfo -> Handler FilePath