FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
frontend/common/app/model/FaciaDisplayElement.scala at master · devhttps/frontend · GitHub
devhttps
/
frontend
Public
forked from
guardian/frontend
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
frontend
/
common
/
app
/
model
/
FaciaDisplayElement.scala
Copy path
More file actions
More file actions
Latest commit
History
History
History
66 lines (55 loc) · 2.36 KB
Breadcrumbs
frontend
/
common
/
app
/
model
/
FaciaDisplayElement.scala
Copy path
File metadata and controls
66 lines (55 loc) · 2.36 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package
model
import
conf
.
Configuration
import
conf
.
switches
.
Switches
import
implicits
.
FaciaContentFrontendHelpers
.
_
import
layout
.
ItemClasses
import
model
.
pressed
.
PressedContent
import
model
.
content
.
MediaAtom
object
FaciaDisplayElement
{
def
fromFaciaContentAndCardType
(
faciaContent
:
PressedContent
,
itemClasses
:
ItemClasses
)
:
Option
[
FaciaDisplayElement
]
=
{
faciaContent.mainVideo
match
{
case
Some
(videoElement)
if
faciaContent.properties.showMainVideo
=>
Some
(
InlineVideo
(
videoElement,
faciaContent.properties.webTitle,
EndSlateComponents
.fromFaciaContent(faciaContent).toUriPath,
InlineImage
.fromFaciaContent(faciaContent)
))
case
_
if
faciaContent.properties.isCrossword
&&
Switches
.
CrosswordSvgThumbnailsSwitch
.isSwitchedOn
=>
faciaContent.properties.maybeContentId map
CrosswordSvg
case
_
if
faciaContent.properties.imageSlideshowReplace
&&
itemClasses.canShowSlideshow
=>
InlineSlideshow
.fromFaciaContent(faciaContent)
case
_
if
faciaContent.properties.showMainVideo
&&
faciaContent.mainYouTubeMediaAtom.isDefined
=>
Some
(
InlineYouTubeMediaAtom
(faciaContent.mainYouTubeMediaAtom.get, faciaContent.trailPicture))
case
_
=>
InlineImage
.fromFaciaContent(faciaContent)
}
}
}
sealed
trait
FaciaDisplayElement
case
class
InlineVideo
(
videoElement
:
VideoElement
,
title
:
String
,
endSlatePath
:
String
,
fallBack
:
Option
[
InlineImage
]
)
extends
FaciaDisplayElement
case
class
InlineYouTubeMediaAtom
(
youTubeAtom
:
MediaAtom
,
posterImageOverride
:
Option
[
ImageMedia
])
extends
FaciaDisplayElement
object
InlineImage
{
def
fromFaciaContent
(
faciaContent
:
PressedContent
)
:
Option
[
InlineImage
]
=
if
(
!
faciaContent.display.imageHide) {
faciaContent.trailPicture map { picture
=>
InlineImage
(picture)
}
}
else
{
None
}
}
case
class
InlineImage
(
imageMedia
:
ImageMedia
)
extends
FaciaDisplayElement
case
class
CrosswordSvg
(
id
:
String
)
extends
FaciaDisplayElement
{
def
persistenceId
:
String
=
id.stripPrefix(
"
crosswords/
"
)
def
imageUrl
:
String
=
s
"
${
Configuration
.ajax.url}
/
$id
.svg
"
}
object
InlineSlideshow
{
def
fromFaciaContent
(
faciaContent
:
PressedContent
)
:
Option
[
InlineSlideshow
]
=
for
(s
<-
faciaContent.slideshow)
yield
InlineSlideshow
(s)
}
case
class
InlineSlideshow
(
images
:
Iterable
[
FaciaImageElement
])
extends
FaciaDisplayElement
Back
|
FazBrowse Home
|
New Git URL