Show creation date in group page

This commit is contained in:
fr33domlover 2016-05-25 07:50:10 +00:00
parent b50f892d32
commit b7d443d031
5 changed files with 41 additions and 5 deletions

View file

@ -39,6 +39,7 @@ import Vervis.Foundation
import Vervis.Model
import Vervis.Model.Ident (ShrIdent, shr2text)
import Vervis.Settings (widgetFile)
import Vervis.Time (showDate)
import Vervis.Widget.Sharer (groupLinkW, personLinkW)
getGroupsR :: Handler Html

34
src/Vervis/Time.hs Normal file
View file

@ -0,0 +1,34 @@
{- This file is part of Vervis.
-
- Written in 2016 by fr33domlover <fr33domlover@riseup.net>.
-
- Copying is an act of love. Please copy, reuse and share.
-
- The author(s) have dedicated all copyright and related and neighboring
- rights to this software to the public domain worldwide. This software is
- distributed without any warranty.
-
- You should have received a copy of the CC0 Public Domain Dedication along
- with this software. If not, see
- <http://creativecommons.org/publicdomain/zero/1.0/>.
-}
module Vervis.Time
( showDate
)
where
import Prelude
import Data.Text (Text)
import Data.Time.Calendar (toGregorian)
import Data.Time.Clock (UTCTime (..))
import Formatting (sformat, (%), int, left)
import qualified Data.Text as T (take)
showDate :: UTCTime -> Text
showDate t =
let (y, m, d) = toGregorian $ utctDay t
padded = left 2 '0'
in sformat (int % "-" % padded % "-" % padded) y m d

View file

@ -35,6 +35,7 @@ import Data.Revision.Local
import Development.DarcsRev (darcsTotalPatches, darcsRevision)
import Vervis.Settings (widgetFile)
import Vervis.Style
import Vervis.Time (showDate)
breadcrumbsW :: YesodBreadcrumbs site => WidgetT site IO ()
breadcrumbsW = do
@ -43,11 +44,7 @@ breadcrumbsW = do
revisionW :: WidgetT site IO ()
revisionW =
let fmtTime t =
let (y, m, d) = toGregorian $ utctDay t
padded = left 2 '0'
in sformat (int % "-" % padded % "-" % padded) y m d
cgTimeFmt = fmtTime . cgTime
let cgTimeFmt = showDate . cgTime
mrev = $darcsRevision
sharer = "fr33domlover" :: Text
repo = "vervis" :: Text

View file

@ -15,6 +15,9 @@ $# <http://creativecommons.org/publicdomain/zero/1.0/>.
<h2>
#{fromMaybe (shr2text $ sharerIdent group) $ sharerName group}
<p>
Created on #{showDate $ sharerCreated group}.
<p>
Members:

View file

@ -124,6 +124,7 @@ library
Vervis.Ssh
Vervis.Style
Vervis.TicketFilter
Vervis.Time
Vervis.Widget
Vervis.Widget.Discussion
Vervis.Widget.Repo