added page titles

This commit is contained in:
nek0 2014-09-24 23:03:18 +02:00
parent 63948fa842
commit 8a20f2513a
19 changed files with 53 additions and 17 deletions

View file

@ -18,6 +18,7 @@ getActivateR token = do
user <- runDB $ getJust (fromJust $ tokenUser uToken)
hexSalt <- return $ toHex $ userSalt user
defaultLayout $ do
setTitle "Activate your account"
$(widgetFile "activate")
_ -> do
setMessage "Invalid token!"

View file

@ -12,6 +12,7 @@ getAdminR = do
case userAdmin user of
True -> do
defaultLayout $ do
setTitle "Administration: Menu"
$(widgetFile "adminBase")
False -> do
setMessage "You have no admin rights"

View file

@ -16,6 +16,7 @@ getAdminAlbumsR = do
True -> do
albums <- runDB $ selectList [] [Asc AlbumTitle]
defaultLayout $ do
setTitle "Administration: Albums"
$(widgetFile "adminAlbums")
False -> do
setMessage "You are no admin"
@ -38,6 +39,7 @@ getAdminAlbumMediaR albumId = do
Just album -> do
media <- runDB $ selectList [MediumAlbum ==. albumId] [Asc MediumTitle]
defaultLayout $ do
setTitle "Administration: Album media"
$(widgetFile "adminAlbumMedia")
Nothing -> do
setMessage "This album does not exist"
@ -63,6 +65,7 @@ getAdminAlbumSettingsR albumId = do
Just album -> do
(adminAlbumSettingsWidget, enctype) <- generateFormPost $ adminAlbumSettingsForm album albumId
defaultLayout $ do
setTitle "Administration: Album settings"
$(widgetFile "adminAlbumSet")
Nothing -> do
setMessage "This album does not exist"

View file

@ -16,6 +16,7 @@ getAdminMediaR = do
True -> do
media <- runDB $ selectList [] [Asc MediumTitle]
defaultLayout $ do
setTitle "Administration: Media"
$(widgetFile "adminMedia")
False -> do
setMessage "You are no admin"
@ -38,6 +39,7 @@ getAdminMediumSettingsR mediumId = do
Just medium -> do
(adminMediumSetWidget, enctype) <- generateFormPost $ adminMediumSetForm medium
defaultLayout $ do
setTitle "Administration: Medium Settings"
$(widgetFile "adminMediumSet")
Nothing -> do
setMessage "This medium does not exist"

View file

@ -16,6 +16,7 @@ getAdminProfilesR = do
True -> do
profiles <- runDB $ selectList [] [Desc UserName]
defaultLayout $ do
setTitle "Administration: Profiles"
$(widgetFile "adminProfiles")
False -> do
setMessage "You are no admin"
@ -38,6 +39,7 @@ getAdminUserAlbumsR ownerId = do
Just owner -> do
albums <- runDB $ selectList [AlbumOwner ==. ownerId] [Desc AlbumTitle]
defaultLayout $ do
setTitle "Administration: User albums"
$(widgetFile "adminUserAlbums")
Nothing -> do
setMessage "This user does not exist"
@ -63,6 +65,7 @@ getAdminUserMediaR ownerId = do
Just owner -> do
media <- runDB $ selectList [MediumOwner ==. ownerId] [Desc MediumTitle]
defaultLayout $ do
setTitle "Administration: User media"
$(widgetFile "adminUserMedia")
Nothing -> do
setMessage "This user does not exist"
@ -88,6 +91,7 @@ getAdminProfileSettingsR ownerId = do
Just owner -> do
(adminProfileSetWidget, enctype) <- generateFormPost $ adminProfileForm owner
defaultLayout $ do
setTitle "Administration: Profile settings"
$(widgetFile "adminProfileSettings")
Nothing -> do
setMessage "This user does not exist"

View file

@ -1,6 +1,7 @@
module Handler.Album where
import Import
import qualified Data.Text as T
getAlbumR :: AlbumId -> Handler Html
getAlbumR albumId = do
@ -20,6 +21,7 @@ getAlbumR albumId = do
-- media <- mapM (\a -> runDB $ getJust a) (albumContent album)
media <- runDB $ selectList [MediumAlbum ==. albumId] [Desc MediumTime]
defaultLayout $ do
setTitle $ toHtml ("Eidolon :: Album " `T.append` (albumTitle album))
$(widgetFile "album")
Nothing -> do
setMessage "This album does not exist"

View file

@ -22,6 +22,7 @@ getAlbumSettingsR albumId = do
True -> do
(albumSettingsWidget, enctype) <- generateFormPost $ albumSettingsForm album albumId
defaultLayout $ do
setTitle "Eidolon :: Album Settings"
$(widgetFile "albumSettings")
False -> do
setMessage "You must own this album to change its settings"
@ -97,6 +98,7 @@ getAlbumDeleteR albumId = do
case presence of
True -> do
defaultLayout $ do
setTitle $ toHtml ("Eidolon :: Delete album" `T.append` (albumTitle album))
$(widgetFile "albumDelete")
False -> do
setMessage "You must own this album to delete it"

View file

@ -7,4 +7,5 @@ getHomeR :: Handler Html
getHomeR = do
recentMedia <- runDB $ selectList [] [Desc MediumTime]
defaultLayout $ do
setTitle "Eidolon :: Home"
$(widgetFile "home")

View file

@ -20,6 +20,7 @@ getLoginR :: Handler Html
getLoginR = do
-- (loginWidget, enctype) <- generateFormPost loginForm
defaultLayout $ do
setTitle "Eidolon :: Login"
$(widgetFile "login")

View file

