diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2017-05-23 21:24:04 +0200 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2017-05-23 21:24:04 +0200 |
commit | ec30925914fba06ba73a748d745c1a7356f2e53d (patch) | |
tree | 31063d7fff39852b16dc70d529eddb8c0dd737e4 | |
parent | Fixed conflicts. (diff) | |
download | newspipe-ec30925914fba06ba73a748d745c1a7356f2e53d.tar.gz newspipe-ec30925914fba06ba73a748d745c1a7356f2e53d.tar.bz2 newspipe-ec30925914fba06ba73a748d745c1a7356f2e53d.zip |
Improved display of bookmark's tags. And fixed some remainings merge related bugs.
-rwxr-xr-x | src/runserver.py | 2 | ||||
-rw-r--r-- | src/web/models/__init__.py | 7 | ||||
-rw-r--r-- | src/web/models/article.py | 8 | ||||
-rw-r--r-- | src/web/templates/bookmarks.html | 13 | ||||
-rw-r--r-- | src/web/views/__init__.py | 3 | ||||
-rw-r--r-- | src/web/views/bookmark.py | 2 |
6 files changed, 24 insertions, 11 deletions
diff --git a/src/runserver.py b/src/runserver.py index 1099b483..ff4fe444 100755 --- a/src/runserver.py +++ b/src/runserver.py @@ -56,6 +56,8 @@ with application.app_context(): application.register_blueprint(views.admin_bp) application.register_blueprint(views.users_bp) application.register_blueprint(views.user_bp) + application.register_blueprint(views.bookmarks_bp) + application.register_blueprint(views.bookmark_bp) if __name__ == '__main__': diff --git a/src/web/models/__init__.py b/src/web/models/__init__.py index 1fc0c3e0..45bfb096 100644 --- a/src/web/models/__init__.py +++ b/src/web/models/__init__.py @@ -32,9 +32,12 @@ from .user import User from .article import Article from .icon import Icon from .category import Category -from .tag import Tag +from .tag import BookmarkTag +from .tag import ArticleTag +from .bookmark import Bookmark -__all__ = ['Feed', 'Role', 'User', 'Article', 'Icon', 'Category', 'Tag'] +__all__ = ['Feed', 'Role', 'User', 'Article', 'Icon', 'Category', + 'Bookmark', 'ArticleTag', 'BookmarkTag'] import os diff --git a/src/web/models/article.py b/src/web/models/article.py index 87ad1a9a..f5ef619e 100644 --- a/src/web/models/article.py +++ b/src/web/models/article.py @@ -52,10 +52,10 @@ class Article(db.Model, RightMixin): category_id = db.Column(db.Integer(), db.ForeignKey('category.id')) # relationships - tag_objs = db.relationship('Tag', back_populates='article', - cascade='all,delete-orphan', - lazy=False, - foreign_keys='[Tag.article_id]') + tag_objs = db.relationship('ArticleTag', back_populates='article', + cascade='all,delete-orphan', + lazy=False, + foreign_keys='[ArticleTag.article_id]') tags = association_proxy('tag_objs', 'text') # index diff --git a/src/web/templates/bookmarks.html b/src/web/templates/bookmarks.html index 3e65d2c0..40a7e7b9 100644 --- a/src/web/templates/bookmarks.html +++ b/src/web/templates/bookmarks.html @@ -5,9 +5,16 @@ <ul class="list-group"> {% for bookmark in bookmarks %} <li class="list-group-item"> - <a href="{{ bookmark.href }}">{{ bookmark.href }}</a> - <a href="{{ bookmark.href }}">{{ bookmark.tags_proxy }}</a> - <a href="{{ url_for('bookmark.form', bookmark_id=bookmark.id) }}">edit</a> + <a href="#"> + <h4 class="list-group-item-heading"> + <a href="{{ bookmark.href }}">{{ bookmark.title }}</a> + </h4> + <p class="list-group-item-text"> + {{ bookmark.description }}<br /> + {{ ", ".join(bookmark.tags_proxy) }} + <a href="{{ url_for('bookmark.form', bookmark_id=bookmark.id) }}">edit</a> + </p> + </a> </li> {% endfor %} </ul> diff --git a/src/web/views/__init__.py b/src/web/views/__init__.py index e0e49927..41bb52f3 100644 --- a/src/web/views/__init__.py +++ b/src/web/views/__init__.py @@ -6,11 +6,12 @@ from web.views.category import category_bp, categories_bp from web.views.icon import icon_bp from web.views.admin import admin_bp from web.views.user import user_bp, users_bp +from web.views.bookmark import bookmark_bp, bookmarks_bp __all__ = ['views', 'home', 'session_mgmt', 'v2', 'v3', 'article_bp', 'articles_bp', 'feed_bp', 'feeds_bp', 'category_bp', 'categories_bp', 'icon_bp', - 'admin_bp', 'user_bp', 'users_bp'] + 'admin_bp', 'user_bp', 'users_bp', 'bookmark_bp', 'bookmarks_bp'] import conf from flask import request diff --git a/src/web/views/bookmark.py b/src/web/views/bookmark.py index 64acded4..c3a6e7bd 100644 --- a/src/web/views/bookmark.py +++ b/src/web/views/bookmark.py @@ -38,7 +38,7 @@ def form(bookmark_id=None): action = gettext('Edit bookmark') head_titles = [action] form = BookmarkForm(obj=bookmark) - form.tags.data = bookmark.tags_proxy + form.tags.data = ", ".join(bookmark.tags_proxy) return render_template('edit_bookmark.html', action=action, head_titles=head_titles, bookmark=bookmark, form=form) |