From 9149dc57860416dcbdc584314059d6e739762089 Mon Sep 17 00:00:00 2001 From: Charlotte Date: Fri, 18 Oct 2024 16:43:30 +0100 Subject: [PATCH 1/2] add containerStyle and imageAspectRatio fields to collection config --- .../scala/com/gu/facia/client/models/Config.scala | 13 +++++++++---- .../com/gu/facia/api/models/collectionconfig.scala | 12 +++++++++--- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/facia-json/src/main/scala/com/gu/facia/client/models/Config.scala b/facia-json/src/main/scala/com/gu/facia/client/models/Config.scala index 5dceb91b..f69cb6ad 100644 --- a/facia-json/src/main/scala/com/gu/facia/client/models/Config.scala +++ b/facia-json/src/main/scala/com/gu/facia/client/models/Config.scala @@ -227,7 +227,9 @@ object CollectionConfigJson { targetedTerritory: Option[TargetedTerritory] = None, platform: Option[CollectionPlatform] = None, frontsToolSettings: Option[FrontsToolSettings] = None, - suppressImages: Option[Boolean] = None + suppressImages: Option[Boolean] = None, + containerStyle: Option[String] = None, + imageAspectRatio: Option[String] = None ): CollectionConfigJson = CollectionConfigJson( displayName, @@ -251,8 +253,9 @@ object CollectionConfigJson { targetedTerritory, platform, frontsToolSettings, - suppressImages - ) + suppressImages, + containerStyle, + imageAspectRatio) } case class CollectionConfigJson( @@ -277,7 +280,9 @@ case class CollectionConfigJson( targetedTerritory: Option[TargetedTerritory], platform: Option[CollectionPlatform], frontsToolSettings: Option[FrontsToolSettings], - suppressImages: Option[Boolean] + suppressImages: Option[Boolean], + containerStyle: Option[String], + imageAspectRatio: Option[String] ) { val collectionType = `type` } diff --git a/fapi-client/src/main/scala/com/gu/facia/api/models/collectionconfig.scala b/fapi-client/src/main/scala/com/gu/facia/api/models/collectionconfig.scala index 35ee87b5..c92b029b 100644 --- a/fapi-client/src/main/scala/com/gu/facia/api/models/collectionconfig.scala +++ b/fapi-client/src/main/scala/com/gu/facia/api/models/collectionconfig.scala @@ -35,7 +35,9 @@ case class CollectionConfig( targetedTerritory: Option[TargetedTerritory], platform: CollectionPlatform = AnyPlatform, frontsToolSettings: Option[FrontsToolSettings], - suppressImages: Boolean) + suppressImages: Boolean, + containerStyle: Option[String], + imageAspectRatio: Option[String]) object CollectionConfig { val DefaultCollectionType = "fixed/small/slow-IV" @@ -62,7 +64,9 @@ object CollectionConfig { targetedTerritory = None, platform = AnyPlatform, frontsToolSettings = None, - suppressImages = false) + suppressImages = false, + containerStyle = None, + imageAspectRatio = None) def fromCollectionJson(collectionJson: CollectionConfigJson): CollectionConfig = CollectionConfig( @@ -87,5 +91,7 @@ object CollectionConfig { collectionJson.targetedTerritory, collectionJson.platform.getOrElse(AnyPlatform), collectionJson.frontsToolSettings, - collectionJson.suppressImages.exists(identity)) + collectionJson.suppressImages.exists(identity), + collectionJson.containerStyle, + collectionJson.imageAspectRatio) } From f4831d07039daa83526ae5ebb62c981d1172b0f8 Mon Sep 17 00:00:00 2001 From: Georges Lebreton <102960844+Georges-GNM@users.noreply.github.com> Date: Sun, 20 Oct 2024 20:08:00 +0100 Subject: [PATCH 2/2] Add container styling settings class, move suppressImages, containerStyle (renamed as containerLevel) and imageAspectRatio --- .../com/gu/facia/client/models/Config.scala | 22 +++++++++++-------- .../facia/api/models/collectionconfig.scala | 15 +++++-------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/facia-json/src/main/scala/com/gu/facia/client/models/Config.scala b/facia-json/src/main/scala/com/gu/facia/client/models/Config.scala index f69cb6ad..06e77f9b 100644 --- a/facia-json/src/main/scala/com/gu/facia/client/models/Config.scala +++ b/facia-json/src/main/scala/com/gu/facia/client/models/Config.scala @@ -190,10 +190,20 @@ object FrontsToolSettings { implicit val jsonFormat: OFormat[FrontsToolSettings] = Json.format[FrontsToolSettings] } +object ContainerStylingSettings { + implicit val jsonFormat: OFormat[ContainerStylingSettings] = Json.format[ContainerStylingSettings] +} + case class FrontsToolSettings ( displayEditWarning: Option[Boolean] ) +case class ContainerStylingSettings( + suppressImages: Option[Boolean], + containerLevel: Option[String], + imageAspectRatio: Option[String] +) + object DisplayHintsJson { implicit val jsonFormat: OFormat[DisplayHintsJson] = Json.format[DisplayHintsJson] } @@ -227,9 +237,7 @@ object CollectionConfigJson { targetedTerritory: Option[TargetedTerritory] = None, platform: Option[CollectionPlatform] = None, frontsToolSettings: Option[FrontsToolSettings] = None, - suppressImages: Option[Boolean] = None, - containerStyle: Option[String] = None, - imageAspectRatio: Option[String] = None + containerStylingSettings: Option[ContainerStylingSettings] = None ): CollectionConfigJson = CollectionConfigJson( displayName, @@ -253,9 +261,7 @@ object CollectionConfigJson { targetedTerritory, platform, frontsToolSettings, - suppressImages, - containerStyle, - imageAspectRatio) + containerStylingSettings) } case class CollectionConfigJson( @@ -280,9 +286,7 @@ case class CollectionConfigJson( targetedTerritory: Option[TargetedTerritory], platform: Option[CollectionPlatform], frontsToolSettings: Option[FrontsToolSettings], - suppressImages: Option[Boolean], - containerStyle: Option[String], - imageAspectRatio: Option[String] + containerStylingSettings: Option[ContainerStylingSettings] ) { val collectionType = `type` } diff --git a/fapi-client/src/main/scala/com/gu/facia/api/models/collectionconfig.scala b/fapi-client/src/main/scala/com/gu/facia/api/models/collectionconfig.scala index c92b029b..b370ec23 100644 --- a/fapi-client/src/main/scala/com/gu/facia/api/models/collectionconfig.scala +++ b/fapi-client/src/main/scala/com/gu/facia/api/models/collectionconfig.scala @@ -1,6 +1,6 @@ package com.gu.facia.api.models -import com.gu.facia.client.models.{AnyPlatform, Backfill, CollectionConfigJson, CollectionPlatform, DisplayHintsJson, FrontsToolSettings, Metadata, TargetedTerritory} +import com.gu.facia.client.models.{AnyPlatform, Backfill, CollectionConfigJson, CollectionPlatform, DisplayHintsJson, FrontsToolSettings, ContainerStylingSettings, Metadata, TargetedTerritory} case class Groups(groups: List[String]) @@ -35,9 +35,7 @@ case class CollectionConfig( targetedTerritory: Option[TargetedTerritory], platform: CollectionPlatform = AnyPlatform, frontsToolSettings: Option[FrontsToolSettings], - suppressImages: Boolean, - containerStyle: Option[String], - imageAspectRatio: Option[String]) + containerStylingSettings: Option[ContainerStylingSettings]) object CollectionConfig { val DefaultCollectionType = "fixed/small/slow-IV" @@ -64,9 +62,8 @@ object CollectionConfig { targetedTerritory = None, platform = AnyPlatform, frontsToolSettings = None, - suppressImages = false, - containerStyle = None, - imageAspectRatio = None) + containerStylingSettings = None + ) def fromCollectionJson(collectionJson: CollectionConfigJson): CollectionConfig = CollectionConfig( @@ -91,7 +88,5 @@ object CollectionConfig { collectionJson.targetedTerritory, collectionJson.platform.getOrElse(AnyPlatform), collectionJson.frontsToolSettings, - collectionJson.suppressImages.exists(identity), - collectionJson.containerStyle, - collectionJson.imageAspectRatio) + collectionJson.containerStylingSettings) }