From 03a785abc2a2c6771007d83b20be05a52534ac21 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Tue, 10 Jul 2018 13:47:02 +0200 Subject: [PATCH] Fix PathPiece for ZIPArchiveName & submission original archive link --- src/Model/Types.hs | 9 +++------ templates/submission.hamlet | 3 ++- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Model/Types.hs b/src/Model/Types.hs index 64be64f45..8a2b908d7 100644 --- a/src/Model/Types.hs +++ b/src/Model/Types.hs @@ -285,15 +285,12 @@ instance Default Theme where derivePersistField "Theme" -newtype ZIPArchiveName obj = ZIPArchiveName obj +newtype ZIPArchiveName obj = ZIPArchiveName { unZIPArchiveName :: obj } deriving (Show, Read, Eq) instance PathPiece obj => PathPiece (ZIPArchiveName obj) where - fromPathPiece (map CI.mk . unpack -> s) - | Just s' <- stripSuffix (map CI.mk ".zip") s = fromPathPiece . pack $ map CI.original s' - | otherwise = Nothing - - toPathPiece (ZIPArchiveName obj) = toPathPiece obj <> ".zip" + fromPathPiece = fmap ZIPArchiveName . fromPathPiece <=< (stripSuffix `on` CI.foldCase) ".zip" + toPathPiece = (<> ".zip") . toPathPiece . unZIPArchiveName newtype DateTimeFormat = DateTimeFormat { unDateTimeFormat :: String } deriving (Eq, Ord, Read, Show, ToJSON, FromJSON, PersistField, PersistFieldSql) diff --git a/templates/submission.hamlet b/templates/submission.hamlet index 5ebbf522a..1672ee052 100644 --- a/templates/submission.hamlet +++ b/templates/submission.hamlet @@ -1,7 +1,8 @@ $maybe cID <- mcid -
+

Archiv + (Original) $if not (null lastEdits)

_{MsgLastEdits}