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

Overrides #252

Merged
merged 7 commits into from
Jul 31, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
add trail
  • Loading branch information
AWare committed Jul 31, 2019
commit a23e461778d71a69d5a3849b128708fa13ab0845
11 changes: 10 additions & 1 deletion projects/backend/capi/articles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ import { kickerPicker } from './kickerPicker'
import { getBylineImages } from './byline'

type NotInCAPI = 'key'
type OptionalInCAPI = 'kicker' | 'bylineImages'

type OptionalInCAPI = 'kicker' | 'bylineImages' | 'trail'

interface CAPIExtras {
path: string
}
Expand Down Expand Up @@ -65,6 +67,9 @@ const parseArticleResult = async (

const parser = elementParser(path)
const kicker = kickerPicker(result, title)

const trail = result.fields && result.fields.trailText

const byline = result.fields && result.fields.byline
const bylineImages = getBylineImages(result)

Expand Down Expand Up @@ -111,6 +116,7 @@ const parseArticleResult = async (
path: path,
headline: title,
kicker,
trail,
image: maybeImage,
byline: byline || '',
bylineImages,
Expand All @@ -127,6 +133,7 @@ const parseArticleResult = async (
type: 'gallery',
path: path,
headline: title,
trail,
kicker,
image: maybeImage,
byline: byline || '',
Expand Down Expand Up @@ -166,6 +173,7 @@ const parseArticleResult = async (
internalid,
{
type: 'crossword',
trail,
path: path,
headline: title,
byline: byline || '',
Expand All @@ -183,6 +191,7 @@ const parseArticleResult = async (
type: 'article',
path: path,
headline: title,
trail,
kicker,
image: maybeImage,
byline: byline || '',
Expand Down
7 changes: 6 additions & 1 deletion projects/backend/fronts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ export const parseCollection = async (
const headline =
(furniture && furniture.headlineOverride) || article.headline
const trail =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(furniture && furniture.trailTextOverride) || 'article.???' //TODO
(furniture && furniture.trailTextOverride) ||
article.trail ||
''
const byline =
(furniture && furniture.bylineOverride) || 'article.???' //TODO
const showByline = furniture.showByline //TODO
Expand All @@ -82,6 +84,7 @@ export const parseCollection = async (
...article,
...getCrosswordArticleOverrides(article),
key: article.path,
trail,
},
]

Expand All @@ -93,6 +96,7 @@ export const parseCollection = async (
key: article.path,
headline,
kicker,
trail,
},
]

Expand All @@ -104,6 +108,7 @@ export const parseCollection = async (
key: article.path,
headline,
kicker,
trail,
image: imageOverride || article.image,
},
]
Expand Down
1 change: 1 addition & 0 deletions projects/common/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export interface Content extends WithKey {
type: string
headline: string
kicker: string
trail: string
image?: Image
standfirst?: string
byline?: string
Expand Down