forked from mirrors/bookwyrm
add "Create list" form to group template
This commit is contained in:
parent
f7c6cb3598
commit
1603df0817
4 changed files with 20 additions and 10 deletions
|
@ -11,13 +11,22 @@
|
||||||
{% include 'groups/created_text.html' with group=group %}
|
{% include 'groups/created_text.html' with group=group %}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
{% if request.user == group.user %}
|
||||||
<div class="column is-narrow is-flex">
|
<div class="column is-narrow is-flex">
|
||||||
{% if request.user == group.user %}
|
{% trans "Create List" as button_text %}
|
||||||
{% trans "Edit group" as button_text %}
|
{% include 'snippets/toggle/open_button.html' with controls_text="create_list" icon_with_text="plus" text=button_text focus="create_list_header" %}
|
||||||
{% include 'snippets/toggle/open_button.html' with text=button_text icon_with_text="pencil" controls_text="edit_group" focus="edit_group_header" %}
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="column is-narrow is-flex">
|
||||||
|
{% trans "Edit group" as button_text %}
|
||||||
|
{% include 'snippets/toggle/open_button.html' with text=button_text icon_with_text="pencil" controls_text="edit_group" focus="edit_group_header" %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
</header>
|
</header>
|
||||||
|
{% if request.user.is_authenticated %}
|
||||||
|
<div class="block">
|
||||||
|
{% include 'lists/create_form.html' with controls_text="create_list" curation_group=group %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<div class="block content">
|
<div class="block content">
|
||||||
{% include 'snippets/trimmed_text.html' with full=group.description %}
|
{% include 'snippets/trimmed_text.html' with full=group.description %}
|
||||||
|
|
|
@ -7,6 +7,6 @@
|
||||||
|
|
||||||
{% block form %}
|
{% block form %}
|
||||||
<form name="create-list" method="post" action="{% url 'lists' %}">
|
<form name="create-list" method="post" action="{% url 'lists' %}">
|
||||||
{% include 'lists/form.html' %}
|
{% include 'lists/form.html' with curation_group=group %}
|
||||||
</form>
|
</form>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
<legend class="label">{% trans "List curation:" %}</legend>
|
<legend class="label">{% trans "List curation:" %}</legend>
|
||||||
|
|
||||||
<label class="field" data-hides="list_group_selector">
|
<label class="field" data-hides="list_group_selector">
|
||||||
<input type="radio" name="curation" value="closed"{% if not list or list.curation == 'closed' %} checked{% endif %}> {% trans "Closed" %}
|
<input type="radio" name="curation" value="closed"{% if not curation_group.exists or not list or list.curation == 'closed' %} checked{% endif %}> {% trans "Closed" %}
|
||||||
<p class="help mb-2">{% trans "Only you can add and remove books to this list" %}</p>
|
<p class="help mb-2">{% trans "Only you can add and remove books to this list" %}</p>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
|
@ -34,17 +34,17 @@
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label class="field hidden-form">
|
<label class="field hidden-form">
|
||||||
<input type="radio" name="curation" value="group"{% if list.curation == 'group' %} checked{% endif %} > {% trans "Group" %}
|
<input type="radio" name="curation" value="group"{% if curation_group.id or list.curation == 'group' %} checked{% endif %} > {% trans "Group" %}
|
||||||
<p class="help mb-2">{% trans "Group members can add to and remove from this list" %}</p>
|
<p class="help mb-2">{% trans "Group members can add to and remove from this list" %}</p>
|
||||||
<fieldset class="{% if list.curation != 'group' %}is-hidden{% endif %}" id="list_group_selector">
|
<fieldset class="{% if list.curation != 'group' and not curation_group %}is-hidden{% endif %}" id="list_group_selector">
|
||||||
{% if user.memberships.exists %}
|
{% if user.memberships.exists %}
|
||||||
<label class="label" for="id_group" id="group">{% trans "Select Group" %}</label>
|
<label class="label" for="id_group" id="group">{% trans "Select Group" %}</label>
|
||||||
<div class="field has-addons">
|
<div class="field has-addons">
|
||||||
<div class="select control">
|
<div class="select control">
|
||||||
<select name="group" id="id_group">
|
<select name="group" id="id_group">
|
||||||
<option value="" disabled {% if not list.group %} selected{% endif %}>{% trans "Select a group" %}</option>
|
<option value="" disabled {% if not list.group and not curation_group %} selected{% endif %}>{% trans "Select a group" %}</option>
|
||||||
{% for membership in user.memberships.all %}
|
{% for membership in user.memberships.all %}
|
||||||
<option value="{{ membership.group.id }}" {% if list.group.id == membership.group.id %} selected{% endif %}>{{ membership.group.name }}</option>
|
<option value="{{ membership.group.id }}" {% if list.group.id == membership.group.id or curation_group.id == membership.group.id %} selected{% endif %}>{{ membership.group.name }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -35,6 +35,7 @@ class Group(View):
|
||||||
"group": group,
|
"group": group,
|
||||||
"lists": lists,
|
"lists": lists,
|
||||||
"group_form": forms.GroupForm(instance=group),
|
"group_form": forms.GroupForm(instance=group),
|
||||||
|
"list_form": forms.ListForm(),
|
||||||
"path": "/group",
|
"path": "/group",
|
||||||
}
|
}
|
||||||
return TemplateResponse(request, "groups/group.html", data)
|
return TemplateResponse(request, "groups/group.html", data)
|
||||||
|
|
Loading…
Reference in a new issue