@ -2,6 +2,7 @@ module Handler.Medium where
import Import
import Data.Time
import qualified Data.Text as T
import System.Locale
getMediumR :: MediumId -> Handler Html
@ -22,6 +23,7 @@ getMediumR mediumId = do
Nothing ->
return False
defaultLayout $ do
setTitle $ toHtml ("Eidolon :: Medium " `T.append` (mediumTitle medium))
$(widgetFile "medium")
Nothing -> do
setMessage "This image does not exist"

View file

@ -21,6 +21,7 @@ getMediumSettingsR mediumId = do
True -> do
(mediumSettingsWidget, enctype) <- generateFormPost $ mediumSettingsForm medium
defaultLayout $ do
setTitle "Eidolon :: Medium Settings"
$(widgetFile "mediumSettings")
False -> do
setMessage "You must own this medium to change its settings"
@ -94,6 +95,7 @@ getMediumDeleteR mediumId = do
case presence of
True -> do
defaultLayout $ do
setTitle "Eidolon :: Delete Medium"
$(widgetFile "mediumDelete")
False -> do
setMessage "You must own this medium to delete it"

View file

@ -13,6 +13,7 @@ getNewAlbumR = do
userId <- lift $ pure $ getUserIdFromText tempUserId
(albumWidget, enctype) <- generateFormPost (albumForm userId)
defaultLayout $ do
setTitle "Eidolon :: Create new Album"
$(widgetFile "newAlbum")
Nothing -> do
setMessage "You need to be logged in"

View file

@ -6,8 +6,10 @@ import qualified Data.Text as T
getProfileR :: UserId -> Handler Html
getProfileR ownerId = do
owner <- runDB $ get ownerId
ownerSlug <- lift $ pure $ userSlug $ fromJust owner
tempOwner <- runDB $ get ownerId
case tempOwner of
Just owner -> do
ownerSlug <- lift $ pure $ userSlug owner
userAlbs <- runDB $ selectList [AlbumOwner ==. ownerId] [Asc AlbumTitle]
recentMedia <- (runDB $ selectList [MediumOwner ==. ownerId] [Desc MediumTime])
msu <- lookupSession "userId"
@ -18,7 +20,11 @@ getProfileR ownerId = do
Nothing ->
return False
defaultLayout $ do
setTitle $ toHtml ("Eidolon :: " `T.append` (userSlug owner) `T.append` "'s profile")
$(widgetFile "profile")
Nothing -> do
setMessage "This profile does not exist"
redirect $ HomeR
getUserR :: Text -> Handler Html
getUserR ownerName = do

View file

@ -19,6 +19,7 @@ getProfileDeleteR userId = do
case loginId == userId of
True -> do
defaultLayout $ do
setTitle "Eidolon :: Delete user profile"
$(widgetFile "profileDelete")
False -> do
setMessage "You can only delete your own profile"

View file

@ -16,6 +16,7 @@ getProfileSettingsR userId = do
True -> do
(profileSettingsWidget, enctype) <- generateFormPost $ profileSettingsForm user
defaultLayout $ do
setTitle "Eidolon :: Profile settings"
$(widgetFile "profileSettings")
False -> do
setMessage "You can only change your own profile settings"

View file

@ -8,6 +8,7 @@ getReactivateR :: Handler Html
getReactivateR = do
(reactivateWidget, enctype) <- generateFormPost reactivateForm
defaultLayout $ do
setTitle "Eidolon :: Reactivate account"
$(widgetFile "reactivate")
postReactivateR :: Handler Html

View file

@ -14,6 +14,7 @@ getSignupR :: Handler Html
getSignupR = do
-- (signupWidget, enctype) <- generateFormPost signupForm
defaultLayout $ do
setTitle "Eidolon :: Signup"
$(widgetFile "signup")
postSignupR :: Handler Html

View file

@ -1,6 +1,7 @@
module Handler.Tag where
import Import
import qualified Data.Text as T
import Data.Maybe
getTagR :: Text -> Handler Html
@ -13,4 +14,5 @@ getTagR tag = do
) tempMedia
media <- return $ removeItem Nothing almostMedia
defaultLayout $ do
setTitle $ toHtml ("Eidolon :: Tag " `T.append` tag)
$(widgetFile "tagMedia")

View file

@ -2,7 +2,7 @@ module Handler.Upload where
import Import as I
import Data.Time
import Data.Text
import qualified Data.Text as T
import System.FilePath
data TempMedium = TempMedium
@ -23,6 +23,7 @@ getUploadR = do
userId <- lift $ pure $ getUserIdFromText tempUserId
(uploadWidget, enctype) <- generateFormPost (uploadForm userId)
defaultLayout $ do
setTitle "Eidolon :: Upload Medium"
$(widgetFile "upload")
Nothing -> do
setMessage "You need to be logged in"
@ -77,6 +78,7 @@ getDirectUploadR albumId = do
True -> do
(dUploadWidget, enctype) <- generateFormPost $ dUploadForm userId albumId
defaultLayout $ do
setTitle $ toHtml ("Eidolon :: Upload medium to " `T.append` (albumTitle album))
$(widgetFile "dUpload")
False -> do
setMessage "You must own this album to upload"
@ -138,9 +140,9 @@ writeOnDrive :: FileInfo -> UserId -> AlbumId -> Handler FilePath
writeOnDrive file userId albumId = do
filename <- return $ fileName file
path <- return $ "static" </> "data"
</> (unpack $ extractKey userId)
</> (unpack $ extractKey albumId)
</> (unpack filename)
</> (T.unpack $ extractKey userId)
</> (T.unpack $ extractKey albumId)
</> (T.unpack filename)
liftIO $ fileMove file path
return path