diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/web/templates/management.html | 20 | ||||
-rw-r--r-- | src/web/views/bookmark.py | 10 | ||||
-rw-r--r-- | src/web/views/user.py | 6 |
3 files changed, 29 insertions, 7 deletions
diff --git a/src/web/templates/management.html b/src/web/templates/management.html index 2f5eda6f..61eafe75 100644 --- a/src/web/templates/management.html +++ b/src/web/templates/management.html @@ -2,11 +2,21 @@ {% block content %} <div class="container"> <div class="well"> - <h1>{{ _('Your subscriptions') }}</h1> - <p>{{ _('You are subscribed to') }} {{ nb_feeds }} <a href="/feeds">{{ _('feeds') }}</a>. <a href="{{ url_for("feed.form") }}">{{ _('Add') }}</a> {{ _('a feed') }}.</p> - <p>{{ nb_articles }} {{ _('articles are stored in the database with') }} {{ nb_unread_articles }} {{ _('unread articles') }}.</p> - <p>{{ _('You have') }} {{ nb_categories }} <a href="{{ url_for("categories.list_")}}">{{ _('categories') }}</a>.</p> - <a href="{{ url_for("articles.expire", weeks=10) }}" class="btn btn-default" onclick="return confirm('{{ _('You are going to delete old articles.') }}');">{{ _('Delete articles older than 10 weeks') }}</a> + <div class="row"> + <div class="col-md-6"> + <h1>{{ _('Your subscriptions') }}</h1> + <p>{{ _('You are subscribed to') }} {{ nb_feeds }} <a href="/feeds">{{ _('feeds') }}</a>. <a href="{{ url_for("feed.form") }}">{{ _('Add') }}</a> {{ _('a feed') }}.</p> + <p>{{ nb_articles }} {{ _('articles are stored in the database with') }} {{ nb_unread_articles }} {{ _('unread articles') }}.</p> + <p>{{ _('You have') }} {{ nb_categories }} <a href="{{ url_for("categories.list_")}}">{{ _('categories') }}</a>.</p> + <a href="{{ url_for("articles.expire", weeks=10) }}" class="btn btn-default" onclick="return confirm('{{ _('You are going to delete old articles.') }}');">{{ _('Delete articles older than 10 weeks') }}</a> + </div> + <div class="col-md-6"> + <h1>{{ _('Your bookmarks') }}</h1> + <p>{{ _('You have') }} {{ nb_bookmarks }} <a href="{{ url_for("bookmarks.list")}}">{{ _('bookmarks') }}</a>.</p> + <a href="{{ url_for("bookmarks.delete_all") }}" class="btn btn-default" onclick="return confirm('{{ _('You are going to delete all bookmarks.') }}');">{{ _('Delete all bookmarks') }}</a> + </div> + </div> + </div> <div class="well"> <h1 id="import">{{ _('OPML import/export') }}</h1> diff --git a/src/web/views/bookmark.py b/src/web/views/bookmark.py index cc43f191..93da0023 100644 --- a/src/web/views/bookmark.py +++ b/src/web/views/bookmark.py @@ -146,6 +146,16 @@ def delete(bookmark_id=None): return redirect(redirect_url()) +@bookmarks_bp.route('/delete', methods=['GET']) +@login_required +def delete_all(): + "Delete all bookmarks." + bookmark = BookmarkController(current_user.id).read().delete() + db.session.commit() + flash(gettext("Bookmarks successfully deleted."), 'success') + return redirect(redirect_url()) + + @bookmark_bp.route('/bookmarklet', methods=['GET', 'POST']) @login_required def bookmarklet(): diff --git a/src/web/views/user.py b/src/web/views/user.py index 34e0b513..6890b0e4 100644 --- a/src/web/views/user.py +++ b/src/web/views/user.py @@ -12,7 +12,7 @@ from lib import misc_utils from lib.data import import_opml, import_json from web.lib.user_utils import confirm_token from web.controllers import (UserController, FeedController, ArticleController, - CategoryController) + CategoryController, BookmarkController) from web.forms import ProfileForm, RecoverPasswordForm @@ -89,10 +89,12 @@ def management(): nb_articles = art_contr.read().count() nb_unread_articles = art_contr.read(readed=False).count() nb_categories = CategoryController(current_user.id).read().count() + nb_bookmarks = BookmarkController(current_user.id).read().count() return render_template('management.html', user=current_user, nb_feeds=nb_feeds, nb_articles=nb_articles, nb_unread_articles=nb_unread_articles, - nb_categories=nb_categories) + nb_categories=nb_categories, + nb_bookmarks=nb_bookmarks) @user_bp.route('/profile', methods=['GET', 'POST']) |