mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-25 09:30:33 +00:00
Merge pull request #1735 from bookwyrm-social/lists-markup
Cleans up html on list and list curate page
This commit is contained in:
commit
d60684e08e
9 changed files with 131 additions and 81 deletions
31
bookwyrm/templates/components/new_modal.html
Normal file
31
bookwyrm/templates/components/new_modal.html
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
<div class="modal" id="{{ id }}">
|
||||||
|
<div class="modal-background" data-modal-close></div>
|
||||||
|
<div class="modal-card is-thin" role="dialog" aria-modal="true" tabindex="-1">
|
||||||
|
<header class="modal-card-head">
|
||||||
|
<h2 class="modal-card-title mb-0">
|
||||||
|
{% block modal-title %}{% endblock %}
|
||||||
|
</h2>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="delete"
|
||||||
|
aria-label="{% trans 'Close' %}"
|
||||||
|
data-modal-close
|
||||||
|
></button>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<section class="modal-card-body">
|
||||||
|
{% block modal-body %}{% endblock %}
|
||||||
|
</section>
|
||||||
|
<footer class="modal-card-foot">
|
||||||
|
{% block modal-footer %}{% endblock %}
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="modal-close is-large"
|
||||||
|
aria-label="{% trans 'Close' %}"
|
||||||
|
data-modal-close
|
||||||
|
></button>
|
||||||
|
</div>
|
|
@ -1,72 +1,74 @@
|
||||||
{% extends 'lists/layout.html' %}
|
{% extends 'lists/layout.html' %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
|
{% block breadcrumbs %}
|
||||||
|
<nav class="breadcrumb subtitle" aria-label="breadcrumbs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="{% url 'lists' %}">{% trans "Lists" %}</a></li>
|
||||||
|
<li><a href="{% url 'list' list.id %}">{{ list.name|truncatechars:30 }}</a></li>
|
||||||
|
<li class="is-active">
|
||||||
|
<a href="#" aria-current="page">
|
||||||
|
{% trans "Curate" %}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block panel %}
|
{% block panel %}
|
||||||
|
|
||||||
<section class="block">
|
<section class="block">
|
||||||
<div class="columns is-mobile is-multiline is-align-items-baseline">
|
<h2 class="title is-4">{% trans "Pending Books" %}</h2>
|
||||||
<div class="column is-narrow">
|
|
||||||
<h2 class="title is-4">{% trans "Pending Books" %}</h2>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p class="column is-narrow"><a href="{% url 'list' list.id %}">{% trans "Go to list" %}</a></p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% if not pending.exists %}
|
{% if not pending.exists %}
|
||||||
<p>{% trans "You're all set!" %}</p>
|
<p><em>{% trans "You're all set!" %}</em></p>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
||||||
<dl>
|
<div class="columns">
|
||||||
{% for item in pending %}
|
{% for item in pending %}
|
||||||
{% with book=item.book %}
|
{% with book=item.book %}
|
||||||
<div
|
<div class="column">
|
||||||
class="
|
<div class="columns is-mobile">
|
||||||
columns is-gapless
|
<a
|
||||||
is-vcentered is-justify-content-space-between
|
class="column is-cover"
|
||||||
mb-6
|
href="{{ book.local_path }}"
|
||||||
"
|
aria-hidden="true"
|
||||||
>
|
>
|
||||||
<dt class="column mr-auto">
|
{% include 'snippets/book_cover.html' with cover_class='is-w-xs-mobile is-w-s is-h-xs-mobile is-h-s' size_mobile='xsmall' size='small' %}
|
||||||
<div class="columns is-mobile is-gapless is-vcentered">
|
</a>
|
||||||
<a
|
|
||||||
class="column is-cover"
|
<div class="column ml-3">
|
||||||
href="{{ book.local_path }}"
|
{% include 'snippets/book_titleby.html' %}
|
||||||
aria-hidden="true"
|
|
||||||
>
|
<p>
|
||||||
{% include 'snippets/book_cover.html' with cover_class='is-w-xs-mobile is-w-s is-h-xs-mobile is-h-s' size_mobile='xsmall' size='small' %}
|
{% trans "Suggested by" %}
|
||||||
|
|
||||||
|
<a href="{{ item.user.local_path }}">
|
||||||
|
{{ item.user.display_name }}
|
||||||
</a>
|
</a>
|
||||||
|
</p>
|
||||||
<div class="column ml-3">
|
</div>
|
||||||
{% include 'snippets/book_titleby.html' %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</dt>
|
|
||||||
|
|
||||||
<dd class="column is-4-tablet mx-3-tablet my-3-mobile">
|
|
||||||
{% trans "Suggested by" %}
|
|
||||||
|
|
||||||
<a href="{{ item.user.local_path }}">
|
|
||||||
{{ item.user.display_name }}
|
|
||||||
</a>
|
|
||||||
</dd>
|
|
||||||
|
|
||||||
<dd class="column is-narrow field has-addons">
|
|
||||||
<form class="control" method="POST" action="{% url 'list-curate' list.id %}">
|
|
||||||
{% csrf_token %}
|
|
||||||
<input type="hidden" name="item" value="{{ item.id }}">
|
|
||||||
<input type="hidden" name="approved" value="true">
|
|
||||||
<button type="submit" class="button">{% trans "Approve" %}</button>
|
|
||||||
</form>
|
|
||||||
<form class="control" method="POST" action="{% url 'list-curate' list.id %}">
|
|
||||||
{% csrf_token %}
|
|
||||||
<input type="hidden" name="item" value="{{ item.id }}">
|
|
||||||
<input type="hidden" name="approved" value="false">
|
|
||||||
<button type="submit" class="button is-danger is-light">{% trans "Discard" %}</button>
|
|
||||||
</form>
|
|
||||||
</dd>
|
|
||||||
</div>
|
</div>
|
||||||
{% endwith %}
|
</div>
|
||||||
|
|
||||||
|
<div class="column is-narrow">
|
||||||
|
<div class="field has-addons">
|
||||||
|
<form class="control" method="POST" action="{% url 'list-curate' list.id %}">
|
||||||
|
{% csrf_token %}
|
||||||
|
<input type="hidden" name="item" value="{{ item.id }}">
|
||||||
|
<input type="hidden" name="approved" value="true">
|
||||||
|
<button type="submit" class="button">{% trans "Approve" %}</button>
|
||||||
|
</form>
|
||||||
|
<form class="control" method="POST" action="{% url 'list-curate' list.id %}">
|
||||||
|
{% csrf_token %}
|
||||||
|
<input type="hidden" name="item" value="{{ item.id }}">
|
||||||
|
<input type="hidden" name="approved" value="false">
|
||||||
|
<button type="submit" class="button is-danger is-light">{% trans "Discard" %}</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endwith %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</dl>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</section>
|
</section>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{% extends 'components/modal.html' %}
|
{% extends 'components/new_modal.html' %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block modal-title %}{% trans "Delete this list?" %}{% endblock %}
|
{% block modal-title %}{% trans "Delete this list?" %}{% endblock %}
|
||||||
|
@ -14,8 +14,9 @@
|
||||||
<button class="button is-danger" type="submit">
|
<button class="button is-danger" type="submit">
|
||||||
{% trans "Delete" %}
|
{% trans "Delete" %}
|
||||||
</button>
|
</button>
|
||||||
{% trans "Cancel" as button_text %}
|
<button type="button" class="button" data-modal-close>
|
||||||
{% include 'snippets/toggle/toggle_button.html' with text=button_text controls_text="delete_list" controls_uid=list.id %}
|
{% trans "Cancel" %}
|
||||||
|
</button>
|
||||||
</form>
|
</form>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -9,5 +9,5 @@
|
||||||
<form name="edit-list" method="post" action="{% url 'list' list.id %}">
|
<form name="edit-list" method="post" action="{% url 'list' list.id %}">
|
||||||
{% include 'lists/form.html' %}
|
{% include 'lists/form.html' %}
|
||||||
</form>
|
</form>
|
||||||
{% include "lists/delete_list_modal.html" with controls_text="delete_list" controls_uid=list.id %}
|
{% include "lists/delete_list_modal.html" with id="delete_list" %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -114,21 +114,20 @@
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="columns is-mobile">
|
<div class="is-flex">
|
||||||
<div class="column">
|
|
||||||
<div class="field has-addons">
|
|
||||||
<div class="control">
|
|
||||||
{% include 'snippets/privacy_select.html' with current=list.privacy %}
|
|
||||||
</div>
|
|
||||||
<div class="control">
|
|
||||||
<button type="submit" class="button is-primary">{% trans "Save" %}</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% if list.id %}
|
{% if list.id %}
|
||||||
<div class="column is-narrow">
|
<div class="is-flex-grow-1">
|
||||||
{% trans "Delete list" as button_text %}
|
<button type="button" data-modal-open="delete_list" class="button is-danger">
|
||||||
{% include 'snippets/toggle/toggle_button.html' with class="is-danger" text=button_text icon_with_text="x" controls_text="delete_list" controls_uid=list.id focus="modal_title_delete_list" %}
|
{% trans "Delete list" %}
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<div class="field has-addons">
|
||||||
|
<div class="control">
|
||||||
|
{% include 'snippets/privacy_select.html' with current=list.privacy %}
|
||||||
|
</div>
|
||||||
|
<div class="control">
|
||||||
|
<button type="submit" class="button is-primary">{% trans "Save" %}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
{% include 'lists/created_text.html' with list=list %}
|
{% include 'lists/created_text.html' with list=list %}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="column is-narrow is-flex">
|
<div class="column is-narrow is-flex">
|
||||||
{% if request.user == list.user %}
|
{% if request.user == list.user %}
|
||||||
{% trans "Edit List" as button_text %}
|
{% trans "Edit List" as button_text %}
|
||||||
|
@ -20,6 +21,8 @@
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
{% block breadcrumbs %}{% endblock %}
|
||||||
|
|
||||||
<div class="block content">
|
<div class="block content">
|
||||||
{% include 'snippets/trimmed_text.html' with full=list.description %}
|
{% include 'snippets/trimmed_text.html' with full=list.description %}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -4,6 +4,19 @@
|
||||||
{% load bookwyrm_group_tags %}
|
{% load bookwyrm_group_tags %}
|
||||||
{% load markdown %}
|
{% load markdown %}
|
||||||
|
|
||||||
|
{% block breadcrumbs %}
|
||||||
|
<nav class="breadcrumb subtitle" aria-label="breadcrumbs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="{% url 'lists' %}">{% trans "Lists" %}</a></li>
|
||||||
|
<li class="is-active">
|
||||||
|
<a href="#" aria-current="page">
|
||||||
|
{{ list.name|truncatechars:30 }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block panel %}
|
{% block panel %}
|
||||||
{% if request.user == list.user and pending_count %}
|
{% if request.user == list.user and pending_count %}
|
||||||
<div class="block content">
|
<div class="block content">
|
||||||
|
|
|
@ -347,9 +347,12 @@ class ListViews(TestCase):
|
||||||
"""there are so many views, this just makes sure it LOADS"""
|
"""there are so many views, this just makes sure it LOADS"""
|
||||||
view = views.Curate.as_view()
|
view = views.Curate.as_view()
|
||||||
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.apply_async"):
|
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.apply_async"):
|
||||||
models.List.objects.create(name="Public list", user=self.local_user)
|
models.ListItem.objects.create(
|
||||||
models.List.objects.create(
|
user=self.local_user,
|
||||||
name="Private list", privacy="direct", user=self.local_user
|
book_list=self.list,
|
||||||
|
book=self.book,
|
||||||
|
approved=False,
|
||||||
|
order=1,
|
||||||
)
|
)
|
||||||
request = self.factory.get("")
|
request = self.factory.get("")
|
||||||
request.user = self.local_user
|
request.user = self.local_user
|
||||||
|
|
|
@ -264,10 +264,10 @@ class EmbedList(View):
|
||||||
return TemplateResponse(request, "lists/embed-list.html", data)
|
return TemplateResponse(request, "lists/embed-list.html", data)
|
||||||
|
|
||||||
|
|
||||||
|
@method_decorator(login_required, name="dispatch")
|
||||||
class Curate(View):
|
class Curate(View):
|
||||||
"""approve or discard list suggestsions"""
|
"""approve or discard list suggestsions"""
|
||||||
|
|
||||||
@method_decorator(login_required, name="dispatch")
|
|
||||||
def get(self, request, list_id):
|
def get(self, request, list_id):
|
||||||
"""display a pending list"""
|
"""display a pending list"""
|
||||||
book_list = get_object_or_404(models.List, id=list_id)
|
book_list = get_object_or_404(models.List, id=list_id)
|
||||||
|
@ -280,8 +280,6 @@ class Curate(View):
|
||||||
}
|
}
|
||||||
return TemplateResponse(request, "lists/curate.html", data)
|
return TemplateResponse(request, "lists/curate.html", data)
|
||||||
|
|
||||||
@method_decorator(login_required, name="dispatch")
|
|
||||||
# pylint: disable=unused-argument
|
|
||||||
def post(self, request, list_id):
|
def post(self, request, list_id):
|
||||||
"""edit a book_list"""
|
"""edit a book_list"""
|
||||||
book_list = get_object_or_404(models.List, id=list_id)
|
book_list = get_object_or_404(models.List, id=list_id)
|
||||||
|
|
Loading…
Reference in a new issue