diff options
-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) |