avatar deletion now possible

This commit is contained in:
nek0 2015-04-16 03:12:05 +02:00
parent fc83ae87df
commit ccb1278bd1
6 changed files with 38 additions and 2 deletions

View file

@ -1,7 +1,6 @@
module Handler.Avatar where
import Import
import Data.Conduit
import Data.Conduit.Binary
import qualified Data.ByteString as B
import qualified Data.ByteString.Lazy as L
@ -113,3 +112,15 @@ getGetAvatarR :: AvatarId -> Handler TypedContent
getGetAvatarR aId = do
avatar <- runDB $ get404 aId
return $ TypedContent typePng $ toContent $ avatarData avatar
getAvatarDeleteR :: AvatarId -> Handler Html
getAvatarDeleteR aId = do
ma <- runDB $ get aId
case ma of
Just _ -> do
runDB $ delete aId
setMessageI MsgAvatarDeleted
redirect $ HomeR
Nothing -> do
setMessageI MsgAvatarUnknown
redirect $ AvatarR

View file

@ -28,4 +28,5 @@
/avatars AvatarR GET
/avatar/#AvatarId GetAvatarR GET
/avatar/#AvatarId/modify ModifyAvatarR GET POST
/avatar/#AvatarId/delete AvatarDeleteR GET
/newavatar NewAvatarR GET POST

View file

@ -84,5 +84,15 @@ NegativeRecharge: Nelze nabít negativní obnos
Increment: ++
Decrement: --
SelectAvatar: Vyber avatar
Avatars: Avatary
NoAvatars: žádné avatary
ModifyAvatar: Modify avatar
AvatarUnknown: Avatar neznámý
AvatarUpdateSuccessfull: Aktualizace avataru se zdařila
AvatarIdent: Jméno avataru
AvatarFileChange: Zadej soubor k změnně avataru
AvatarFile: Soubor avataru
NewAvatar: Nový avatar
AvatarUploadSuccessfull: Avatar úspěšně nahrán
DeleteAvatar: Smazat avatar
AvatarDeleted: Avatar úspěšně smazán

View file

@ -89,8 +89,10 @@ NoAvatars: Keine Avatare
ModifyAvatar: Avatar bearbeiten
AvatarUnknown: Unbekannter Avatar
AvatarUpdateSuccessfull: Avatar erfolgreich aktualisiert
AvatarIdent: Avtarname
AvatarIdent: Avatarname
AvatarFileChange: Datei auswählen um Avatar zu ändern
AvatarFile: Datei für den Avatar
NewAvatar: Neuer Avatar
AvatarUploadSuccessfull: Avatar erfolgreich hochgeladen
DeleteAvatar: Diesen Avatar löschen
AvatarDeleted: Avatar gelöscht

View file

@ -84,5 +84,15 @@ NegativeRecharge: You can not recharge negative amounts
Increment: ++
Decrement: --
SelectAvatar: Select avatar
Avatars: Avatars
NoAvatars: No avatars
ModifyAvatar: Modify avatar
AvatarUnknown: Avatar unknown
AvatarUpdateSuccessfull: Avatar update successfull
AvatarIdent: Avatar name
AvatarFileChange: Enter file to change this avatar
AvatarFile: Avatar file
NewAvatar: New avatar
AvatarUploadSuccessfull: Avatar upload successfull
DeleteAvatar: Delete avatar
AvatarDeleted: Avatar successfully deleted

View file

@ -6,3 +6,5 @@ $doctype 5
^{avatarModifyWidget}
<div>
<input type=submit value=_{MsgSubmit}>
<a href=@{AvatarDeleteR aId}>_{MsgDeleteAvatar}