Display date_added in bookmark list (#85)

* Display date_added in bookmark list (#85)

* Allow switching between different types of date formats

* Improve date formatting

* Use pluralize

* Fix comment

* Fix styles

Co-authored-by: Sascha Ißbrücker <sissbruecker@lyska.io>
This commit is contained in:
Sascha Ißbrücker
2021-03-31 09:08:19 +02:00
committed by GitHub
parent 8dd1575dc6
commit 7a68a4abed
15 changed files with 226 additions and 9 deletions

View File

@@ -26,6 +26,14 @@
{% endif %}
</div>
<div class="actions">
{% if request.user.profile.bookmark_date_display == 'relative' %}
<span class="text-gray text-sm">{{ bookmark.date_added|humanize_relative_date }}</span>
<span class="text-gray text-sm">|</span>
{% endif %}
{% if request.user.profile.bookmark_date_display == 'absolute' %}
<span class="text-gray text-sm">{{ bookmark.date_added|humanize_absolute_date }}</span>
<span class="text-gray text-sm">|</span>
{% endif %}
<a href="{% url 'bookmarks:edit' bookmark.id %}?return_url={{ return_url }}"
class="btn btn-link btn-sm">Edit</a>
{% if bookmark.is_archived %}
@@ -44,4 +52,4 @@
<div class="bookmark-pagination">
{% pagination bookmarks %}
</div>
</div>

View File

@@ -15,6 +15,10 @@
<label for="{{ form.theme.id_for_label }}" class="form-label">Theme</label>
{{ form.theme|add_class:"form-select col-2 col-sm-12" }}
</div>
<div class="form-group">
<label for="{{ form.bookmark_date_display.id_for_label }}" class="form-label">Bookmark date format</label>
{{ form.bookmark_date_display|add_class:"form-select col-2 col-sm-12" }}
</div>
<div class="form-group">
<input type="submit" value="Save" class="btn btn-primary mt-2">
</div>