diff options
author | François Schmidts <francois.schmidts@gmail.com> | 2015-04-11 16:14:19 +0200 |
---|---|---|
committer | François Schmidts <francois.schmidts@gmail.com> | 2015-04-12 14:31:06 +0200 |
commit | 21da20f5d592aabcb60096768dcac76baa626315 (patch) | |
tree | f5381a80073726450be90acae594369ef01b982d /pyaggr3g470r/views | |
parent | regrouping favorties and home, redoing the tab selection jscode (diff) | |
download | newspipe-21da20f5d592aabcb60096768dcac76baa626315.tar.gz newspipe-21da20f5d592aabcb60096768dcac76baa626315.tar.bz2 newspipe-21da20f5d592aabcb60096768dcac76baa626315.zip |
first take on redoing the menu
Diffstat (limited to 'pyaggr3g470r/views')
-rw-r--r-- | pyaggr3g470r/views/feed.py | 15 | ||||
-rw-r--r-- | pyaggr3g470r/views/views.py | 10 |
2 files changed, 15 insertions, 10 deletions
diff --git a/pyaggr3g470r/views/feed.py b/pyaggr3g470r/views/feed.py index f0e35e4b..e4c0dc9a 100644 --- a/pyaggr3g470r/views/feed.py +++ b/pyaggr3g470r/views/feed.py @@ -112,15 +112,16 @@ def read(feed_id): return redirect(request.referrer or url_for('home')) -@feed_bp.route('/update/<int:feed_id>/<action>', methods=['GET', 'POST']) +@feed_bp.route('/update/<action>/<int:feed_id>', methods=['GET', 'POST']) +@feeds_bp.route('/update/<action>', methods=['GET', 'POST']) @login_required -def update(feed_id, action): +def update(action, feed_id=None): readed = action == 'read' - ArticleController(g.user.id).update({'readed__ne': readed, - 'feed_id': feed_id}, - {'readed': readed}) - flash(gettext('Feed successfully updated.', - feed_title=feed.title), 'success') + filters = {'readed__ne': readed} + if feed_id: + filters['feed_id'] = feed_id + ArticleController(g.user.id).update(filters, {'readed': readed}) + flash(gettext('Feed successfully updated.'), 'success') return redirect(request.referrer or url_for('home')) diff --git a/pyaggr3g470r/views/views.py b/pyaggr3g470r/views/views.py index 623cf5d4..3d3c47f6 100644 --- a/pyaggr3g470r/views/views.py +++ b/pyaggr3g470r/views/views.py @@ -224,13 +224,11 @@ def signup(): return render_template('signup.html', form=form) @app.route('/') -@app.route('/favorites') @login_required -def home(): +def home(favorites=False): """ Home page for connected users. Displays by default unread articles. """ - favorites = request.path.startswith('/favorites') head_title = gettext('Favorites') if favorites else '' feed_contr = FeedController(g.user.id) arti_contr = ArticleController(g.user.id) @@ -271,6 +269,12 @@ def home(): default_max_error = conf.DEFAULT_MAX_ERROR) +@app.route('/favorites') +@login_required +def favorties(): + return home(favorites=True) + + @app.route('/fetch', methods=['GET']) @app.route('/fetch/<int:feed_id>', methods=['GET']) @login_required |