From 488327324ab2f65fa8e0bc49a1d13efb505bba21 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Sat, 27 Oct 2018 00:34:08 +0200 Subject: Filter feeds per category on the user profile page. --- src/web/templates/feed_list_per_categories.html | 54 +++++++++++++++++++++++++ src/web/templates/profile_public.html | 2 +- src/web/views/user.py | 6 ++- 3 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 src/web/templates/feed_list_per_categories.html (limited to 'src') diff --git a/src/web/templates/feed_list_per_categories.html b/src/web/templates/feed_list_per_categories.html new file mode 100644 index 00000000..4b0e517e --- /dev/null +++ b/src/web/templates/feed_list_per_categories.html @@ -0,0 +1,54 @@ +
+
+
+
+ + + +
+
+
+
+ +
+ +{% if feeds | length != 0 %} +
+ + + + + + + + + + {% for feed in feeds %} + + + + + + {% endfor %} + +
#{{ _('Title') }}{{ _('Site') }}
{{ loop.index }}{% if feed.icon_url %} {% endif %} {{ feed.title }}{{ feed.site_link }}
+
+ +{% endif %} diff --git a/src/web/templates/profile_public.html b/src/web/templates/profile_public.html index 9198acea..e30ae300 100644 --- a/src/web/templates/profile_public.html +++ b/src/web/templates/profile_public.html @@ -38,7 +38,7 @@

{{ _('Feeds') }}

- {% include "feed_list_simple.html" %} + {% include "feed_list_per_categories.html" %}
diff --git a/src/web/views/user.py b/src/web/views/user.py index 1460c708..c9c23ca7 100644 --- a/src/web/views/user.py +++ b/src/web/views/user.py @@ -25,6 +25,7 @@ def profile_public(nickname=None): """ Display the public profile of the user. """ + category_id = int(request.args.get('category_id', 0)) user_contr = UserController() user = user_contr.get(nickname=nickname) if not user.is_public_profile: @@ -34,6 +35,8 @@ def profile_public(nickname=None): filters = {} filters['private'] = False + if category_id: + filters['category_id'] = category_id feeds = FeedController(user.id).read(**filters).all() """word_size = 6 @@ -43,7 +46,8 @@ def profile_public(nickname=None): top_words = misc_utils.top_words(articles, n=50, size=int(word_size)) tag_cloud = misc_utils.tag_cloud(top_words)""" - return render_template('profile_public.html', user=user, feeds=feeds) + return render_template('profile_public.html', user=user, feeds=feeds, + selected_category_id=category_id) @user_bp.route('/management', methods=['GET', 'POST']) -- cgit