Improve URL handling

Extract bookmark list tag
This commit is contained in:
Sascha Ißbrücker
2019-07-06 17:17:14 +02:00
parent 25e74088b8
commit 1b7f57999d
7 changed files with 59 additions and 47 deletions

View File

@@ -0,0 +1,40 @@
<ul class="bookmark-list">
{% for bookmark in bookmarks %}
<li>
<div class="title truncate">
<a href="{{ bookmark.url }}" target="_blank">{{ bookmark.resolved_title }}</a>
</div>
<div class="description truncate">
{% if bookmark.tag_names %}
<span>
{% for tag_name in bookmark.tag_names %}
<a href="?{% append_query_param q=tag_name|hash_tag %}">{{ tag_name|hash_tag }}</a>
{% endfor %}
</span>
{% endif %}
{% if bookmark.tag_names and bookmark.resolved_description %} | {% endif %}
{% if bookmark.resolved_description %}
<span>{{ bookmark.resolved_description }}</span>
{% endif %}
</div>
<div class="actions">
<a href="{% url 'bookmarks:edit' bookmark.id %}"
class="btn btn-link btn-sm">Edit</a>
<a href="{% url 'bookmarks:remove' bookmark.id %}"
class="btn btn-link btn-sm"
onclick="return confirm('Do you really want to delete this bookmark?')">Remove</a>
</div>
</li>
{% endfor %}
</ul>
<div class="pagination">
{% if bookmarks.has_next %}
<a href="?{% update_query_string page=bookmarks.next_page_number %}"
class="btn mr-2">< Older</a>
{% endif %}
{% if bookmarks.has_previous %}
<a href="?{% update_query_string page=bookmarks.previous_page_number %}"
class="btn">Newer ></a>
{% endif %}
</div>

View File

@@ -19,46 +19,10 @@
</form>
</div>
</div>
<ul class="bookmark-list">
{% for bookmark in bookmarks %}
<li>
<div class="title truncate">
<a href="{{ bookmark.url }}" target="_blank">{{ bookmark.resolved_title }}</a>
</div>
<div class="description truncate">
{% if bookmark.tag_names %}
<span>
{% for tag_name in bookmark.tag_names %}
<a href="?{% append_query_param q=tag_name|hash_tag %}">{{ tag_name|hash_tag }}</a>
{% endfor %}
</span>
{% endif %}
{% if bookmark.tag_names and bookmark.resolved_description %} | {% endif %}
{% if bookmark.resolved_description %}
<span>{{ bookmark.resolved_description }}</span>
{% endif %}
</div>
<div class="actions">
<a href="{% url 'bookmarks:edit' bookmark.id %}"
class="btn btn-link btn-sm">Edit</a>
<a href="{% url 'bookmarks:remove' bookmark.id %}"
class="btn btn-link btn-sm"
onclick="return confirm('Do you really want to delete this bookmark?')">Remove</a>
</div>
</li>
{% endfor %}
</ul>
<div class="pagination">
{% if bookmarks.has_next %}
<a href="?{% update_query_string page=bookmarks.next_page_number %}"
class="btn mr-2">< Older</a>
{% endif %}
{% if bookmarks.has_previous %}
<a href="?{% update_query_string page=bookmarks.previous_page_number %}"
class="btn">Newer ></a>
{% endif %}
</div>
{% if bookmarks.paginator.num_pages > 0 %}
{% bookmark_list bookmarks %}
{% endif %}
</section>
{# Tag list #}

View File

@@ -5,7 +5,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>linkdings</title>
<title>linkding</title>
{# Include SASS styles, files are resolved from bookmarks/styles #}
<link href="{% sass_src 'index.scss' %}" rel="stylesheet" type="text/css"/>
</head>
@@ -22,9 +22,9 @@
{% if request.user.is_authenticated %}
<section class="navbar-section">
<a href="{% url 'bookmarks:new' %}" class="btn btn-primary mr-2">Add bookmark</a>
<a href="/bookmarklet" class="btn btn-link">Bookmarklet</a>
<a href="/settings" class="btn btn-link">Settings</a>
<a href="/logout" class="btn btn-link">Logout</a>
<a href="{% url 'bookmarks:bookmarklet' %}" class="btn btn-link">Bookmarklet</a>
<a href="{% url 'bookmarks:settings.index' %}" class="btn btn-link">Settings</a>
<a href="{% url 'logout' %}" class="btn btn-link">Logout</a>
</section>
{% endif %}
</header>

View File

@@ -10,7 +10,7 @@
</div>
<p>Import bookmarks and tags in the Netscape HTML format. This will execute a sync where new bookmarks are
added and existing ones are updated.</p>
<form method="post" enctype="multipart/form-data" action="{% url 'bookmarks:settings_import' %}">
<form method="post" enctype="multipart/form-data" action="{% url 'bookmarks:settings.import' %}">
{% csrf_token %}
<div class="form-group">
<div class="input-group col-8 col-sm-12">