create group curated lists

This commit is contained in:
Hugh Rundle 2021-09-26 15:56:52 +10:00
parent f3a3ba5f01
commit 8bfc71db6e
4 changed files with 37 additions and 9 deletions

View file

@ -11,15 +11,13 @@
{% include "groups/members.html" %} {% include "groups/members.html" %}
<h2 class="heading">Lists</h2> <h2 class="heading">Lists</h2>
{% if not group.lists.exists %} {% if not lists %}
<p>{% trans "This group has no lists" %}</p> <p>{% trans "This group has no lists" %}</p>
{% else %} {% else %}
<ul start="{{ lists.start_index }}" class="ordered-list">
{% for list in group.lists.all %}
<li class="block mb-5">
<div class="columns is-multiline"> <div class="columns is-multiline">
{% for list in lists %} {% for list in lists %}
<div class="column is-one-quarter"> <div class="column is-one-third">
<div class="card is-stretchable"> <div class="card is-stretchable">
<header class="card-header"> <header class="card-header">
<h4 class="card-header-title"> <h4 class="card-header-title">
@ -55,9 +53,8 @@
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
</li>
{% endfor %}
</ul>
{% endif %} {% endif %}
{% include "snippets/pagination.html" with page=items %} {% include "snippets/pagination.html" with page=items %}
</section> </section>

View file

@ -1,5 +1,6 @@
{% load i18n %} {% load i18n %}
{% csrf_token %} {% csrf_token %}
{% load utilities %}
<input type="hidden" name="user" value="{{ request.user.id }}"> <input type="hidden" name="user" value="{{ request.user.id }}">
<div class="columns"> <div class="columns">
@ -31,6 +32,35 @@
<input type="radio" name="curation" value="open"{% if list.curation == 'open' %} checked{% endif %}> {% trans "Open" %} <input type="radio" name="curation" value="open"{% if list.curation == 'open' %} checked{% endif %}> {% trans "Open" %}
<p class="help mb-2">{% trans "Anyone can add books to this list" %}</p> <p class="help mb-2">{% trans "Anyone can add books to this list" %}</p>
</label> </label>
<label class="field">
<input type="radio" name="curation" value="group"{% if list.curation == 'group' %} checked{% endif %}> {% trans "Group" %}
<p class="help mb-2">{% trans "Group members can add to and remove from this list" %}</p>
</label>
<!-- TODO: add a list picker on-select for group lists -->
<!-- TODO: change the submission url -->
<!-- <form name="list-add" method="post" action="{% url 'list-add-book' %}"> -->
{% if user_groups %}
{% csrf_token %}
<label class="label" for="id_group">{% trans "Select Group" %}</label>
<div class="field has-addons">
<div class="select control">
<select name="group" id="id_group">
<option value="{{ group.id }}" disabled selected></option>
{% for group in user_groups %}
<option value="{{ group.id }}">{{ group.name }}</option>
{% endfor %}
</select>
</div>
</div>
{% else %}
{% with user|username as username %}
{% url 'user-groups' user|username as url %}
<div>{% trans "You must create a " %}<a href="{{ url }}">{% trans "Group" %}</a>{% trans " before you can create Group lists!" %}</div>
{% endwith %}
{% endif %}
</fieldset> </fieldset>
</div> </div>
</div> </div>

View file

@ -25,7 +25,7 @@
</div> </div>
<div class="block"> <div class="block">
{% include 'lists/edit_form.html' with controls_text="edit_list" %} {% include 'lists/edit_form.html' with controls_text="edit_list" user_groups=user_groups %}
</div> </div>
{% block panel %}{% endblock %} {% block panel %}{% endblock %}

View file

@ -75,6 +75,7 @@
<a href="{{ url }}">{% trans "Lists" %}</a> <a href="{{ url }}">{% trans "Lists" %}</a>
</li> </li>
{% endif %} {% endif %}
<!-- TODO: fix this: user.groups_set isn't what you think! -->
{% if is_self or user.groups_set.exists %} {% if is_self or user.groups_set.exists %}
{% url 'user-groups' user|username as url %} {% url 'user-groups' user|username as url %}
<li{% if url in request.path %} class="is-active"{% endif %}> <li{% if url in request.path %} class="is-active"{% endif %}>