Merge pull request #1726 from joachimesque/options-panels
Front-end: New look and behavior for Filters and Result panels
This commit is contained in:
@ -6,57 +6,22 @@
|
||||
<h1 class="title">
|
||||
{{ tab.name }}
|
||||
</h1>
|
||||
<div class="block is-clipped">
|
||||
<div class="is-pulled-left">
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
{% for stream in streams %}
|
||||
<li class="{% if tab.key == stream.key %}is-active{% endif %}"{% if tab.key == stream.key %} aria-current="page"{% endif %}>
|
||||
<a href="/{{ stream.key }}#feed">{{ stream.shortname }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# feed settings #}
|
||||
<details class="detail-pinned-button" {% if settings_saved %}open{% endif %}>
|
||||
<summary class="control">
|
||||
<span class="button">
|
||||
<span class="icon icon-dots-three m-0-mobile" aria-hidden="true"></span>
|
||||
<span class="is-sr-only-mobile">{{ _("Feed settings") }}</span>
|
||||
</span>
|
||||
</summary>
|
||||
<form class="notification level is-align-items-flex-end" method="post" action="/{{ tab.key }}#feed">
|
||||
{% csrf_token %}
|
||||
|
||||
<div class="level-left">
|
||||
<div class="field">
|
||||
<div class="control">
|
||||
<span class="is-flex is-align-items-baseline">
|
||||
<label class="label mt-2 mb-1">Status types</label>
|
||||
{% if settings_saved %}
|
||||
<span class="tag is-success is-light ml-2">{{ _("Saved!") }}</span>
|
||||
{% endif %}
|
||||
</span>
|
||||
{% for name, value in feed_status_types_options %}
|
||||
<label class="mr-2">
|
||||
<input type="checkbox" name="feed_status_types" value="{{ name }}" {% if name in user.feed_status_types %}checked=""{% endif %}/>
|
||||
{{ value }}
|
||||
</label>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="level-right control">
|
||||
<button class="button is-small is-primary is-outlined" type="submit">
|
||||
{{ _("Save settings") }}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</details>
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
{% for stream in streams %}
|
||||
<li class="{% if tab.key == stream.key %}is-active{% endif %}"{% if tab.key == stream.key %} aria-current="page"{% endif %}>
|
||||
<a href="/{{ stream.key }}#feed">{{ stream.shortname }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
{# feed settings #}
|
||||
{% with "/"|add:tab.key|add:"#feed" as action %}
|
||||
{% include 'feed/feed_filters.html' with size="small" method="post" action=action %}
|
||||
{% endwith %}
|
||||
|
||||
{# announcements and system messages #}
|
||||
{% if not activities.number > 1 %}
|
||||
<a href="{{ request.path }}" class="transition-y is-hidden notification is-primary is-block" data-poll-wrapper>
|
||||
|
5
bookwyrm/templates/feed/feed_filters.html
Normal file
5
bookwyrm/templates/feed/feed_filters.html
Normal file
@ -0,0 +1,5 @@
|
||||
{% extends 'snippets/filters_panel/filters_panel.html' %}
|
||||
|
||||
{% block filter_fields %}
|
||||
{% include 'feed/status_types_filter.html' %}
|
||||
{% endblock %}
|
16
bookwyrm/templates/feed/status_types_filter.html
Normal file
16
bookwyrm/templates/feed/status_types_filter.html
Normal file
@ -0,0 +1,16 @@
|
||||
{% extends 'snippets/filters_panel/filter_field.html' %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block filter %}
|
||||
<label class="label mt-2 mb-1">Status types</label>
|
||||
|
||||
<div class="is-flex is-flex-direction-row is-flex-direction-column-mobile">
|
||||
{% for name, value in feed_status_types_options %}
|
||||
<label class="mr-2">
|
||||
<input type="checkbox" name="feed_status_types" value="{{ name }}" {% if name in user.feed_status_types %}checked=""{% endif %}/>
|
||||
{{ value }}
|
||||
</label>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
@ -8,7 +8,7 @@
|
||||
<ul class="block">
|
||||
{% for result in local_results.results %}
|
||||
<li class="pd-4 mb-5">
|
||||
<div class="columns is-mobile is-gapless">
|
||||
<div class="columns is-mobile is-gapless mb-0">
|
||||
<div class="column is-cover">
|
||||
{% include 'snippets/book_cover.html' with book=result cover_class='is-w-xs is-h-xs' %}
|
||||
</div>
|
||||
@ -34,34 +34,28 @@
|
||||
<div class="block">
|
||||
{% for result_set in results|slice:"1:" %}
|
||||
{% if result_set.results %}
|
||||
<section class="box has-background-white-bis">
|
||||
<section class="mb-5">
|
||||
{% if not result_set.connector.local %}
|
||||
<header class="columns is-mobile">
|
||||
<div class="column">
|
||||
<h3 class="title is-5">
|
||||
<details class="details-panel box" {% if forloop.first %}open{% endif %}>
|
||||
{% endif %}
|
||||
{% if not result_set.connector.local %}
|
||||
<summary class="is-flex is-align-items-center is-flex-wrap-wrap is-gap-2">
|
||||
<span class="mb-0 title is-5">
|
||||
{% trans 'Results from' %}
|
||||
<a href="{{ result_set.connector.base_url }}" target="_blank">{{ result_set.connector.name|default:result_set.connector.identifier }}</a>
|
||||
</h3>
|
||||
</div>
|
||||
<div class="column is-narrow">
|
||||
{% trans "Open" as button_text %}
|
||||
{% include 'snippets/toggle/open_button.html' with text=button_text controls_text="more_results_panel" controls_uid=result_set.connector.identifier class="is-small" icon_with_text="arrow-down" pressed=forloop.first %}
|
||||
{% trans "Close" as button_text %}
|
||||
{% include 'snippets/toggle/close_button.html' with text=button_text controls_text="more_results_panel" controls_uid=result_set.connector.identifier class="is-small" icon_with_text="arrow-up" pressed=forloop.first %}
|
||||
</div>
|
||||
</header>
|
||||
{% endif %}
|
||||
</span>
|
||||
|
||||
<div class="box has-background-white is-shadowless{% if not forloop.first %} is-hidden{% endif %}" id="more_results_panel_{{ result_set.connector.identifier }}">
|
||||
<span class="details-close icon icon-x" aria-hidden></span>
|
||||
</summary>
|
||||
{% endif %}
|
||||
|
||||
<div class="mt-5">
|
||||
<div class="is-flex is-flex-direction-row-reverse">
|
||||
<div>
|
||||
</div>
|
||||
|
||||
<ul class="is-flex-grow-1">
|
||||
{% for result in result_set.results %}
|
||||
<li class="mb-5">
|
||||
<li class="{% if not forloop.last %}mb-5{% endif %}">
|
||||
<div class="columns is-mobile is-gapless">
|
||||
<div class="columns is-mobile is-gapless">
|
||||
<div class="column is-1 is-cover">
|
||||
{% include 'snippets/book_cover.html' with book=result cover_class='is-w-xs is-h-xs' external_path=True %}
|
||||
</div>
|
||||
<div class="column is-10 ml-3">
|
||||
@ -92,6 +86,9 @@
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{% if not result_set.connector.local %}
|
||||
</details>
|
||||
{% endif %}
|
||||
</section>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
@ -1,6 +1,4 @@
|
||||
<div class="column is-flex">
|
||||
<div class="box is-flex-grow-1">
|
||||
{% block filter %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
<div class="filters-field column">
|
||||
{% block filter %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
|
@ -1,28 +1,47 @@
|
||||
{% load i18n %}
|
||||
<div class="notification content">
|
||||
<h2 class="columns is-mobile mb-0">
|
||||
<span class="column pb-0">Filters</span>
|
||||
<details class="details-panel box is-size-{{ size|default:'normal' }}" {% if filters_applied %}open{% endif %}>
|
||||
<summary class="is-flex is-align-items-center is-flex-wrap-wrap is-gap-2">
|
||||
<span class="mb-0 title {% if size == 'small' %}is-6{% else %}is-5{% endif %} is-flex-shrink-0">
|
||||
{% trans "Filters" %}
|
||||
|
||||
<span class="column is-narrow pb-0">
|
||||
{% trans "Show filters" as text %}
|
||||
{% include 'snippets/toggle/open_button.html' with text=text controls_text="filters" icon_with_text="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_with_text="arrow-up" class="is-small" %}
|
||||
</span>
|
||||
</h2>
|
||||
|
||||
<form class="is-hidden mt-3" id="filters" method="get" action="{{ request.path }}" tabindex="0">
|
||||
{% if sort %}
|
||||
<input type="hidden" name="sort" value="{{ sort }}">
|
||||
{% if filters_applied %}
|
||||
<span class="tag is-success is-light ml-2 mb-0 is-{{ size|default:'normal' }}">
|
||||
{{ _("Filters are applied") }}
|
||||
</span>
|
||||
{% endif %}
|
||||
<div class="columns">
|
||||
{% block filter_fields %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
<button class="button is-primary">{% trans "Apply filters" %}</button>
|
||||
</form>
|
||||
|
||||
{% if request.GET %}
|
||||
<a class="help" href="{{ request.path }}">{% trans "Clear filters" %}</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if request.GET %}
|
||||
<span class="mb-0 tags has-addons">
|
||||
<span class="mb-0 tag is-success is-light is-{{ size|default:'normal' }}">
|
||||
{% trans "Filters are applied" %}
|
||||
</span>
|
||||
<a class="mb-0 tag is-success is-{{ size|default:'normal' }}" href="{{ request.path }}">
|
||||
{% trans "Clear filters" %}
|
||||
</a>
|
||||
</span>
|
||||
{% endif %}
|
||||
|
||||
<span class="details-close icon icon-x is-{{ size|default:'normal' }}" aria-hidden></span>
|
||||
</summary>
|
||||
|
||||
<div class="mt-3">
|
||||
<form id="filters" method="{{ method|default:'get' }}" action="{{ action|default:request.path }}">
|
||||
{% if method == 'post' %}
|
||||
{% csrf_token %}
|
||||
{% endif %}
|
||||
|
||||
{% if sort %}
|
||||
<input type="hidden" name="sort" value="{{ sort }}">
|
||||
{% endif %}
|
||||
<div class="mt-3 columns filters-fields is-align-items-stretch">
|
||||
{% block filter_fields %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
<button type="submit" class="button is-primary is-small">
|
||||
{% trans "Apply filters" %}
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</details>
|
||||
|
Reference in New Issue
Block a user