handles list privacy in display

This commit is contained in:
Mouse Reeve
2021-01-31 08:41:11 -08:00
parent 69c2b192a4
commit d73a1b4ec1
7 changed files with 79 additions and 58 deletions

View File

@ -0,0 +1,2 @@
<h4><a href="{{ list.local_path }}">{{ list.name }}</a> {% include 'snippets/privacy-icons.html' with item=list %}</h4>
{% include 'snippets/trimmed_text.html' with full=list.description %}

View File

@ -6,18 +6,18 @@
</header>
{% if request.user.is_authenticated %}
<section class="block">
<section class="block content">
<header class="columns">
<div class="column">
<h2 class="title is-3">Your lists</h2>
<h2 class="title">Your lists</h2>
</div>
<div class="column is-narrow">
{% include 'snippets/toggle/open_button.html' with controls_text="create-list" icon="plus" text="Create new list" %}
</div>
</header>
<form name="create-list" method="post" action="{% url 'lists' %}" class="box hiddenx" id="create-list">
<h3 class="title is-4">Create list</h3>
<form name="create-list" method="post" action="{% url 'lists' %}" class="box hidden" id="create-list">
<h3 class="title">Create list</h3>
{% csrf_token %}
<input type="hidden" name="user" value="{{ request.user.id }}">
@ -68,7 +68,7 @@
<ul>
{% for list in request.user.list_set.all %}
<li>
<a href="{{ list.local_path }}">{{ list.name }}</a>
{% include 'lists/list-item.html' with list=list %}
</li>
{% endfor %}
</ul>
@ -77,12 +77,12 @@
{% endif %}
{% if lists.exists %}
<section class="block">
<h2 class="title is-2">Recent Lists</h2>
<section class="block content">
<h2 class="title">Recent Lists</h2>
<ul>
{% for list in lists %}
<li>
<a href="{{ list.local_path }}">{{ list.name }}</a>
{% include 'lists/list-item.html' with list=list %}
</li>
{% endfor %}
</ul>

View File

@ -1,24 +1,26 @@
{% load bookwyrm_tags %}
{% with 0|uuid as uuid %}
{% if full %}
{% with full|to_markdown|safe as full %}
{% with full|to_markdown|safe|truncatewords_html:60 as trimmed %}
{% if trimmed != full %}
<div id="hide-full-{{ uuid }}">
<blockquote class="content" id="trimmed-{{ uuid }}"><span dir="auto">{{ trimmed }}</span>
<div class="content" id="trimmed-{{ uuid }}"><span dir="auto">{{ trimmed }}</span>
{% include 'snippets/toggle/open_button.html' with text="show more" controls_text="full" controls_uid=uuid class="is-small" %}
</blockquote>
</div>
</div>
<div id="full-{{ uuid }}" class="hidden">
<blockquote class="content"><span dir="auto">{{ full | to_markdown | safe }}</span>
<div class="content"><span dir="auto">{{ full }}</span>
{% include 'snippets/toggle/close_button.html' with text="show less" controls_text="full" controls_uid=uuid class="is-small" %}
</blockquote>
</div>
</div>
{% else %}
<blockquote class="content"><span dir="auto">{{ full | to_markdown | safe }}</span></blockquote>
<div class="content"><span dir="auto">{{ full }}</span></div>
{% endif %}
{% endwith %}
{% endwith %}
{% endif %}
{% endwith %}