Skip to content

Commit

Permalink
Merge pull request #317 from superdesk/master
Browse files Browse the repository at this point in the history
add: updated at to content list items, tooltip with hour
  • Loading branch information
tomaszrondio authored Feb 19, 2021
2 parents 7212326 + 23fab1c commit 2855811
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ exports[`ContentLists/Automatic/ArticleItem renders correctly 1`] = `
<span
class="sd-overflow-ellipsis sd-list-item--element-grow"
>
2017-07-26
<time
flow="right"
sd-tooltip="15:43"
title="2017-07-26T15:43:33+02:00"
>
2017-07-26
</time>
</span>
<span
class="label"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ exports[`ContentLists/Manual/ArticleItem renders correctly with extras 1`] = `
<span
class="sd-overflow-ellipsis sd-list-item--element-grow"
>
2017-07-26
<time
flow="right"
sd-tooltip="15:43"
title="2017-07-26T15:43:33+02:00"
>
2017-07-26
</time>
</span>
<span
class="label label--success label--hollow"
Expand Down Expand Up @@ -89,7 +95,13 @@ exports[`ContentLists/Manual/ArticleItem renders correctly without extras 1`] =
<span
class="sd-overflow-ellipsis sd-list-item--element-grow"
>
2017-07-26
<time
flow="right"
sd-tooltip="15:43"
title="2017-07-26T15:43:33+02:00"
>
2017-07-26
</time>
</span>
<span
class="label label--success label--hollow"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,13 @@ exports[`ContentLists/Manual/Manual renders properly 1`] = `
<span
class="sd-overflow-ellipsis sd-list-item--element-grow"
>
2019-12-28
<time
flow="right"
sd-tooltip="12:09"
title="2019-12-28T12:09:32+01:00"
>
2019-12-28
</time>
</span>
<span
class="label label--success label--hollow"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@ exports[`Output/ArticleItem renders correctly 1`] = `
Med test1.3
</span>
<time
flow="right"
sd-tooltip="2020–01–01T12:00:00+00:00"
title="2020–01–01T12:00:00+00:00"
>
2020–01–01T12:00:00+00:00
</time>
<time
flow="right"
sd-tooltip="2020–01–01T12:00:00+00:00"
title="2020–01–01T12:00:00+00:00"
>
(updated at:
Expand Down
19 changes: 18 additions & 1 deletion client/components/ContentLists/Automatic/ArticleItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,24 @@ const ArticleItem = ({
</div>
<div className="sd-list-item__row">
<span className="sd-overflow-ellipsis sd-list-item--element-grow">
{moment(item.content.published_at).format("YYYY-MM-DD")}
<time
title={moment(item.content.published_at).format()}
sd-tooltip={moment(item.content.published_at).format("HH:mm")}
flow="right"
>
{moment(item.content.published_at).format("YYYY-MM-DD")}
</time>
{item.content.updated_at &&
item.content.updated_at !== item.content.published_at ? (
<time
title={moment(item.content.updated_at).format()}
sd-tooltip={moment(item.content.updated_at).format("HH:mm")}
flow="right"
>
(updated at:{" "}
{moment(item.content.updated_at).format("YYYY-MM-DD")})
</time>
) : null}
</span>
<span
className={classNames("label", {
Expand Down
18 changes: 17 additions & 1 deletion client/components/ContentLists/Manual/ArticleItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,24 @@ const ArticleItem = ({
</div>
<div className="sd-list-item__row">
<span className="sd-overflow-ellipsis sd-list-item--element-grow">
{moment(item.published_at).format("YYYY-MM-DD")}
<time
title={moment(item.published_at).format()}
sd-tooltip={moment(item.published_at).format("HH:mm")}
flow="right"
>
{moment(item.published_at).format("YYYY-MM-DD")}
</time>
{item.updated_at && item.updated_at !== item.published_at ? (
<time
title={moment(item.updated_at).format()}
sd-tooltip={moment(item.updated_at).format("HH:mm")}
flow="right"
>
(updated at: {moment(item.updated_at).format("YYYY-MM-DD")})
</time>
) : null}
</span>

<Label
text={item.route && item.route.name}
type="success"
Expand Down
14 changes: 11 additions & 3 deletions client/components/Output/ArticleItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,19 @@ const ArticleItem = ({ item, style, onRemove }) => {
{item.headline}
</span>

<time title={moment(item.created_at).format()}>
<time
title={moment(item.created_at).format()}
sd-tooltip={moment(item.created_at).format("HH:mm")}
flow="right"
>
{moment(item.created_at).format("YYYY-MM-DD")}
</time>
{item.updated_at ? (
<time title={moment(item.updated_at).format()}>
{item.updated_at && item.updated_at !== item.created_at ? (
<time
title={moment(item.updated_at).format()}
sd-tooltip={moment(item.updated_at).format("HH:mm")}
flow="right"
>
(updated at: {moment(item.updated_at).format("YYYY-MM-DD")})
</time>
) : null}
Expand Down

0 comments on commit 2855811

Please sign in to comment.