added page titles
This commit is contained in:
parent
63948fa842
commit
8a20f2513a
19 changed files with 53 additions and 17 deletions
|
@ -18,6 +18,7 @@ getActivateR token = do
|
||||||
user <- runDB $ getJust (fromJust $ tokenUser uToken)
|
user <- runDB $ getJust (fromJust $ tokenUser uToken)
|
||||||
hexSalt <- return $ toHex $ userSalt user
|
hexSalt <- return $ toHex $ userSalt user
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
|
setTitle "Activate your account"
|
||||||
$(widgetFile "activate")
|
$(widgetFile "activate")
|
||||||
_ -> do
|
_ -> do
|
||||||
setMessage "Invalid token!"
|
setMessage "Invalid token!"
|
||||||
|
|
|
@ -12,6 +12,7 @@ getAdminR = do
|
||||||
case userAdmin user of
|
case userAdmin user of
|
||||||
True -> do
|
True -> do
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
|
setTitle "Administration: Menu"
|
||||||
$(widgetFile "adminBase")
|
$(widgetFile "adminBase")
|
||||||
False -> do
|
False -> do
|
||||||
setMessage "You have no admin rights"
|
setMessage "You have no admin rights"
|
||||||
|
|
|
@ -16,6 +16,7 @@ getAdminAlbumsR = do
|
||||||
True -> do
|
True -> do
|
||||||
albums <- runDB $ selectList [] [Asc AlbumTitle]
|
albums <- runDB $ selectList [] [Asc AlbumTitle]
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
|
setTitle "Administration: Albums"
|
||||||
$(widgetFile "adminAlbums")
|
$(widgetFile "adminAlbums")
|
||||||
False -> do
|
False -> do
|
||||||
setMessage "You are no admin"
|
setMessage "You are no admin"
|
||||||
|
@ -38,6 +39,7 @@ getAdminAlbumMediaR albumId = do
|
||||||
Just album -> do
|
Just album -> do
|
||||||
media <- runDB $ selectList [MediumAlbum ==. albumId] [Asc MediumTitle]
|
media <- runDB $ selectList [MediumAlbum ==. albumId] [Asc MediumTitle]
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
|
setTitle "Administration: Album media"
|
||||||
$(widgetFile "adminAlbumMedia")
|
$(widgetFile "adminAlbumMedia")
|
||||||
Nothing -> do
|
Nothing -> do
|
||||||
setMessage "This album does not exist"
|
setMessage "This album does not exist"
|
||||||
|
@ -63,6 +65,7 @@ getAdminAlbumSettingsR albumId = do
|
||||||
Just album -> do
|
Just album -> do
|
||||||
(adminAlbumSettingsWidget, enctype) <- generateFormPost $ adminAlbumSettingsForm album albumId
|
(adminAlbumSettingsWidget, enctype) <- generateFormPost $ adminAlbumSettingsForm album albumId
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
|
setTitle "Administration: Album settings"
|
||||||
$(widgetFile "adminAlbumSet")
|
$(widgetFile "adminAlbumSet")
|
||||||
Nothing -> do
|
Nothing -> do
|
||||||
setMessage "This album does not exist"
|
setMessage "This album does not exist"
|
||||||
|
|
|
@ -16,6 +16,7 @@ getAdminMediaR = do
|
||||||
True -> do
|
True -> do
|
||||||
media <- runDB $ selectList [] [Asc MediumTitle]
|
media <- runDB $ selectList [] [Asc MediumTitle]
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
|
setTitle "Administration: Media"
|
||||||
$(widgetFile "adminMedia")
|
$(widgetFile "adminMedia")
|
||||||
False -> do
|
False -> do
|
||||||
setMessage "You are no admin"
|
setMessage "You are no admin"
|
||||||
|
@ -38,6 +39,7 @@ getAdminMediumSettingsR mediumId = do
|
||||||
Just medium -> do
|
Just medium -> do
|
||||||
(adminMediumSetWidget, enctype) <- generateFormPost $ adminMediumSetForm medium
|
(adminMediumSetWidget, enctype) <- generateFormPost $ adminMediumSetForm medium
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
|
setTitle "Administration: Medium Settings"
|
||||||
$(widgetFile "adminMediumSet")
|
$(widgetFile "adminMediumSet")
|
||||||
Nothing -> do
|
Nothing -> do
|
||||||
setMessage "This medium does not exist"
|
setMessage "This medium does not exist"
|
||||||
|
|
|
@ -16,6 +16,7 @@ getAdminProfilesR = do
|
||||||
True -> do
|
True -> do
|
||||||
profiles <- runDB $ selectList [] [Desc UserName]
|
profiles <- runDB $ selectList [] [Desc UserName]
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
|
setTitle "Administration: Profiles"
|
||||||
$(widgetFile "adminProfiles")
|
$(widgetFile "adminProfiles")
|
||||||
False -> do
|
False -> do
|
||||||
setMessage "You are no admin"
|
setMessage "You are no admin"
|
||||||
|
@ -38,6 +39,7 @@ getAdminUserAlbumsR ownerId = do
|
||||||
Just owner -> do
|
Just owner -> do
|
||||||
albums <- runDB $ selectList [AlbumOwner ==. ownerId] [Desc AlbumTitle]
|
albums <- runDB $ selectList [AlbumOwner ==. ownerId] [Desc AlbumTitle]
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
|
setTitle "Administration: User albums"
|
||||||
$(widgetFile "adminUserAlbums")
|
$(widgetFile "adminUserAlbums")
|
||||||
Nothing -> do
|
Nothing -> do
|
||||||
setMessage "This user does not exist"
|
setMessage "This user does not exist"
|
||||||
|
@ -63,6 +65,7 @@ getAdminUserMediaR ownerId = do
|
||||||
Just owner -> do
|
Just owner -> do
|
||||||
media <- runDB $ selectList [MediumOwner ==. ownerId] [Desc MediumTitle]
|
media <- runDB $ selectList [MediumOwner ==. ownerId] [Desc MediumTitle]
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
|
setTitle "Administration: User media"
|
||||||
$(widgetFile "adminUserMedia")
|
$(widgetFile "adminUserMedia")
|
||||||
Nothing -> do
|
Nothing -> do
|
||||||
setMessage "This user does not exist"
|
setMessage "This user does not exist"
|
||||||
|
@ -88,6 +91,7 @@ getAdminProfileSettingsR ownerId = do
|
||||||
Just owner -> do
|
Just owner -> do
|
||||||
(adminProfileSetWidget, enctype) <- generateFormPost $ adminProfileForm owner
|
(adminProfileSetWidget, enctype) <- generateFormPost $ adminProfileForm owner
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
|
setTitle "Administration: Profile settings"
|
||||||
$(widgetFile "adminProfileSettings")
|
$(widgetFile "adminProfileSettings")
|
||||||
Nothing -> do
|
Nothing -> do
|
||||||
setMessage "This user does not exist"
|
setMessage "This user does not exist"
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
module Handler.Album where
|
module Handler.Album where
|
||||||
|
|
||||||
import Import
|
import Import
|
||||||
|
import qualified Data.Text as T
|
||||||
|
|
||||||
getAlbumR :: AlbumId -> Handler Html
|
getAlbumR :: AlbumId -> Handler Html
|
||||||
getAlbumR albumId = do
|
getAlbumR albumId = do
|
||||||
|
@ -20,6 +21,7 @@ getAlbumR albumId = do
|
||||||
-- media <- mapM (\a -> runDB $ getJust a) (albumContent album)
|
-- media <- mapM (\a -> runDB $ getJust a) (albumContent album)
|
||||||
media <- runDB $ selectList [MediumAlbum ==. albumId] [Desc MediumTime]
|
media <- runDB $ selectList [MediumAlbum ==. albumId] [Desc MediumTime]
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
|
setTitle $ toHtml ("Eidolon :: Album " `T.append` (albumTitle album))
|
||||||
$(widgetFile "album")
|
$(widgetFile "album")
|
||||||
Nothing -> do
|
Nothing -> do
|
||||||
setMessage "This album does not exist"
|
setMessage "This album does not exist"
|
||||||
|
|
|
@ -22,6 +22,7 @@ getAlbumSettingsR albumId = do
|
||||||
True -> do
|
True -> do
|
||||||
(albumSettingsWidget, enctype) <- generateFormPost $ albumSettingsForm album albumId
|
(albumSettingsWidget, enctype) <- generateFormPost $ albumSettingsForm album albumId
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
|
setTitle "Eidolon :: Album Settings"
|
||||||
$(widgetFile "albumSettings")
|
$(widgetFile "albumSettings")
|
||||||
False -> do
|
False -> do
|
||||||
setMessage "You must own this album to change its settings"
|
setMessage "You must own this album to change its settings"
|
||||||
|
@ -97,6 +98,7 @@ getAlbumDeleteR albumId = do
|
||||||
case presence of
|
case presence of
|
||||||
True -> do
|
True -> do
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
|
setTitle $ toHtml ("Eidolon :: Delete album" `T.append` (albumTitle album))
|
||||||
$(widgetFile "albumDelete")
|
$(widgetFile "albumDelete")
|
||||||
False -> do
|
False -> do
|
||||||
setMessage "You must own this album to delete it"
|
setMessage "You must own this album to delete it"
|
||||||
|
|
|
@ -7,4 +7,5 @@ getHomeR :: Handler Html
|
||||||
getHomeR = do
|
getHomeR = do
|
||||||
recentMedia <- runDB $ selectList [] [Desc MediumTime]
|
recentMedia <- runDB $ selectList [] [Desc MediumTime]
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
|
setTitle "Eidolon :: Home"
|
||||||
$(widgetFile "home")
|
$(widgetFile "home")
|
||||||
|
|
|
@ -20,6 +20,7 @@ getLoginR :: Handler Html
|
||||||
getLoginR = do
|
getLoginR = do
|
||||||
-- (loginWidget, enctype) <- generateFormPost loginForm
|
-- (loginWidget, enctype) <- generateFormPost loginForm
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
|
setTitle "Eidolon :: Login"
|
||||||
$(widgetFile "login")
|
$(widgetFile "login")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ module Handler.Medium where
|
||||||
|
|
||||||
import Import
|
import Import
|
||||||
import Data.Time
|
import Data.Time
|
||||||
|
import qualified Data.Text as T
|
||||||
import System.Locale
|
import System.Locale
|
||||||
|
|
||||||
getMediumR :: MediumId -> Handler Html
|
getMediumR :: MediumId -> Handler Html
|
||||||
|
@ -22,6 +23,7 @@ getMediumR mediumId = do
|
||||||
Nothing ->
|
Nothing ->
|
||||||
return False
|
return False
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
|
setTitle $ toHtml ("Eidolon :: Medium " `T.append` (mediumTitle medium))
|
||||||
$(widgetFile "medium")
|
$(widgetFile "medium")
|
||||||
Nothing -> do
|
Nothing -> do
|
||||||
setMessage "This image does not exist"
|
setMessage "This image does not exist"
|
||||||
|
|
|
@ -21,6 +21,7 @@ getMediumSettingsR mediumId = do
|
||||||
True -> do
|
True -> do
|
||||||
(mediumSettingsWidget, enctype) <- generateFormPost $ mediumSettingsForm medium
|
(mediumSettingsWidget, enctype) <- generateFormPost $ mediumSettingsForm medium
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
|
setTitle "Eidolon :: Medium Settings"
|
||||||
$(widgetFile "mediumSettings")
|
$(widgetFile "mediumSettings")
|
||||||
False -> do
|
False -> do
|
||||||
setMessage "You must own this medium to change its settings"
|
setMessage "You must own this medium to change its settings"
|
||||||
|
@ -94,6 +95,7 @@ getMediumDeleteR mediumId = do
|
||||||
case presence of
|
case presence of
|
||||||
True -> do
|
True -> do
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
|
setTitle "Eidolon :: Delete Medium"
|
||||||
$(widgetFile "mediumDelete")
|
$(widgetFile "mediumDelete")
|
||||||
False -> do
|
False -> do
|
||||||
setMessage "You must own this medium to delete it"
|
setMessage "You must own this medium to delete it"
|
||||||
|
|
|
@ -13,6 +13,7 @@ getNewAlbumR = do
|
||||||
userId <- lift $ pure $ getUserIdFromText tempUserId
|
userId <- lift $ pure $ getUserIdFromText tempUserId
|
||||||
(albumWidget, enctype) <- generateFormPost (albumForm userId)
|
(albumWidget, enctype) <- generateFormPost (albumForm userId)
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
|
setTitle "Eidolon :: Create new Album"
|
||||||
$(widgetFile "newAlbum")
|
$(widgetFile "newAlbum")
|
||||||
Nothing -> do
|
Nothing -> do
|
||||||
setMessage "You need to be logged in"
|
setMessage "You need to be logged in"
|
||||||
|
|
|
@ -6,19 +6,25 @@ import qualified Data.Text as T
|
||||||
|
|
||||||
getProfileR :: UserId -> Handler Html
|
getProfileR :: UserId -> Handler Html
|
||||||
getProfileR ownerId = do
|
getProfileR ownerId = do
|
||||||
owner <- runDB $ get ownerId
|
tempOwner <- runDB $ get ownerId
|
||||||
ownerSlug <- lift $ pure $ userSlug $ fromJust owner
|
case tempOwner of
|
||||||
userAlbs <- runDB $ selectList [AlbumOwner ==. ownerId] [Asc AlbumTitle]
|
Just owner -> do
|
||||||
recentMedia <- (runDB $ selectList [MediumOwner ==. ownerId] [Desc MediumTime])
|
ownerSlug <- lift $ pure $ userSlug owner
|
||||||
msu <- lookupSession "userId"
|
userAlbs <- runDB $ selectList [AlbumOwner ==. ownerId] [Asc AlbumTitle]
|
||||||
presence <- case msu of
|
recentMedia <- (runDB $ selectList [MediumOwner ==. ownerId] [Desc MediumTime])
|
||||||
Just tempUserId -> do
|
msu <- lookupSession "userId"
|
||||||
userId <- lift $ pure $ getUserIdFromText tempUserId
|
presence <- case msu of
|
||||||
return (userId == ownerId)
|
Just tempUserId -> do
|
||||||
Nothing ->
|
userId <- lift $ pure $ getUserIdFromText tempUserId
|
||||||
return False
|
return (userId == ownerId)
|
||||||
defaultLayout $ do
|
Nothing ->
|
||||||
$(widgetFile "profile")
|
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 :: Text -> Handler Html
|
||||||
getUserR ownerName = do
|
getUserR ownerName = do
|
||||||
|
|
|
@ -19,6 +19,7 @@ getProfileDeleteR userId = do
|
||||||
case loginId == userId of
|
case loginId == userId of
|
||||||
True -> do
|
True -> do
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
|
setTitle "Eidolon :: Delete user profile"
|
||||||
$(widgetFile "profileDelete")
|
$(widgetFile "profileDelete")
|
||||||
False -> do
|
False -> do
|
||||||
setMessage "You can only delete your own profile"
|
setMessage "You can only delete your own profile"
|
||||||
|
|
|
@ -16,6 +16,7 @@ getProfileSettingsR userId = do
|
||||||
True -> do
|
True -> do
|
||||||
(profileSettingsWidget, enctype) <- generateFormPost $ profileSettingsForm user
|
(profileSettingsWidget, enctype) <- generateFormPost $ profileSettingsForm user
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
|
setTitle "Eidolon :: Profile settings"
|
||||||
$(widgetFile "profileSettings")
|
$(widgetFile "profileSettings")
|
||||||
False -> do
|
False -> do
|
||||||
setMessage "You can only change your own profile settings"
|
setMessage "You can only change your own profile settings"
|
||||||
|
|
|
@ -8,6 +8,7 @@ getReactivateR :: Handler Html
|
||||||
getReactivateR = do
|
getReactivateR = do
|
||||||
(reactivateWidget, enctype) <- generateFormPost reactivateForm
|
(reactivateWidget, enctype) <- generateFormPost reactivateForm
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
|
setTitle "Eidolon :: Reactivate account"
|
||||||
$(widgetFile "reactivate")
|
$(widgetFile "reactivate")
|
||||||
|
|
||||||
postReactivateR :: Handler Html
|
postReactivateR :: Handler Html
|
||||||
|
|
|
@ -14,6 +14,7 @@ getSignupR :: Handler Html
|
||||||
getSignupR = do
|
getSignupR = do
|
||||||
-- (signupWidget, enctype) <- generateFormPost signupForm
|
-- (signupWidget, enctype) <- generateFormPost signupForm
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
|
setTitle "Eidolon :: Signup"
|
||||||
$(widgetFile "signup")
|
$(widgetFile "signup")
|
||||||
|
|
||||||
postSignupR :: Handler Html
|
postSignupR :: Handler Html
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
module Handler.Tag where
|
module Handler.Tag where
|
||||||
|
|
||||||
import Import
|
import Import
|
||||||
|
import qualified Data.Text as T
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
|
|
||||||
getTagR :: Text -> Handler Html
|
getTagR :: Text -> Handler Html
|
||||||
|
@ -13,4 +14,5 @@ getTagR tag = do
|
||||||
) tempMedia
|
) tempMedia
|
||||||
media <- return $ removeItem Nothing almostMedia
|
media <- return $ removeItem Nothing almostMedia
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
|
setTitle $ toHtml ("Eidolon :: Tag " `T.append` tag)
|
||||||
$(widgetFile "tagMedia")
|
$(widgetFile "tagMedia")
|
||||||
|
|
|
@ -2,7 +2,7 @@ module Handler.Upload where
|
||||||
|
|
||||||
import Import as I
|
import Import as I
|
||||||
import Data.Time
|
import Data.Time
|
||||||
import Data.Text
|
import qualified Data.Text as T
|
||||||
import System.FilePath
|
import System.FilePath
|
||||||
|
|
||||||
data TempMedium = TempMedium
|
data TempMedium = TempMedium
|
||||||
|
@ -23,6 +23,7 @@ getUploadR = do
|
||||||
userId <- lift $ pure $ getUserIdFromText tempUserId
|
userId <- lift $ pure $ getUserIdFromText tempUserId
|
||||||
(uploadWidget, enctype) <- generateFormPost (uploadForm userId)
|
(uploadWidget, enctype) <- generateFormPost (uploadForm userId)
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
|
setTitle "Eidolon :: Upload Medium"
|
||||||
$(widgetFile "upload")
|
$(widgetFile "upload")
|
||||||
Nothing -> do
|
Nothing -> do
|
||||||
setMessage "You need to be logged in"
|
setMessage "You need to be logged in"
|
||||||
|
@ -77,6 +78,7 @@ getDirectUploadR albumId = do
|
||||||
True -> do
|
True -> do
|
||||||
(dUploadWidget, enctype) <- generateFormPost $ dUploadForm userId albumId
|
(dUploadWidget, enctype) <- generateFormPost $ dUploadForm userId albumId
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
|
setTitle $ toHtml ("Eidolon :: Upload medium to " `T.append` (albumTitle album))
|
||||||
$(widgetFile "dUpload")
|
$(widgetFile "dUpload")
|
||||||
False -> do
|
False -> do
|
||||||
setMessage "You must own this album to upload"
|
setMessage "You must own this album to upload"
|
||||||
|
@ -138,9 +140,9 @@ writeOnDrive :: FileInfo -> UserId -> AlbumId -> Handler FilePath
|
||||||
writeOnDrive file userId albumId = do
|
writeOnDrive file userId albumId = do
|
||||||
filename <- return $ fileName file
|
filename <- return $ fileName file
|
||||||
path <- return $ "static" </> "data"
|
path <- return $ "static" </> "data"
|
||||||
</> (unpack $ extractKey userId)
|
</> (T.unpack $ extractKey userId)
|
||||||
</> (unpack $ extractKey albumId)
|
</> (T.unpack $ extractKey albumId)
|
||||||
</> (unpack filename)
|
</> (T.unpack filename)
|
||||||
liftIO $ fileMove file path
|
liftIO $ fileMove file path
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue