From 85a0273d209dccedc218c3d794be06ab30d6b909 Mon Sep 17 00:00:00 2001 From: Deimos Date: Mon, 5 Nov 2018 15:36:42 -0700 Subject: [PATCH] Make bookmark page "empty" messages more specific Saying "posts" when the user might have bookmarks of the other type (topics/comments) wasn't quite right, so this just makes it more specific and fixes up the related post_type code a little. --- tildes/tildes/templates/bookmarks.jinja2 | 14 ++++++++++---- tildes/tildes/views/bookmarks.py | 8 ++++++-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/tildes/tildes/templates/bookmarks.jinja2 b/tildes/tildes/templates/bookmarks.jinja2 index 8b77003..59fc2ec 100644 --- a/tildes/tildes/templates/bookmarks.jinja2 +++ b/tildes/tildes/templates/bookmarks.jinja2 @@ -12,10 +12,10 @@
-
  • +
  • Topics
  • -
  • +
  • Comments
  • @@ -35,7 +35,7 @@ {% endfor %} - {% if post_type and (posts.has_prev_page or posts.has_next_page) %} + {% if posts.has_prev_page or posts.has_next_page %} {% endif %} diff --git a/tildes/tildes/views/bookmarks.py b/tildes/tildes/views/bookmarks.py index 9d5e958..22eeb0b 100644 --- a/tildes/tildes/views/bookmarks.py +++ b/tildes/tildes/views/bookmarks.py @@ -17,7 +17,11 @@ from tildes.schemas.listing import PaginatedListingSchema @view_config(route_name="bookmarks", renderer="bookmarks.jinja2") @use_kwargs(PaginatedListingSchema) @use_kwargs( - {"post_type": String(load_from="type", validate=OneOf(("topic", "comment")))} + { + "post_type": String( + load_from="type", validate=OneOf(("topic", "comment")), missing="topic" + ) + } ) def get_bookmarks( request: Request, @@ -35,7 +39,7 @@ def get_bookmarks( if post_type == "comment": post_cls = Comment bookmark_cls = CommentBookmark - else: + elif post_type == "topic": post_cls = Topic bookmark_cls = TopicBookmark