diff options
author | François Schmidts <francois.schmidts@gmail.com> | 2016-01-31 16:07:04 +0100 |
---|---|---|
committer | François Schmidts <francois.schmidts@gmail.com> | 2016-01-31 16:07:04 +0100 |
commit | 6a4e5c8626476a3e24e4170b7b1c541ddcc9bbee (patch) | |
tree | 2a1123ad2013c6ecb2cd4a932a1443771dffd34d /src | |
parent | decommissionning old home (diff) | |
download | newspipe-6a4e5c8626476a3e24e4170b7b1c541ddcc9bbee.tar.gz newspipe-6a4e5c8626476a3e24e4170b7b1c541ddcc9bbee.tar.bz2 newspipe-6a4e5c8626476a3e24e4170b7b1c541ddcc9bbee.zip |
right redirect link handling
Diffstat (limited to 'src')
-rw-r--r-- | src/web/js/components/MiddlePanel.react.js | 7 | ||||
-rw-r--r-- | src/web/views/article.py | 5 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/web/js/components/MiddlePanel.react.js b/src/web/js/components/MiddlePanel.react.js index fd291624..eca56541 100644 --- a/src/web/js/components/MiddlePanel.react.js +++ b/src/web/js/components/MiddlePanel.react.js @@ -35,7 +35,7 @@ var TableLine = React.createClass({ icon = <Glyphicon glyph="ban-circle" />; } var title = (<a href={'/article/redirect/' + this.props.article_id} - onClick={this.stopPropagation}> + onClick={this.openRedirectLink}> {icon} {this.props.feed_title} </a>); var read = (<Glyphicon glyph={this.state.read?"check":"unchecked"} @@ -56,6 +56,11 @@ var TableLine = React.createClass({ </div> ); }, + openRedirectLink: function(evnt) { + if(!this.state.read) { + this.toogleRead(evnt); + } + }, toogleRead: function(evnt) { this.setState({read: !this.state.read}, function() { MiddlePanelActions.changeRead(this.props.category_id, diff --git a/src/web/views/article.py b/src/web/views/article.py index 664b66c8..5b04fe7a 100644 --- a/src/web/views/article.py +++ b/src/web/views/article.py @@ -17,7 +17,10 @@ article_bp = Blueprint('article', __name__, url_prefix='/article') @article_bp.route('/redirect/<int:article_id>', methods=['GET']) @login_required def redirect_to_article(article_id): - article = ArticleController(g.user.id).get(id=article_id) + contr = ArticleController(g.user.id) + article = contr.get(id=article_id) + if not article.readed: + contr.update({'id': article.id}, {'readed': True}) return redirect(article.link) |