diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2016-11-11 11:41:26 +0100 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2016-11-11 11:41:26 +0100 |
commit | 62d21db0ea90aec7f653d0cc831d21f534ba638e (patch) | |
tree | b0a0c42c556f058ea4a63733acd5a03b3376b563 /src | |
parent | Simpler format for the logs when the application is running on Heroku. (diff) | |
download | newspipe-62d21db0ea90aec7f653d0cc831d21f534ba638e.tar.gz newspipe-62d21db0ea90aec7f653d0cc831d21f534ba638e.tar.bz2 newspipe-62d21db0ea90aec7f653d0cc831d21f534ba638e.zip |
Added a template for articles of public feeds.
Diffstat (limited to 'src')
-rw-r--r-- | src/web/templates/article_pub.html | 24 | ||||
-rw-r--r-- | src/web/views/article.py | 13 |
2 files changed, 37 insertions, 0 deletions
diff --git a/src/web/templates/article_pub.html b/src/web/templates/article_pub.html new file mode 100644 index 00000000..f9275217 --- /dev/null +++ b/src/web/templates/article_pub.html @@ -0,0 +1,24 @@ +{% extends "layout.html" %} +{% block content %} +<div class="container" data-article="{{ article.id }}"> + <div class="well"> + <h2><a href="{{ article.link }}" target="_blank">{{ article.title|safe }}</a></h2> + <h3>{{ _('from') }} <a href="/feed/{{ article.source.id }}">{{ article.source.title }}</a></h3> + <h6>{{ article.date | datetime }}</h6> + </div> + <div class="well"> + {{ article.content | safe }} + </div> + <div class="well"> + <a href="https://api.pinboard.in/v1/posts/add?url={{ article.link }}&description={{ article.title }}" rel="noreferrer" target="_blank"> + <img src="{{ url_for('static', filename='img/pinboard.png') }}" title="{{ _('Share on') }} Pinboard" /> + </a> + <a href="https://reddit.com/submit?url={{ article.link }}&title={{ article.title }}" rel="noreferrer" target="_blank"> + <img src="{{ url_for('static', filename='img/reddit.png') }}" title="{{ _('Share on') }} reddit" /> + </a> + <a href="https://twitter.com/intent/tweet?url={{ article.link }}&text={{ article.title }}" rel="noreferrer" target="_blank"> + <img src="{{ url_for('static', filename='img/twitter.png') }}" title="{{ _('Share on') }} twitter" > + </a> + </div> +</div><!-- /.container --> +{% endblock %} diff --git a/src/web/views/article.py b/src/web/views/article.py index 572c019e..163ba413 100644 --- a/src/web/views/article.py +++ b/src/web/views/article.py @@ -39,6 +39,19 @@ def article(article_id=None): head_titles=[clear_string(article.title)], article=article) +@article_bp.route('/public/<int:article_id>', methods=['GET']) +@etag_match +def article_pub(article_id=None): + """ + Presents the content of an article of a public feed. + """ + article = ArticleController().get(id=article_id) + if article.source.private: + return render_template('errors/404.html'), 404 + return render_template('article_pub.html', + head_titles=[clear_string(article.title)], + article=article) + @article_bp.route('/like/<int:article_id>', methods=['GET']) @login_required |