From bf970db8013f5942ae97ad1f32b774a4c34f8080 Mon Sep 17 00:00:00 2001 From: Danielle McLean Date: Mon, 16 Oct 2017 08:29:21 +1100 Subject: [PATCH] Add an optional photo field to entries, which becomes a card-topping u-photo when displayed --- .gitignore | 1 + config/models | 1 + src/Widget/Entry.hs | 1 + templates/mf2/h-entry.hamlet | 2 ++ 4 files changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index 6d57f64..df5f33f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ dist* static/tmp/ static/combined/ +static/uploads/ config/client_session_key.aes *.hi *.o diff --git a/config/models b/config/models index c19a960..7e6ec9a 100644 --- a/config/models +++ b/config/models @@ -29,6 +29,7 @@ Entry kind EntryKind maxlen=255 name Text Maybe maxlen=255 content Markdown sqltype=longtext + photo Text Maybe maxlen=190 published UTCTime updated UTCTime authorId UserId diff --git a/src/Widget/Entry.hs b/src/Widget/Entry.hs index 4743ee3..ba02577 100644 --- a/src/Widget/Entry.hs +++ b/src/Widget/Entry.hs @@ -10,6 +10,7 @@ import Database.Esqueleto ( (^.) ) import qualified Database.Esqueleto as E import Data.Time.Format ( defaultTimeLocale, formatTime, iso8601DateFormat ) import Data.Time.Format.Human ( humanReadableTime ) +import Model.Entry ( entryTitle ) import Web.Slug ( mkSlug ) data FormattedTime = FormattedTime diff --git a/templates/mf2/h-entry.hamlet b/templates/mf2/h-entry.hamlet index 66494a3..5e9f3a8 100644 --- a/templates/mf2/h-entry.hamlet +++ b/templates/mf2/h-entry.hamlet @@ -1,4 +1,6 @@
+ $maybe photo <- entryPhoto entry + #{entryTitle
$maybe name <- entryName entry

#{name}