mirror of
https://github.com/aquatix/digimarks.git
synced 2025-12-06 22:05:09 +01:00
Implemented listing of bookmarks
This commit is contained in:
@@ -566,7 +566,10 @@ def get_bookmarks(userkey, filtermethod=None, sortmethod=None):
|
|||||||
@app.route('/<userkey>', methods=['GET', 'POST'])
|
@app.route('/<userkey>', methods=['GET', 'POST'])
|
||||||
@app.route('/<userkey>/filter/<filtermethod>', methods=['GET', 'POST'])
|
@app.route('/<userkey>/filter/<filtermethod>', methods=['GET', 'POST'])
|
||||||
@app.route('/<userkey>/sort/<sortmethod>', methods=['GET', 'POST'])
|
@app.route('/<userkey>/sort/<sortmethod>', methods=['GET', 'POST'])
|
||||||
def bookmarks_page(userkey, filtermethod=None, sortmethod=None):
|
@app.route('/<userkey>/<show_as>', methods=['GET', 'POST'])
|
||||||
|
@app.route('/<userkey>/<show_as>/filter/<filtermethod>', methods=['GET', 'POST'])
|
||||||
|
@app.route('/<userkey>/<show_as>/sort/<sortmethod>', methods=['GET', 'POST'])
|
||||||
|
def bookmarks_page(userkey, filtermethod=None, sortmethod=None, show_as='cards'):
|
||||||
bookmarks, bookmarktags, filter_text, message = get_bookmarks(userkey, filtermethod, sortmethod)
|
bookmarks, bookmarktags, filter_text, message = get_bookmarks(userkey, filtermethod, sortmethod)
|
||||||
theme = get_theme(userkey)
|
theme = get_theme(userkey)
|
||||||
return render_template(
|
return render_template(
|
||||||
@@ -579,6 +582,9 @@ def bookmarks_page(userkey, filtermethod=None, sortmethod=None):
|
|||||||
theme=theme,
|
theme=theme,
|
||||||
editable=True, # bookmarks can be edited
|
editable=True, # bookmarks can be edited
|
||||||
showtags=True, # tags should be shown with the bookmarks
|
showtags=True, # tags should be shown with the bookmarks
|
||||||
|
filtermethod=filtermethod,
|
||||||
|
sortmethod=sortmethod,
|
||||||
|
show_as=show_as, # show list of bookmarks instead of cards
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,16 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% include 'cards.html' %}
|
<div class="row">
|
||||||
|
<div><a href="{{ url_for('bookmarks_page', userkey=userkey, filtermethod=filtermethod, sortmethod=sortmethod, show_as='list') }}">list</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% if show_as and show_as == 'list' %}
|
||||||
|
{% include 'list.html' %}
|
||||||
|
{% else %}
|
||||||
|
{% include 'cards.html' %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<div class="fixed-action-btn" style="bottom: 20px; right: 20px;">
|
<div class="fixed-action-btn" style="bottom: 20px; right: 20px;">
|
||||||
<a class="btn-floating btn-large {{ theme.FAB }}" href="{{ url_for('addbookmark', userkey=userkey) }}">
|
<a class="btn-floating btn-large {{ theme.FAB }}" href="{{ url_for('addbookmark', userkey=userkey) }}">
|
||||||
|
|||||||
62
templates/list.html
Normal file
62
templates/list.html
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
<div class="row">
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th> </th>
|
||||||
|
<th>Bookmark</th>
|
||||||
|
<th>Added</th>
|
||||||
|
{% if showtags %}
|
||||||
|
<th>Tags</th>
|
||||||
|
{% endif %}
|
||||||
|
<th> </th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for bookmark in bookmarks %}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{% if bookmark.favicon %}
|
||||||
|
<img src="{{ url_for('static', filename='favicons/' + bookmark.favicon) }}" class="favicon" />
|
||||||
|
{% else %}
|
||||||
|
<img src="{{ url_for('static', filename='faviconfallback.png') }}" class="favicon" />
|
||||||
|
{% endif %}
|
||||||
|
{% if bookmark.http_status != 200 and bookmark.http_status != 304 %}
|
||||||
|
<i class="small material-icons {{ theme.PROBLEM }}" title="HTTP status {{ bookmark.http_status }}">report_problem</i>
|
||||||
|
{% endif %}
|
||||||
|
{% if bookmark.starred == True %}
|
||||||
|
<i class="small material-icons {{ theme.STAR }}">star</i>
|
||||||
|
{% endif %}
|
||||||
|
{% if bookmark.note %}
|
||||||
|
<i class="small material-icons {{ theme.CARD_TEXT }}" title="{{ bookmark.note|truncate(100) }}">comment</i>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="{{ bookmark.url }}" title="{{ bookmark.url }}" rel="noreferrer noopener" target="_blank">
|
||||||
|
{% if bookmark.title %}
|
||||||
|
{{ bookmark.title }}
|
||||||
|
{% else %}
|
||||||
|
{{ bookmark.get_uri_domain() }} (no title)
|
||||||
|
{% endif %}
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>{{ bookmark.created_date.strftime('%Y-%m-%d %H:%M') }}</td>
|
||||||
|
{% if showtags %}
|
||||||
|
<td>
|
||||||
|
{% for tag in bookmark.tags_list %}
|
||||||
|
<div class="chip">
|
||||||
|
<a href="{{ url_for('tag_page', userkey=userkey, tag=tag) }}">{{ tag }}</a>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</td>
|
||||||
|
{% endif %}
|
||||||
|
<td>
|
||||||
|
{% if editable %}
|
||||||
|
<a href="{{ url_for('editbookmark', userkey=userkey, urlhash=bookmark.url_hash) }}" style="padding: 3px"><i class="tiny material-icons">mode_edit</i> EDIT</a>
|
||||||
|
<a href="{{ url_for('deletingbookmark', userkey=userkey, urlhash=bookmark.url_hash) }}" style="padding: 3px" class="red-text"><i class="tiny material-icons">delete</i> DELETE</a>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
Reference in New Issue
Block a user