aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrançois Schmidts <francois.schmidts@gmail.com>2016-01-29 21:08:31 +0100
committerFrançois Schmidts <francois.schmidts@gmail.com>2016-01-29 21:08:31 +0100
commit6d681cba9d4da213d3de727570f17d2361f599de (patch)
treeee33d4f5cecd00688d8650f98da56d558700196f
parentimpact on menus when loading article (diff)
downloadnewspipe-6d681cba9d4da213d3de727570f17d2361f599de.tar.gz
newspipe-6d681cba9d4da213d3de727570f17d2361f599de.tar.bz2
newspipe-6d681cba9d4da213d3de727570f17d2361f599de.zip
displaying date on middle panel
-rw-r--r--package.json18
-rw-r--r--src/web/js/components/MiddlePanel.react.js14
-rw-r--r--src/web/static/css/one-page-app.css6
-rw-r--r--src/web/views/views.py7
4 files changed, 39 insertions, 6 deletions
diff --git a/package.json b/package.json
index c681d70f..01ab12f8 100644
--- a/package.json
+++ b/package.json
@@ -1,11 +1,20 @@
{
"name": "jarr",
"version": "0.0.1",
- "author": {"name": "François Schmidts", "email": "francois.schmidts@gmail.com", "url": "1pxsolidblack.pl"},
+ "author": {
+ "name": "François Schmidts",
+ "email": "francois.schmidts@gmail.com",
+ "url": "1pxsolidblack.pl"
+ },
"description": "jarr (Just Another RSS Reader) is a web-based news aggregator.",
- "repository": {"type": "git", "url": "https://github.com/JARR-aggregator/JARR"},
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/JARR-aggregator/JARR"
+ },
"license": "GNU Affero General Public License version 3",
- "engines": {"npm": "^3.3.12"},
+ "engines": {
+ "npm": "^3.3.12"
+ },
"main": "src/web/js/app.js",
"dependencies": {
"bootstrap": "^3.3.6",
@@ -16,7 +25,8 @@
"object-assign": "^1.0.0",
"react": "^0.14.6",
"react-bootstrap": "^0.14.1",
- "react-dom": "^0.14.6"
+ "react-dom": "^0.14.6",
+ "react-intl": "^1.2.2"
},
"devDependencies": {
"browserify": "^6.2.0",
diff --git a/src/web/js/components/MiddlePanel.react.js b/src/web/js/components/MiddlePanel.react.js
index 0bb0b51b..6b3eb427 100644
--- a/src/web/js/components/MiddlePanel.react.js
+++ b/src/web/js/components/MiddlePanel.react.js
@@ -1,4 +1,7 @@
var React = require('react');
+var ReactIntl = require('react-intl');
+var FormattedRelative = ReactIntl.FormattedRelative;
+
var Row = require('react-bootstrap/Row');
var Button = require('react-bootstrap/Button');
var ButtonGroup = require('react-bootstrap/ButtonGroup');
@@ -9,10 +12,12 @@ var MiddlePanelActions = require('../actions/MiddlePanelActions');
var RightPanelActions = require('../actions/RightPanelActions');
var TableLine = React.createClass({
+ mixins: [ReactIntl.IntlMixin],
propTypes: {article_id: React.PropTypes.number.isRequired,
feed_title: React.PropTypes.string.isRequired,
icon_url: React.PropTypes.string,
title: React.PropTypes.string.isRequired,
+ timestamp: React.PropTypes.number.isRequired,
date: React.PropTypes.string.isRequired,
read: React.PropTypes.bool.isRequired,
selected: React.PropTypes.bool.isRequired,
@@ -42,8 +47,13 @@ var TableLine = React.createClass({
if(this.props.selected) {
clsses += " active";
}
+ // FIXME https://github.com/yahoo/react-intl/issues/189
+ // use FormattedRelative when fixed, will have to upgrade to ReactIntlv2
+ var date = (<time dateTime={this.props.date} title={this.props.date}>
+ {this.formatRelative(this.props.timestamp)}
+ </time>);
return (<div className={clsses} onClick={this.loadArticle}>
- <h5><strong>{title}</strong></h5><div />
+ <h5><strong>{title}</strong></h5>{date}
<div>{read} {liked} {this.props.title}</div>
</div>
);
@@ -219,10 +229,12 @@ var MiddlePanel = React.createClass({
icon_url={article.icon_url}
read={article.read}
liked={article.liked}
+ timestamp={article.timestamp}
date={article.date}
selected={article.selected}
article_id={article.article_id}
feed_id={article.feed_id}
+ locales={['en']}
category_id={article.category_id}
feed_title={article.feed_title} />);})}
</div>
diff --git a/src/web/static/css/one-page-app.css b/src/web/static/css/one-page-app.css
index 45e0440a..9f559ee0 100644
--- a/src/web/static/css/one-page-app.css
+++ b/src/web/static/css/one-page-app.css
@@ -116,6 +116,12 @@
max-height: 22px;
overflow: hidden;
}
+#middle-panel div.list-group-item>time {
+ position: absolute;
+ top: 2px;
+ right: 4px;
+ display: block;
+}
#right-panel>ol{
margin-top: 10px;
}
diff --git a/src/web/views/views.py b/src/web/views/views.py
index 1ee3d06d..49554cb3 100644
--- a/src/web/views/views.py
+++ b/src/web/views/views.py
@@ -284,13 +284,18 @@ def _get_filters(in_dict):
return filters
+import calendar
+
+
def _articles_to_json(articles, fd_hash=None):
return jsonify(**{'articles': [{'title': art.title, 'liked': art.like,
'read': art.readed, 'article_id': art.id, 'selected': False,
'feed_id': art.feed_id, 'category_id': art.category_id or 0,
'feed_title': fd_hash[art.feed_id]['title'] if fd_hash else None,
'icon_url': fd_hash[art.feed_id]['icon_url'] if fd_hash else None,
- 'date': art.date} for art in articles.limit(1000)]})
+ 'date': art.date,
+ 'timestamp': calendar.timegm(art.date.timetuple()) * 1000}
+ for art in articles.limit(1000)]})
@app.route('/middle_panel')
bgstack15