diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/web/static/css/customized-bootstrap.css | 5 | ||||
-rw-r--r-- | src/web/templates/bookmarks.html | 12 | ||||
-rw-r--r-- | src/web/views/bookmark.py | 20 |
3 files changed, 33 insertions, 4 deletions
diff --git a/src/web/static/css/customized-bootstrap.css b/src/web/static/css/customized-bootstrap.css index 7760e90a..c385c908 100644 --- a/src/web/static/css/customized-bootstrap.css +++ b/src/web/static/css/customized-bootstrap.css @@ -48,3 +48,8 @@ a { display: block; z-index: 1001; } + +/*customization for Flask-Paginate*/ +.pagination-page-info { + display: inline; +} diff --git a/src/web/templates/bookmarks.html b/src/web/templates/bookmarks.html index 39528322..ee93253c 100644 --- a/src/web/templates/bookmarks.html +++ b/src/web/templates/bookmarks.html @@ -1,7 +1,17 @@ {% extends "layout.html" %} {% block content %} <div class="container"> - {{ pagination.info }} + <div class="row"> + <div class="col-md-6"> + {{ pagination.info }} + </div> + <div class="col-md-6 text-right"> + <a class="text-muted" href="{{ url_for('bookmarks.list_') }}">all</a> ⸱ + <a class="text-muted" href="{{ url_for('bookmarks.list_') + 'private' }}">private</a> ⸱ + <a class="text-muted" href="{{ url_for('bookmarks.list_') + 'public' }}">public</a> ⸱ + <a class="text-muted" href="{{ url_for('bookmarks.list_') + 'unread' }}">unread</a> + </div> + </div> {{ pagination.links }} <ul class="list-group"> {% for bookmark in bookmarks %} diff --git a/src/web/views/bookmark.py b/src/web/views/bookmark.py index 9263b49f..841d7364 100644 --- a/src/web/views/bookmark.py +++ b/src/web/views/bookmark.py @@ -49,15 +49,29 @@ bookmark_bp = Blueprint('bookmark', __name__, url_prefix='/bookmark') @bookmarks_bp.route('/', defaults={'per_page': '50'}, methods=['GET']) -def list_(per_page): +@bookmarks_bp.route('/<string:status>', defaults={'per_page': '50'}, + methods=['GET']) +def list_(per_page, status='all'): "Lists the bookmarks." head_titles = [gettext("Bookmarks")] if current_user.is_authenticated: # query for the bookmarks of the authenticated user - bookmark_query = BookmarkController(current_user.id).read() + filters = {} + if status == 'public': + filters['shared'] = True + elif status == 'private': + filters['shared'] = False + else: + # no filter + pass + if status == 'unread': + filters['to_read'] = True + else: + pass + bookmark_query = BookmarkController(current_user.id).read(**filters) else: - # shared bookmarks of all users + # query for the shared bookmarks (of all users) bookmark_query = BookmarkController().read(**{'shared': True}) bookmarks = bookmark_query.order_by(desc('time')) |