moving to frontend. done

This commit is contained in:
nek0 2016-12-19 01:45:06 +01:00
parent 52a35fd114
commit fb067ae2ba
4 changed files with 27 additions and 3 deletions

View file

@ -56,8 +56,10 @@ getMediumR mediumId = do
, CommentParent !=. Nothing ] , CommentParent !=. Nothing ]
[ Desc CommentTime ] [ Desc CommentTime ]
let tr = StaticR $ StaticRoute (drop 2 $ map T.pack $ splitDirectories $ mediumThumb medium) [] let tr = StaticR $ StaticRoute (drop 2 $ map T.pack $ splitDirectories $ mediumThumb medium) []
let pr = StaticR $ StaticRoute (drop 2 $ map T.pack $ splitDirectories $ mediumPreview medium) [] pr = StaticR $ StaticRoute (drop 2 $ map T.pack $ splitDirectories $ mediumPreview medium) []
let ir = StaticR $ StaticRoute (drop 2 $ map T.pack $ splitDirectories $ mediumPath medium) [] ir = StaticR $ StaticRoute (drop 2 $ map T.pack $ splitDirectories $ mediumPath medium) []
lic = T.pack $ show (toEnum (mediumLicence medium) :: Licence)
link = url (toEnum (mediumLicence medium) :: Licence)
defaultLayout $ do defaultLayout $ do
setTitle $ toHtml ("Eidolon :: Medium " `T.append` (mediumTitle medium)) setTitle $ toHtml ("Eidolon :: Medium " `T.append` (mediumTitle medium))
rssLink (CommentFeedRssR mediumId) $ "Comment feed of medium " `T.append` mediumTitle medium rssLink (CommentFeedRssR mediumId) $ "Comment feed of medium " `T.append` mediumTitle medium

View file

@ -51,6 +51,7 @@ postMediumSettingsR mediumId = do
[ MediumTitle =. mediumTitle temp [ MediumTitle =. mediumTitle temp
, MediumDescription =. mediumDescription temp , MediumDescription =. mediumDescription temp
, MediumTags =. mediumTags temp , MediumTags =. mediumTags temp
, MediumLicence =. mediumLicence temp
] ]
setMessage "Medium settings changed succesfully" setMessage "Medium settings changed succesfully"
redirect $ MediumR mediumId redirect $ MediumR mediumId

View file

@ -28,6 +28,9 @@ import qualified System.FilePath as FP
share [mkPersist sqlSettings, mkMigrate "migrateAll"] share [mkPersist sqlSettings, mkMigrate "migrateAll"]
$(persistFileWith lowerCaseSettings "config/models") $(persistFileWith lowerCaseSettings "config/models")
class ShowUrl a where
url :: a -> Maybe String
data Licence data Licence
= AllRightsReserved = AllRightsReserved
| CC0 | CC0
@ -39,7 +42,19 @@ data Licence
| CCByNcNd4 | CCByNcNd4
| PublicDomain | PublicDomain
instance ShowUrl Licence where
url PublicDomain = Nothing
url AllRightsReserved = Nothing
url CC0 = Just "https://creativecommons.org/publicdomain/zero/1.0/"
url CCBy4 = Just "https://creativecommons.org/licenses/by/4.0"
url CCBySa4 = Just "https://creativecommons.org/licenses/by-sa/4.0"
url CCByNd4 = Just "https://creativecommons.org/licenses/by-nd/4.0"
url CCByNc4 = Just "https://creativecommons.org/licenses/by-nc/4.0"
url CCByNcSa4 = Just "https://creativecommons.org/licenses/by-nc-sa/4.0"
url CCByNcNd4 = Just "https://creativecommons.org/licenses/by-nc-nd/4.0"
instance Show Licence where instance Show Licence where
show PublicDomain = "Public Domain"
show AllRightsReserved = "All rights reserved" show AllRightsReserved = "All rights reserved"
show CC0 = "CC0 1.0" show CC0 = "CC0 1.0"
show CCBy4 = "CC-BY 4.0 International" show CCBy4 = "CC-BY 4.0 International"
@ -48,7 +63,6 @@ instance Show Licence where
show CCByNc4 = "CC-BY-NC 4.0 International" show CCByNc4 = "CC-BY-NC 4.0 International"
show CCByNcSa4 = "CC-BY-NC-SA 4.0 International" show CCByNcSa4 = "CC-BY-NC-SA 4.0 International"
show CCByNcNd4 = "CC-BY-NC-ND 4.0 International" show CCByNcNd4 = "CC-BY-NC-ND 4.0 International"
show PublicDomain = "Public Domain"
instance Enum Licence where instance Enum Licence where
fromEnum PublicDomain = -2 fromEnum PublicDomain = -2

View file

@ -11,6 +11,13 @@
<img src=@{pr} title=#{mediumTitle medium}> <img src=@{pr} title=#{mediumTitle medium}>
<div .medium> <div .medium>
<p>
Licence:
<p>
$maybe thing <- link
<a href=#{thing}>#{lic}
$nothing
#{lic}
<p> <p>
Uploaded on: #{formatTime defaultTimeLocale "%A %F %H:%M" (mediumTime medium)}<br> Uploaded on: #{formatTime defaultTimeLocale "%A %F %H:%M" (mediumTime medium)}<br>
$maybe d <- mediumDescription medium $maybe d <- mediumDescription medium