parent
25e74088b8
commit
1b7f57999d
|
@ -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>
|
|
@ -19,46 +19,10 @@
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</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 %}
|
{% if bookmarks.paginator.num_pages > 0 %}
|
||||||
<span>{{ bookmark.resolved_description }}</span>
|
{% bookmark_list bookmarks %}
|
||||||
{% endif %}
|
{% 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>
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
{# Tag list #}
|
{# Tag list #}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>linkdings</title>
|
<title>linkding</title>
|
||||||
{# Include SASS styles, files are resolved from bookmarks/styles #}
|
{# Include SASS styles, files are resolved from bookmarks/styles #}
|
||||||
<link href="{% sass_src 'index.scss' %}" rel="stylesheet" type="text/css"/>
|
<link href="{% sass_src 'index.scss' %}" rel="stylesheet" type="text/css"/>
|
||||||
</head>
|
</head>
|
||||||
|
@ -22,9 +22,9 @@
|
||||||
{% if request.user.is_authenticated %}
|
{% if request.user.is_authenticated %}
|
||||||
<section class="navbar-section">
|
<section class="navbar-section">
|
||||||
<a href="{% url 'bookmarks:new' %}" class="btn btn-primary mr-2">Add bookmark</a>
|
<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="{% url 'bookmarks:bookmarklet' %}" class="btn btn-link">Bookmarklet</a>
|
||||||
<a href="/settings" class="btn btn-link">Settings</a>
|
<a href="{% url 'bookmarks:settings.index' %}" class="btn btn-link">Settings</a>
|
||||||
<a href="/logout" class="btn btn-link">Logout</a>
|
<a href="{% url 'logout' %}" class="btn btn-link">Logout</a>
|
||||||
</section>
|
</section>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</header>
|
</header>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
</div>
|
</div>
|
||||||
<p>Import bookmarks and tags in the Netscape HTML format. This will execute a sync where new bookmarks are
|
<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>
|
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 %}
|
{% csrf_token %}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="input-group col-8 col-sm-12">
|
<div class="input-group col-8 col-sm-12">
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
from django import template
|
from django import template
|
||||||
|
from django.core.paginator import Page
|
||||||
|
|
||||||
from bookmarks.models import BookmarkForm, Tag
|
from bookmarks.models import BookmarkForm, Tag
|
||||||
|
|
||||||
|
@ -45,3 +46,10 @@ def tag_cloud(context, tags: List[Tag]):
|
||||||
return {
|
return {
|
||||||
'groups': groups,
|
'groups': groups,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@register.inclusion_tag('bookmarks/bookmark_list.html', name='bookmark_list', takes_context=True)
|
||||||
|
def bookmark_list(context, bookmarks: Page):
|
||||||
|
return {
|
||||||
|
'bookmarks': bookmarks,
|
||||||
|
}
|
||||||
|
|
|
@ -16,8 +16,8 @@ urlpatterns = [
|
||||||
path('bookmarks/<int:bookmark_id>/remove', views.bookmarks.remove, name='remove'),
|
path('bookmarks/<int:bookmark_id>/remove', views.bookmarks.remove, name='remove'),
|
||||||
path('bookmarklet', views.bookmarks.bookmarklet, name='bookmarklet'),
|
path('bookmarklet', views.bookmarks.bookmarklet, name='bookmarklet'),
|
||||||
# Settings
|
# Settings
|
||||||
path('settings', views.settings.index, name='settings_index'),
|
path('settings', views.settings.index, name='settings.index'),
|
||||||
path('settings/import', views.settings.bookmark_import, name='settings_import'),
|
path('settings/import', views.settings.bookmark_import, name='settings.import'),
|
||||||
# API
|
# API
|
||||||
path('api/website_metadata', views.api.website_metadata, name='api.website_metadata'),
|
path('api/website_metadata', views.api.website_metadata, name='api.website_metadata'),
|
||||||
]
|
]
|
||||||
|
|
|
@ -26,7 +26,7 @@ def bookmark_import(request):
|
||||||
messages.error(request, 'An error occurred during bookmark import.', 'bookmark_import')
|
messages.error(request, 'An error occurred during bookmark import.', 'bookmark_import')
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return HttpResponseRedirect(reverse('bookmarks:settings_index'))
|
return HttpResponseRedirect(reverse('bookmarks:settings.index'))
|
||||||
|
|
||||||
|
|
||||||
def _find_message_with_tag(messages, tag):
|
def _find_message_with_tag(messages, tag):
|
||||||
|
|
Loading…
Reference in New Issue