diff --git a/bookwyrm/templates/directory/community_filter.html b/bookwyrm/templates/directory/community_filter.html new file mode 100644 index 00000000..bd0ba778 --- /dev/null +++ b/bookwyrm/templates/directory/community_filter.html @@ -0,0 +1,14 @@ +{% extends 'snippets/filters_panel/filter_field.html' %} +{% load i18n %} + +{% block filter %} +{% trans "Community" %} + + +{% endblock %} diff --git a/bookwyrm/templates/directory.html b/bookwyrm/templates/directory/directory.html similarity index 56% rename from bookwyrm/templates/directory.html rename to bookwyrm/templates/directory/directory.html index 3d47e26b..7413f67d 100644 --- a/bookwyrm/templates/directory.html +++ b/bookwyrm/templates/directory/directory.html @@ -36,64 +36,7 @@ {% endif %} -
-

- Filters - - - {% trans "Show filters" as text %} - {% include 'snippets/toggle/open_button.html' with text=text controls_text="filters" icon="arrow-down" class="is-small" focus="filters" %} - {% trans "Hide filters" as text %} - {% include 'snippets/toggle/close_button.html' with text=text controls_text="filters" icon="x" class="is-small" %} - -

- - - {% if request.GET %} - {% trans "Clear filters" %} - {% endif %} -
+{% include 'directory/filters.html' %}
{% for user in users %} diff --git a/bookwyrm/templates/directory/filters.html b/bookwyrm/templates/directory/filters.html new file mode 100644 index 00000000..c6bbe157 --- /dev/null +++ b/bookwyrm/templates/directory/filters.html @@ -0,0 +1,7 @@ +{% extends 'snippets/filters_panel/filters_panel.html' %} + +{% block filter_fields %} +{% include 'directory/user_type_filter.html' %} +{% include 'directory/community_filter.html' %} +{% include 'directory/sort_filter.html' %} +{% endblock %} diff --git a/bookwyrm/templates/directory/sort_filter.html b/bookwyrm/templates/directory/sort_filter.html new file mode 100644 index 00000000..82b561fb --- /dev/null +++ b/bookwyrm/templates/directory/sort_filter.html @@ -0,0 +1,12 @@ +{% extends 'snippets/filters_panel/filter_field.html' %} +{% load i18n %} + +{% block filter %} + +
+ +
+{% endblock %} diff --git a/bookwyrm/templates/directory/user_type_filter.html b/bookwyrm/templates/directory/user_type_filter.html new file mode 100644 index 00000000..b5961c82 --- /dev/null +++ b/bookwyrm/templates/directory/user_type_filter.html @@ -0,0 +1,14 @@ +{% extends 'snippets/filters_panel/filter_field.html' %} +{% load i18n %} + +{% block filter %} +{% trans "User type" %} + + +{% endblock %} diff --git a/bookwyrm/templates/snippets/filters_panel/filter_field.html b/bookwyrm/templates/snippets/filters_panel/filter_field.html new file mode 100644 index 00000000..0a8daaa1 --- /dev/null +++ b/bookwyrm/templates/snippets/filters_panel/filter_field.html @@ -0,0 +1,6 @@ +
+
+ {% block filter %} + {% endblock %} +
+
diff --git a/bookwyrm/templates/snippets/filters_panel/filters_panel.html b/bookwyrm/templates/snippets/filters_panel/filters_panel.html new file mode 100644 index 00000000..185f5bc4 --- /dev/null +++ b/bookwyrm/templates/snippets/filters_panel/filters_panel.html @@ -0,0 +1,25 @@ +{% load i18n %} +
+

+ Filters + + + {% trans "Show filters" as text %} + {% include 'snippets/toggle/open_button.html' with text=text controls_text="filters" icon="arrow-down" class="is-small" focus="filters" %} + {% trans "Hide filters" as text %} + {% include 'snippets/toggle/close_button.html' with text=text controls_text="filters" icon="x" class="is-small" %} + +

+ + + + {% if request.GET %} + {% trans "Clear filters" %} + {% endif %} +
diff --git a/bookwyrm/views/directory.py b/bookwyrm/views/directory.py index c57b47f7..b329eede 100644 --- a/bookwyrm/views/directory.py +++ b/bookwyrm/views/directory.py @@ -41,7 +41,7 @@ class Directory(View): data = { "users": paginated.page(page), } - return TemplateResponse(request, "directory.html", data) + return TemplateResponse(request, "directory/directory.html", data) def post(self, request): """ join the directory """