1
0
Fork 0

Adds button to template

This commit is contained in:
Mouse Reeve 2021-08-23 13:02:27 -07:00
parent 457415f874
commit 135fcbd269
4 changed files with 66 additions and 9 deletions

View file

@ -0,0 +1,39 @@
{% load i18n %}
{% load interaction %}
{% if request.user.is_authenticated %}
{% with request.user|bookmarked:list as bookmarked %}
<form
name="bookmark-{{ list.id }}"
action="/"
method="POST"
class="interaction bookmark_{{ list.id }} {% if bookmarked %}is-hidden{% endif %}"
data-id="bookmark_{{ list.id }}"
>
{% csrf_token %}
{% trans "Bookmark" as text %}
<button class="button">
<span class="icon icon-bookmark m-0-mobile" title="{{ text }}"></span>
<span class="is-sr-only-mobile">{{ text }}</span>
</button>
</form>
<form
name="bookmark-{{ list.id }}"
action="/"
method="POST"
class="interaction active bookmark_{{ list.id }} {% if not bookmarked %}is-hidden{% endif %}"
data-id="bookmark_{{ list.id }}"
>
{% csrf_token %}
{% trans "Un-bookmark" as text %}
<button class="button">
<span class="icon icon-bookmark m-0-mobile has-text-primary" title="{{ text }}"></span>
<span class="is-sr-only-mobile">{{ text }}</span>
</button>
</form>
{% endwith %}
{% endif %}

View file

@ -11,12 +11,13 @@
{% include 'lists/created_text.html' with list=list %}
</p>
</div>
{% if request.user == list.user %}
<div class="column is-narrow">
{% trans "Edit List" as button_text %}
{% include 'snippets/toggle/open_button.html' with text=button_text icon_with_text="pencil" controls_text="edit_list" focus="edit_list_header" %}
<div class="column is-narrow is-flex">
{% if request.user == list.user %}
{% trans "Edit List" as button_text %}
{% include 'snippets/toggle/open_button.html' with text=button_text icon_with_text="pencil" controls_text="edit_list" focus="edit_list_header" %}
{% endif %}
{% include "lists/bookmark_button.html" with list=list %}
</div>
{% endif %}
</header>
<div class="block content">