Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add containerStylingSettings to collection config #330

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions facia-json/src/main/scala/com/gu/facia/client/models/Config.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
Expand Down Expand Up @@ -227,7 +237,7 @@ object CollectionConfigJson {
targetedTerritory: Option[TargetedTerritory] = None,
platform: Option[CollectionPlatform] = None,
frontsToolSettings: Option[FrontsToolSettings] = None,
suppressImages: Option[Boolean] = None
containerStylingSettings: Option[ContainerStylingSettings] = None
): CollectionConfigJson
= CollectionConfigJson(
displayName,
Expand All @@ -251,8 +261,7 @@ object CollectionConfigJson {
targetedTerritory,
platform,
frontsToolSettings,
suppressImages
)
containerStylingSettings)
}

case class CollectionConfigJson(
Expand All @@ -277,7 +286,7 @@ case class CollectionConfigJson(
targetedTerritory: Option[TargetedTerritory],
platform: Option[CollectionPlatform],
frontsToolSettings: Option[FrontsToolSettings],
suppressImages: Option[Boolean]
containerStylingSettings: Option[ContainerStylingSettings]
) {
val collectionType = `type`
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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])

Expand Down Expand Up @@ -35,7 +35,7 @@ case class CollectionConfig(
targetedTerritory: Option[TargetedTerritory],
platform: CollectionPlatform = AnyPlatform,
frontsToolSettings: Option[FrontsToolSettings],
suppressImages: Boolean)
containerStylingSettings: Option[ContainerStylingSettings])

object CollectionConfig {
val DefaultCollectionType = "fixed/small/slow-IV"
Expand All @@ -62,7 +62,8 @@ object CollectionConfig {
targetedTerritory = None,
platform = AnyPlatform,
frontsToolSettings = None,
suppressImages = false)
containerStylingSettings = None
)

def fromCollectionJson(collectionJson: CollectionConfigJson): CollectionConfig =
CollectionConfig(
Expand All @@ -87,5 +88,5 @@ object CollectionConfig {
collectionJson.targetedTerritory,
collectionJson.platform.getOrElse(AnyPlatform),
collectionJson.frontsToolSettings,
collectionJson.suppressImages.exists(identity))
collectionJson.containerStylingSettings)
}
Loading