From e17ee08ca6d62e7573b076f7dafb2cce2d3ec2d5 Mon Sep 17 00:00:00 2001 From: Tom Raithel Date: Mon, 27 Nov 2017 09:07:15 +0100 Subject: [PATCH] Fix 'featured' flag to ignore items on the homepage --- README.md | 3 +++ common/model.js | 2 +- common/radar.js | 10 +++++++++- radar/2017-10-01/typo3-as-a-framework.md | 3 +++ 4 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 radar/2017-10-01/typo3-as-a-framework.md diff --git a/README.md b/README.md index f41f76e..ebfc69e 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,9 @@ Following front-matter attributes are possible: * **ring**: Ring section in radar. One of `trial`, `assess`, `adopt`, `hold` * **info**: (optional) A short textual description of the item (visible in overview pages) +* **featured**: (optional, default "true") If you set this to `false`, the item + will not be visibile on the homepage anymore but still available in the radar + overview. The name of the .md file acts as item identifier and may overwrite items with the same name from older releases. diff --git a/common/model.js b/common/model.js index 54d739e..c1eb75d 100644 --- a/common/model.js +++ b/common/model.js @@ -1,4 +1,4 @@ -export const featuredOnly = items => items.filter(item => item.isFeatured); +export const featuredOnly = items => items.filter(item => item.featured); export const groupByQuadrants = items => items.reduce( diff --git a/common/radar.js b/common/radar.js index 62a2046..217efa4 100644 --- a/common/radar.js +++ b/common/radar.js @@ -113,10 +113,17 @@ const createItems = revisions => { return Object.values(itemMap).sort((x, y) => (x.name > y.name ? 1 : -1)); }; +const ignoreEmptyRevisionBody = (revision, item) => { + if (!revision.body || revision.body.trim() === '') { + return item.body; + } + return revision.body; +}; + const addRevisionToItem = ( item = { flag: 'default', - isFeatured: true, + featured: true, revisions: [], }, revision, @@ -125,6 +132,7 @@ const addRevisionToItem = ( let newItem = { ...item, ...rest, + body: ignoreEmptyRevisionBody(rest, item), attributes: { ...item.attributes, ...revision.attributes, diff --git a/radar/2017-10-01/typo3-as-a-framework.md b/radar/2017-10-01/typo3-as-a-framework.md new file mode 100644 index 0000000..d9c72fa --- /dev/null +++ b/radar/2017-10-01/typo3-as-a-framework.md @@ -0,0 +1,3 @@ +--- +featured: false +---