| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 706d6e3 commit 8bb7546
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -167,6 +167,7 @@ object PressedCardHeader { | |||
| 167 | 167 | kicker = FaciaContentUtils.itemKicker(content).map(ItemKicker.make), | |
| 168 | 168 | headline = FaciaContentUtils.headline(content), | |
| 169 | 169 | isVideo = FaciaContentUtils.isVideo(content), | |
| 170 | + isComment = FaciaContentUtils.isComment(content), | ||
| 170 | 171 | isAudio = FaciaContentUtils.isAudio(content), | |
| 171 | 172 | isGallery = FaciaContentUtils.isGallery(content), | |
| 172 | 173 | seriesOrBlogKicker = capiContent.flatMap(item => | |
@@ -178,6 +179,7 @@ object PressedCardHeader { | |||
| 178 | 179 | ||
| 179 | 180 | final case class PressedCardHeader( | |
| 180 | 181 | isVideo: Boolean, | |
| 182 | + isComment: Boolean, | ||
| 181 | 183 | isGallery: Boolean, | |
| 182 | 184 | isAudio: Boolean, | |
| 183 | 185 | kicker: Option[ItemKicker], | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,9 +1,8 @@ | |||
| 1 | 1 | package views.support | |
| 2 | 2 | ||
| 3 | - import com.gu.facia.api.models.{CuratedContent, FaciaContent} | ||
| 4 | 3 | import model.facia.PressedCollection | |
| 4 | + import model.pressed.{CuratedContent, PressedContent} | ||
| 5 | 5 | import play.api.libs.json._ | |
| 6 | - import implicits.FaciaContentImplicits._ | ||
| 7 | 6 | ||
| 8 | 7 | object FaciaToMicroFormat2Helpers { | |
| 9 | 8 | def getCollection(pressedCollection: PressedCollection): JsValue = | |
@@ -14,25 +13,25 @@ object FaciaToMicroFormat2Helpers { | |||
| 14 | 13 | "showContent" -> pressedCollection.curatedPlusBackfillDeduplicated.nonEmpty, | |
| 15 | 14 | "content" -> pressedCollection.curatedPlusBackfillDeduplicated.take(8).map(isCuratedContent)) | |
| 16 | 15 | ||
| 17 | - def isCuratedContent(content: FaciaContent): JsValue = content match { | ||
| 16 | + def isCuratedContent(content: PressedContent): JsValue = content match { | ||
| 18 | 17 | case c: CuratedContent => getContent(c) | |
| 19 | 18 | case _ => Json.obj() | |
| 20 | 19 | } | |
| 21 | 20 | ||
| 22 | 21 | private def getContent(content: CuratedContent): JsValue = | |
| 23 | 22 | JsObject( | |
| 24 | 23 | Json.obj( | |
| 25 | - "headline" -> content.headline, | ||
| 26 | - "trailText" -> content.trailText, | ||
| 27 | - "url" -> content.href, | ||
| 28 | - "thumbnail" -> content.maybeContent.flatMap(_.safeFields.get("thumbnail")), | ||
| 29 | - "id" -> content.maybeContent.map(_.id), | ||
| 30 | - "frontPublicationDate" -> content.maybeFrontPublicationDate, | ||
| 31 | - "byline" -> content.byline, | ||
| 32 | - "isComment" -> content.isComment, | ||
| 33 | - "isVideo" -> content.isVideo, | ||
| 34 | - "isAudio" -> content.isAudio, | ||
| 35 | - "isGallery" -> content.isGallery, | ||
| 24 | + "headline" -> content.header.headline, | ||
| 25 | + "trailText" -> content.card.trailText, | ||
| 26 | + "url" -> content.properties.href, | ||
| 27 | + "thumbnail" -> content.properties.maybeContent.flatMap(_.trail.thumbnailPath), | ||
| 28 | + "id" -> content.properties.maybeContent.map(_.metadata.id), | ||
| 29 | + "frontPublicationDate" -> content.properties.maybeFrontPublicationDate, | ||
| 30 | + "byline" -> content.properties.byline, | ||
| 31 | + "isComment" -> content.header.isComment, | ||
| 32 | + "isVideo" -> content.header.isVideo, | ||
| 33 | + "isAudio" -> content.header.isAudio, | ||
| 34 | + "isGallery" -> content.header.isGallery, | ||
| 36 | 35 | "toneClass" -> TrailCssClasses.toneClass(content), | |
| 37 | 36 | "showWebPublicationDate" -> false) | |
| 38 | 37 | .fields | |
| Back | FazBrowse Home | New Git URL |
0 commit comments