diff --git a/app/assets/stylesheets/views/listings.scss b/app/assets/stylesheets/views/listings.scss
index 20f64b4a8..17e550b94 100644
--- a/app/assets/stylesheets/views/listings.scss
+++ b/app/assets/stylesheets/views/listings.scss
@@ -28,4 +28,10 @@
&__tags {
min-height: var(--su-4);
}
+
+ &__date {
+ font-size: 0.85em;
+ min-height: var(--su-4);
+ color: var(--card-color-tertiary);
+ }
}
diff --git a/app/controllers/concerns/listings_toolkit.rb b/app/controllers/concerns/listings_toolkit.rb
index 52485182f..13de7134a 100644
--- a/app/controllers/concerns/listings_toolkit.rb
+++ b/app/controllers/concerns/listings_toolkit.rb
@@ -100,6 +100,7 @@ module ListingsToolkit
# save the listing
@listing.bumped_at = Time.current
@listing.published = true
+ @listing.originally_published_at = Time.current
# since we can't raise active record errors in this transaction
# due to the fact that we need to display them in the :new view,
diff --git a/app/javascript/listings/__tests__/AllListings.test.jsx b/app/javascript/listings/__tests__/AllListings.test.jsx
index 1e3923e22..898dcfdad 100644
--- a/app/javascript/listings/__tests__/AllListings.test.jsx
+++ b/app/javascript/listings/__tests__/AllListings.test.jsx
@@ -2,6 +2,7 @@ import { h } from 'preact';
import { render } from '@testing-library/preact';
import { axe } from 'jest-axe';
import AllListings from '../components/AllListings';
+import '../../../assets/javascripts/utilities/localDateTime';
const firstListing = {
id: 20,
@@ -85,7 +86,15 @@ const getProps = () => ({
const renderAllListings = () => render();
+/* eslint-disable no-unused-vars */
+/* global globalThis timestampToLocalDateTimeLong timestampToLocalDateTimeShort */
+
describe('', () => {
+ afterAll(() => {
+ delete globalThis.timestampToLocalDateTimeLong;
+ delete globalThis.timestampToLocalDateTimeShort;
+ });
+
it('should have no a11y violations', async () => {
const { container } = renderAllListings();
const results = await axe(container);
diff --git a/app/javascript/listings/__tests__/Modal.test.jsx b/app/javascript/listings/__tests__/Modal.test.jsx
index 37e1a50fd..19a06e27c 100644
--- a/app/javascript/listings/__tests__/Modal.test.jsx
+++ b/app/javascript/listings/__tests__/Modal.test.jsx
@@ -3,7 +3,16 @@ import { render } from '@testing-library/preact';
import { axe } from 'jest-axe';
import Modal from '../components/Modal';
+import '../../../assets/javascripts/utilities/localDateTime';
+
+/* eslint-disable no-unused-vars */
+/* global globalThis timestampToLocalDateTimeLong timestampToLocalDateTimeShort */
describe('', () => {
+ afterAll(() => {
+ delete globalThis.timestampToLocalDateTimeLong;
+ delete globalThis.timestampToLocalDateTimeShort;
+ });
+
const getDefaultListing = () => ({
id: 22,
category: 'misc',
@@ -12,6 +21,8 @@ describe('', () => {
'\u003cp\u003eEius et ullam. Dolores et qui. Quis \u003cstrong\u003equi\u003c/strong\u003e omnis.\u003c/p\u003e\n',
slug: 'illo-iure-quos-perspiciatis-5hk7',
title: 'Illo iure quos perspiciatis.',
+ bumped_at: '2020-09-06T14:15:02.977Z',
+ originally_published_at: '2020-09-06T14:15:02.977Z',
user_id: 7,
tags: ['go', 'git'],
author: {
diff --git a/app/javascript/listings/__tests__/SingleListing.test.jsx b/app/javascript/listings/__tests__/SingleListing.test.jsx
index ee6d1815b..cea8b1e40 100644
--- a/app/javascript/listings/__tests__/SingleListing.test.jsx
+++ b/app/javascript/listings/__tests__/SingleListing.test.jsx
@@ -1,7 +1,9 @@
import { h } from 'preact';
import { axe } from 'jest-axe';
import { render } from '@testing-library/preact';
+import '@testing-library/jest-dom';
+import '../../../assets/javascripts/utilities/localDateTime';
import { SingleListing } from '../singleListing/SingleListing';
const listing = {
@@ -14,6 +16,8 @@ const listing = {
slug: 'illo-iure-quos-perspiciatis-5hk7',
title: 'Illo iure quos perspiciatis.',
user_id: 7,
+ bumped_at: '2020-09-06T14:15:02.977Z',
+ originally_published_at: '2020-09-06T14:15:02.977Z',
tags: ['go', 'git'],
author: {
name: 'Mrs. Yoko Christiansen',
@@ -23,7 +27,15 @@ const listing = {
},
};
+/* eslint-disable no-unused-vars */
+/* global globalThis timestampToLocalDateTimeLong timestampToLocalDateTimeShort */
+
describe('', () => {
+ afterAll(() => {
+ delete globalThis.timestampToLocalDateTimeLong;
+ delete globalThis.timestampToLocalDateTimeShort;
+ });
+
const renderSingleListing = () =>
render(
{
- const { id, user_id: userId, category, slug, title } = listing;
+ const {
+ id,
+ user_id: userId,
+ category,
+ slug,
+ title,
+ bumped_at,
+ originally_published_at,
+ } = listing;
+ const listingDate = bumped_at ? bumped_at : originally_published_at;
+
return (
@@ -19,7 +30,7 @@ const Header = ({ listing, currentUserId, onTitleClick, onAddTag }) => {
{title}
-
+
diff --git a/app/serializers/search/listing_serializer.rb b/app/serializers/search/listing_serializer.rb
index 327ef39de..4ae3ab4e9 100644
--- a/app/serializers/search/listing_serializer.rb
+++ b/app/serializers/search/listing_serializer.rb
@@ -6,6 +6,7 @@ module Search
:category,
:contact_via_connect,
:expires_at,
+ :originally_published_at,
:location,
:processed_html,
:published,
diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb
index 777d41f1e..aa939ef7e 100644
--- a/app/views/layouts/admin.html.erb
+++ b/app/views/layouts/admin.html.erb
@@ -25,8 +25,8 @@
"
+ data-release-footprint="<%= ApplicationConfig["RELEASE_FOOTPRINT"] %>"
data-ga-tracking="<%= SiteConfig.ga_tracking_id %>">
>
diff --git a/app/views/shell/_top.html.erb b/app/views/shell/_top.html.erb
index 6c16ecc6b..23733a678 100644
--- a/app/views/shell/_top.html.erb
+++ b/app/views/shell/_top.html.erb
@@ -55,8 +55,8 @@
class="<%= SiteConfig.default_font.tr("_", "-") %>-article-body"
data-pusher-key="<%= ApplicationConfig["PUSHER_KEY"] %>"
data-app-name="<%= ApplicationConfig["APP_NAME"] %>"
- data-honybadger-key="<%= ApplicationConfig['HONEYBADGER_JS_API_KEY'] %>"
- data-release-footprint="<%= ApplicationConfig['RELEASE_FOOTPRINT'] %>"
+ data-honybadger-key="<%= ApplicationConfig["HONEYBADGER_JS_API_KEY"] %>"
+ data-release-footprint="<%= ApplicationConfig["RELEASE_FOOTPRINT"] %>"
data-ga-tracking="<%= SiteConfig.ga_tracking_id %>">