aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2016-11-13 17:29:47 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2016-11-13 17:29:47 +0100
commit0408a624a671f06a6ba0122e78b41f48ac2900c6 (patch)
tree73cf32e4aaeba0725d80f84643dec8cf69592ee3 /src
parentUpdated CHANGELOG. (diff)
downloadnewspipe-0408a624a671f06a6ba0122e78b41f48ac2900c6.tar.gz
newspipe-0408a624a671f06a6ba0122e78b41f48ac2900c6.tar.bz2
newspipe-0408a624a671f06a6ba0122e78b41f48ac2900c6.zip
Added page for public feeds.
Diffstat (limited to 'src')
-rw-r--r--src/web/templates/article_pub.html2
-rw-r--r--src/web/templates/feed.html39
-rw-r--r--src/web/templates/popular.html2
-rw-r--r--src/web/views/feed.py32
4 files changed, 60 insertions, 15 deletions
diff --git a/src/web/templates/article_pub.html b/src/web/templates/article_pub.html
index f9275217..e810d18f 100644
--- a/src/web/templates/article_pub.html
+++ b/src/web/templates/article_pub.html
@@ -3,7 +3,7 @@
<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>
+ <h3>{{ _('from') }} <a href="{{ url_for('feed.feed_pub', feed_id=article.source.id) }}">{{ article.source.title }}</a></h3>
<h6>{{ article.date | datetime }}</h6>
</div>
<div class="well">
diff --git a/src/web/templates/feed.html b/src/web/templates/feed.html
index 7a40ca9a..d8dd7f5c 100644
--- a/src/web/templates/feed.html
+++ b/src/web/templates/feed.html
@@ -41,10 +41,41 @@
{% endif %}
</p>
</div>
- <div class="well">
- {% if feed.articles.all()|count != 0 %}
- <div>{{ tag_cloud|safe }}</div>
- {% endif %}
+
+ <div class="row">
+ <div class="col-md-8">
+ <div class="table-responsive">
+ <table id="table-articles" class="table table-striped">
+ <thead>
+ <tr>
+ <th>{{ _('Article') }}</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for article in articles %}
+ <tr>
+ <td><a href="{{ url_for("article.article_pub", article_id=article.id) }}">{{ article.title }}</a></td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+ </div>
+ </div>
+
+
+ <div class="col-md-4">
+ {% if articles | count != 0 %}
+ <div>{{ tag_cloud | safe }}</div>
+ {% endif %}
+ </div>
</div>
+
</div><!-- /.container -->
+<script>
+$(document).ready(function() {
+ $('#table-articles').DataTable( {
+ responsive: true
+ });
+});
+</script>
{% endblock %}
diff --git a/src/web/templates/popular.html b/src/web/templates/popular.html
index b1978bf1..aae50a8c 100644
--- a/src/web/templates/popular.html
+++ b/src/web/templates/popular.html
@@ -13,6 +13,6 @@
<span class="badge">{{ feed[1] }}</span>
</li>
{% endfor %}
-</ul>
+ </ul>
</div><!-- /.container -->
{% endblock %}
diff --git a/src/web/views/feed.py b/src/web/views/feed.py
index 92aef10a..87b47da1 100644
--- a/src/web/views/feed.py
+++ b/src/web/views/feed.py
@@ -34,17 +34,13 @@ def feeds():
article_count=art_contr.count_by_feed())
-@feed_bp.route('/<int:feed_id>', methods=['GET'])
-@login_required
-@etag_match
-def feed(feed_id=None):
- "Presents detailed information about a feed."
- feed = FeedController(current_user.id).get(id=feed_id)
+def feed_view(feed_id=None, user_id=None):
+ feed = FeedController(user_id).get(id=feed_id)
word_size = 6
category = None
if feed.category_id:
- category = CategoryController(current_user.id).get(id=feed.category_id)
- articles = ArticleController(current_user.id) \
+ category = CategoryController(user_id).get(id=feed.category_id)
+ articles = ArticleController(user_id) \
.read(feed_id=feed_id) \
.order_by(desc("date")).all()
top_words = misc_utils.top_words(articles, n=50, size=int(word_size))
@@ -65,12 +61,30 @@ def feed(feed_id=None):
return render_template('feed.html',
head_titles=[utils.clear_string(feed.title)],
- feed=feed, tag_cloud=tag_cloud,
+ feed=feed, articles=articles,
+ tag_cloud=tag_cloud,
first_post_date=first_article,
end_post_date=last_article, category=category,
average=average, delta=delta, elapsed=elapsed)
+@feed_bp.route('/<int:feed_id>', methods=['GET'])
+@login_required
+@etag_match
+def feed(feed_id=None):
+ "Presents detailed information about a feed."
+ return feed_view(feed_id, current_user.id)
+
+
+@feed_bp.route('/public/<int:feed_id>', methods=['GET'])
+@etag_match
+def feed_pub(feed_id=None):
+ """
+ Presents details of a pubic feed.
+ """
+ return feed_view(feed_id, None)
+
+
@feed_bp.route('/delete/<feed_id>', methods=['GET'])
@login_required
def delete(feed_id=None):
bgstack15