Show correct timezone
Timezone is for now converted to django's TIME_ZONE setting for all users
This commit is contained in:
parent
9ad6a1a7b8
commit
ffefc76acc
7 changed files with 23 additions and 18 deletions
|
|
@ -23,6 +23,7 @@ class App extends React.Component {
|
|||
feedUrl={this.props.feedUrl}
|
||||
subredditUrl={this.props.subredditUrl}
|
||||
timelineUrl={this.props.timelineUrl}
|
||||
timezone={this.props.timezone}
|
||||
/>
|
||||
|
||||
{this.props.error && (
|
||||
|
|
@ -38,6 +39,7 @@ class App extends React.Component {
|
|||
subredditUrl={this.props.subredditUrl}
|
||||
timelineUrl={this.props.timelineUrl}
|
||||
categoriesUrl={this.props.categoriesUrl}
|
||||
timezone={this.props.timezone}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
|
|
|
|||
|
|
@ -72,7 +72,9 @@ class PostModal extends React.Component {
|
|||
<div className="post__header">
|
||||
<h2 className={titleClassName}>{`${post.title} `}</h2>
|
||||
<div className="post__meta-info">
|
||||
<span className="post__date">{publicationDate}</span>
|
||||
<span className="post__date">
|
||||
{publicationDate} {this.props.timezone}
|
||||
</span>
|
||||
{post.author && <span className="post__author">{post.author}</span>}
|
||||
{this.props.category && (
|
||||
<span className="badge post__category" title={this.props.category.name}>
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class PostItem extends React.Component {
|
|||
|
||||
<div className="posts-info">
|
||||
<span className="posts-info__date" title={publicationDate}>
|
||||
{publicationDate} {post.author && `By ${post.author}`}
|
||||
{publicationDate} {this.props.timezone} {post.author && `By ${post.author}`}
|
||||
</span>
|
||||
{this.props.selected.type == CATEGORY_TYPE && (
|
||||
<span className="badge">
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ class PostList extends React.Component {
|
|||
feedUrl={this.props.feedUrl}
|
||||
subredditUrl={this.props.subredditUrl}
|
||||
timelineUrl={this.props.timelineUrl}
|
||||
timezone={this.props.timezone}
|
||||
/>
|
||||
);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -11,10 +11,8 @@ const page = document.getElementById('homepage--page');
|
|||
if (page) {
|
||||
const store = configureStore();
|
||||
|
||||
let feedUrl = document.getElementById('feedUrl').textContent;
|
||||
let subredditUrl = document.getElementById('subredditUrl').textContent;
|
||||
let timelineUrl = document.getElementById('timelineUrl').textContent;
|
||||
let categoriesUrl = document.getElementById('categoriesUrl').textContent;
|
||||
const settings = JSON.parse(document.getElementById('homepageSettings').textContent);
|
||||
const { feedUrl, subredditUrl, timelineUrl, categoriesUrl } = settings;
|
||||
|
||||
ReactDOM.render(
|
||||
<Provider store={store}>
|
||||
|
|
@ -23,6 +21,7 @@ if (page) {
|
|||
subredditUrl={subredditUrl.substring(1, subredditUrl.length - 4)}
|
||||
timelineUrl={timelineUrl.substring(1, timelineUrl.length - 4)}
|
||||
categoriesUrl={categoriesUrl.substring(1, categoriesUrl.length - 4)}
|
||||
timezone={settings.timezone}
|
||||
/>
|
||||
</Provider>,
|
||||
page
|
||||
|
|
|
|||
|
|
@ -6,10 +6,7 @@
|
|||
{% endblock content %}
|
||||
|
||||
{% block scripts %}
|
||||
{{ feed_url|json_script:"feedUrl" }}
|
||||
{{ subreddit_url|json_script:"subredditUrl" }}
|
||||
{{ twitter_timeline_url|json_script:"timelineUrl" }}
|
||||
{{ categories_url|json_script:"categoriesUrl" }}
|
||||
{{ homepageSettings|json_script:"homepageSettings" }}
|
||||
|
||||
{{ block.super }}
|
||||
{% endblock scripts %}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
from django.conf import settings
|
||||
from django.urls import reverse_lazy
|
||||
from django.views.generic.base import TemplateView
|
||||
from django.views.generic.edit import CreateView, UpdateView
|
||||
|
|
@ -16,14 +17,17 @@ class NewsView(TemplateView):
|
|||
|
||||
return {
|
||||
**context,
|
||||
"feed_url": reverse_lazy("news:collection:feed-update", args=(0,)),
|
||||
"subreddit_url": reverse_lazy(
|
||||
"news:collection:subreddit-update", args=(0,)
|
||||
),
|
||||
"twitter_timeline_url": reverse_lazy(
|
||||
"news:collection:twitter-timeline-update", args=(0,)
|
||||
),
|
||||
"categories_url": reverse_lazy("news:core:category-update", args=(0,)),
|
||||
"homepageSettings": {
|
||||
"feedUrl": reverse_lazy("news:collection:feed-update", args=(0,)),
|
||||
"subredditUrl": reverse_lazy(
|
||||
"news:collection:subreddit-update", args=(0,)
|
||||
),
|
||||
"timelineUrl": reverse_lazy(
|
||||
"news:collection:twitter-timeline-update", args=(0,)
|
||||
),
|
||||
"categoriesUrl": reverse_lazy("news:core:category-update", args=(0,)),
|
||||
"timezone": settings.TIME_ZONE,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue