Merge pull request #971 from joachimesque/smaller-statuses-dense-cards

Move some status footer elements to the header
This commit is contained in:
Mouse Reeve 2021-04-25 10:39:23 -07:00 committed by GitHub
commit aa557e4758
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 172 additions and 122 deletions

View file

@ -29,6 +29,30 @@ body {
min-width: 75% !important; min-width: 75% !important;
} }
/** Utilities not covered by Bulma
******************************************************************************/
@media only screen and (max-width: 768px) {
.is-sr-only-mobile {
border: none !important;
clip: rect(0, 0, 0, 0) !important;
height: 0.01em !important;
overflow: hidden !important;
padding: 0 !important;
position: absolute !important;
white-space: nowrap !important;
width: 0.01em !important;
}
.m-0-mobile {
margin: 0 !important;
}
}
.button.is-transparent {
background-color: transparent;
}
/** Shelving /** Shelving
******************************************************************************/ ******************************************************************************/

View file

@ -4,18 +4,16 @@
{% with status.id|uuid as uuid %} {% with status.id|uuid as uuid %}
<form name="boost" action="/boost/{{ status.id }}" method="post" class="interaction boost-{{ status.id }}-{{ uuid }} {% if request.user|boosted:status %}is-hidden{% endif %}" data-id="boost-{{ status.id }}-{{ uuid }}"> <form name="boost" action="/boost/{{ status.id }}" method="post" class="interaction boost-{{ status.id }}-{{ uuid }} {% if request.user|boosted:status %}is-hidden{% endif %}" data-id="boost-{{ status.id }}-{{ uuid }}">
{% csrf_token %} {% csrf_token %}
<button class="button is-small" type="submit" {% if not status.boostable %}disabled{% endif %}> <button class="button is-small is-light is-transparent" type="submit" {% if not status.boostable %}disabled{% endif %}>
<span class="icon icon-boost" title="{% trans 'Boost status' %}"> <span class="icon icon-boost m-0-mobile" title="{% trans 'Boost' %}"></span>
<span class="is-sr-only">{% trans "Boost status" %}</span> <span class="is-sr-only-mobile">{% trans "Boost" %}</span>
</span>
</button> </button>
</form> </form>
<form name="unboost" action="/unboost/{{ status.id }}" method="post" class="interaction boost-{{ status.id }}-{{ uuid }} active {% if not request.user|boosted:status %}is-hidden{% endif %}" data-id="boost-{{ status.id }}-{{ uuid }}"> <form name="unboost" action="/unboost/{{ status.id }}" method="post" class="interaction boost-{{ status.id }}-{{ uuid }} active {% if not request.user|boosted:status %}is-hidden{% endif %}" data-id="boost-{{ status.id }}-{{ uuid }}">
{% csrf_token %} {% csrf_token %}
<button class="button is-small is-primary" type="submit"> <button class="button is-small is-light is-transparent" type="submit">
<span class="icon icon-boost" title="{% trans 'Un-boost status' %}"> <span class="icon icon-boost has-text-primary m-0-mobile" title="{% trans 'Un-boost' %}"></span>
<span class="is-sr-only">{% trans "Un-boost status" %}</span> <span class="is-sr-only-mobile">{% trans "Un-boost" %}</span>
</span>
</button> </button>
</form> </form>
{% endwith %} {% endwith %}

View file

@ -3,18 +3,17 @@
{% with status.id|uuid as uuid %} {% with status.id|uuid as uuid %}
<form name="favorite" action="/favorite/{{ status.id }}" method="POST" class="interaction fav-{{ status.id }}-{{ uuid }} {% if request.user|liked:status %}is-hidden{% endif %}" data-id="fav-{{ status.id }}-{{ uuid }}"> <form name="favorite" action="/favorite/{{ status.id }}" method="POST" class="interaction fav-{{ status.id }}-{{ uuid }} {% if request.user|liked:status %}is-hidden{% endif %}" data-id="fav-{{ status.id }}-{{ uuid }}">
{% csrf_token %} {% csrf_token %}
<button class="button is-small" type="submit"> <button class="button is-small is-light is-transparent" type="submit">
<span class="icon icon-heart" title="{% trans 'Like status' %}"> <span class="icon icon-heart m-0-mobile" title="{% trans 'Like' %}">
<span class="is-sr-only">{% trans "Like status" %}</span>
</span> </span>
<span class="is-sr-only-mobile">{% trans "Like" %}</span>
</button> </button>
</form> </form>
<form name="unfavorite" action="/unfavorite/{{ status.id }}" method="POST" class="interaction fav-{{ status.id }}-{{ uuid }} active {% if not request.user|liked:status %}is-hidden{% endif %}" data-id="fav-{{ status.id }}-{{ uuid }}"> <form name="unfavorite" action="/unfavorite/{{ status.id }}" method="POST" class="interaction fav-{{ status.id }}-{{ uuid }} active {% if not request.user|liked:status %}is-hidden{% endif %}" data-id="fav-{{ status.id }}-{{ uuid }}">
{% csrf_token %} {% csrf_token %}
<button class="button is-primary is-small" type="submit"> <button class="button is-light is-transparent is-small" type="submit">
<span class="icon icon-heart" title="{% trans 'Un-like status' %}"> <span class="icon icon-heart has-text-primary m-0-mobile" title="{% trans 'Un-like' %}"></span>
<span class="is-sr-only">{% trans "Un-like status" %}</span> <span class="is-sr-only-mobile">{% trans "Un-like" %}</span>
</span>
</button> </button>
</form> </form>
{% endwith %} {% endwith %}

View file

@ -4,16 +4,16 @@
{% load humanize %} {% load humanize %}
{% block card-header %} {% block card-header %}
<h3 class="card-header-title has-background-white-ter is-block"> <div class="card-header-title has-background-white-ter is-block">
{% include 'snippets/status/status_header.html' with status=status %} {% include 'snippets/status/status_header.html' with status=status %}
</h3> </div>
{% endblock %} {% endblock %}
{% block card-content %}{% endblock %} {% block card-content %}{% endblock %}
{% block card-footer %} {% block card-footer %}
{% if moderation_mode and perms.bookwyrm.moderate_post %}
<div class="card-footer-item"> <div class="card-footer-item">
{% if moderation_mode and perms.bookwyrm.moderate_post %}
{# moderation options #} {# moderation options #}
<form name="delete-{{status.id}}" action="/delete-status/{{ status.id }}" method="post"> <form name="delete-{{status.id}}" action="/delete-status/{{ status.id }}" method="post">
@ -22,54 +22,45 @@
{% trans "Delete status" %} {% trans "Delete status" %}
</button> </button>
</form> </form>
{% elif no_interact %}
{# nothing here #}
{% elif request.user.is_authenticated %}
<div class="field has-addons">
<div class="control">
{% trans "Reply" as button_text %}
{% include 'snippets/toggle/toggle_button.html' with controls_text="show-comment" controls_uid=status.id text=button_text icon="comment" class="is-small toggle-button" focus="id_content_reply" %}
</div>
<div class="control">
{% include 'snippets/boost_button.html' with status=status %}
</div>
<div class="control">
{% include 'snippets/fav_button.html' with status=status %}
</div>
</div>
{% else %}
<a href="/login">
<span class="icon icon-comment" title="{% trans 'Reply' %}">
<span class="is-sr-only">{% trans "Reply" %}</span>
</span>
<span class="icon icon-boost" title="{% trans 'Boost status' %}">
<span class="is-sr-only">{% trans "Boost status" %}</span>
</span>
<span class="icon icon-heart" title="{% trans 'Like status' %}">
<span class="is-sr-only">{% trans "Like status" %}</span>
</span>
</a>
{% endif %}
</div> </div>
{% elif no_interact %}
{# nothing here #}
{% elif request.user.is_authenticated %}
<div class="card-footer-item"> <div class="card-footer-item">
{% include 'snippets/privacy-icons.html' with item=status %} {% trans "Reply" as button_text %}
{% include 'snippets/toggle/toggle_button.html' with controls_text="show-comment" controls_uid=status.id text=button_text icon_with_text="comment" class="is-small is-light is-transparent toggle-button" focus="id_content_reply" %}
</div> </div>
<div class="card-footer-item"> <div class="card-footer-item">
<a href="{{ status.remote_id }}">{{ status.published_date|timesince }}</a> {% include 'snippets/boost_button.html' with status=status %}
</div>
<div class="card-footer-item">
{% include 'snippets/fav_button.html' with status=status %}
</div> </div>
{% if not moderation_mode %} {% if not moderation_mode %}
<div class="card-footer-item"> <div class="card-footer-item">
{% include 'snippets/status/status_options.html' with class="is-small" right=True %} {% include 'snippets/status/status_options.html' with class="is-small is-light is-transparent" right=True %}
</div>
{% endif %}
{% else %}
<div class="card-footer-item">
<a href="/login">
<span class="icon icon-comment is-small" title="{% trans 'Reply' %}">
<span class="is-sr-only">{% trans "Reply" %}</span>
</span>
<span class="icon icon-boost is-small ml-4" title="{% trans 'Boost status' %}">
<span class="is-sr-only">{% trans "Boost status" %}</span>
</span>
<span class="icon icon-heart is-small ml-4" title="{% trans 'Like status' %}">
<span class="is-sr-only">{% trans "Like status" %}</span>
</span>
</a>
</div> </div>
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block card-bonus %} {% block card-bonus %}
{% if request.user.is_authenticated and not moderation_mode %} {% if request.user.is_authenticated and not moderation_mode %}
{% with status.id|uuid as uuid %} {% with status.id|uuid as uuid %}

View file

@ -1,72 +1,108 @@
{% load bookwyrm_tags %} {% load bookwyrm_tags %}
{% load i18n %} {% load i18n %}
<span {% load humanize %}
itemprop="author"
itemscope
itemtype="https://schema.org/Person"
>
<a
href="{{ status.user.local_path }}"
itemprop="url"
>
{% include 'snippets/avatar.html' with user=status.user ariaHide="true" %}
<span itemprop="name">{{ status.user.display_name }}</span> <div class="media">
</a> <figure class="media-left" aria-hidden="true">
</span> <a class="image is-48x48" href="{{ status.user.local_path }}">
{% include 'snippets/avatar.html' with user=status.user ariaHide="true" medium="true" %}
</a>
</figure>
{% if status.status_type == 'GeneratedNote' %} <div class="media-content">
{{ status.content | safe }} <h3 class="has-text-weight-bold">
{% elif status.status_type == 'Rating' %} <span
{% trans "rated" %} itemprop="author"
{% elif status.status_type == 'Review' %} itemscope
{% trans "reviewed" %} itemtype="https://schema.org/Person"
{% elif status.status_type == 'Comment' %} >
{% trans "commented on" %} {% if status.user.avatar %}
{% elif status.status_type == 'Quotation' %} <meta itemprop="image" content="/images/{{ status.user.avatar }}">
{% trans "quoted" %} {% endif %}
{% elif status.reply_parent %}
{% with parent_status=status|parent %}
{% if parent_status.status_type == 'Review' %} <a
{% blocktrans with username=parent_status.user.display_name user_path=parent_status.user.local_path status_path=parent_status.local_path %}replied to <a href="{{ user_path }}">{{ username}}'s</a> <a href="{{ status_path }}">review</a>{% endblocktrans %} href="{{ status.user.local_path }}"
{% elif parent_status.status_type == 'Comment' %} itemprop="url"
{% blocktrans with username=parent_status.user.display_name user_path=parent_status.user.local_path status_path=parent_status.local_path %}replied to <a href="{{ user_path }}">{{ username}}'s</a> <a href="{{ status_path }}">comment</a>{% endblocktrans %} >
{% elif parent_status.status_type == 'Quotation' %} <span itemprop="name">{{ status.user.display_name }}</span>
{% blocktrans with username=parent_status.user.display_name user_path=parent_status.user.local_path status_path=parent_status.local_path %}replied to <a href="{{ user_path }}">{{ username}}'s</a> <a href="{{ status_path }}">quote</a>{% endblocktrans %} </a>
{% else %} </span>
{% blocktrans with username=parent_status.user.display_name user_path=parent_status.user.local_path status_path=parent_status.local_path %}replied to <a href="{{ user_path }}">{{ username}}'s</a> <a href="{{ status_path }}">status</a>{% endblocktrans %}
{% endif %}
{% endwith %} {% if status.status_type == 'GeneratedNote' %}
{% endif %} {{ status.content | safe }}
{% elif status.status_type == 'Rating' %}
{% trans "rated" %}
{% elif status.status_type == 'Review' %}
{% trans "reviewed" %}
{% elif status.status_type == 'Comment' %}
{% trans "commented on" %}
{% elif status.status_type == 'Quotation' %}
{% trans "quoted" %}
{% elif status.reply_parent %}
{% with parent_status=status|parent %}
{% if status.book %} {% blocktrans with username=parent_status.user.display_name user_path=parent_status.user.local_path status_path=parent_status.local_path %}replied to <a href="{{ user_path }}">{{ username}}'s</a> <a href="{{ status_path }}">status</a>{% endblocktrans %}
{% if status.status_type == 'GeneratedNote' or status.status_type == 'Rating' %} {% endwith %}
<a href="/book/{{ status.book.id }}">{{ status.book|title }}</a>{% if status.status_type == 'Rating' %}: {% endif %}
<span
itemprop="reviewRating"
itemscope
itemtype="https://schema.org/Rating"
>
<span class="is-hidden" {{ rating_type }}>
<meta itemprop="ratingValue" content="{{ status.rating|floatformat }}">
{# @todo Is it possible to not hard-code the value? #} {% if status.book %}
<meta itemprop="bestRating" content="5"> {% if status.status_type == 'GeneratedNote' or status.status_type == 'Rating' %}
</span> <a href="/book/{{ status.book.id }}">{{ status.book|title }}</a>{% if status.status_type == 'Rating' %}:
<span
itemprop="reviewRating"
itemscope
itemtype="https://schema.org/Rating"
>
<span class="is-hidden" {{ rating_type }}>
<meta itemprop="ratingValue" content="{{ status.rating|floatformat }}">
{% include 'snippets/stars.html' with rating=status.rating %} {% if status.book %}
{% endif %} {% if status.status_type == 'GeneratedNote' or status.status_type == 'Rating' %}
{% else %} <a href="/book/{{ status.book.id }}">{{ status.book|title }}</a>{% if status.status_type == 'Rating' %}:
{% include 'snippets/book_titleby.html' with book=status.book %} <span
{% endif %} itemprop="reviewRating"
{% elif status.mention_books %} itemscope
<a href="/book/{{ status.mention_books.first.id }}">{{ status.mention_books.first|title }}</a> itemtype="https://schema.org/Rating"
{% endif %} >
<span class="is-hidden" {{ rating_type }}>
<meta itemprop="ratingValue" content="{{ status.rating|floatformat }}">
{% if status.progress %} {# @todo Is it possible to not hard-code the value? #}
<p class="help"> <meta itemprop="bestRating" content="5">
({% if status.progress_mode == 'PG' %}{% include 'snippets/page_text.html' with page=status.progress total_pages=status.book.pages %}{% else %}{{ status.progress }}%{% endif %}) </span>
</p>
{% endif %} {% include 'snippets/stars.html' with rating=status.rating %}
{% endif %}
{% else %}
{% include 'snippets/book_titleby.html' with book=status.book %}
{% endif %}
{% elif status.mention_books %}
<a href="/book/{{ status.mention_books.first.id }}">
{{ status.mention_books.first.title }}
</a>
{% endif %}
{% include 'snippets/stars.html' with rating=status.rating %}
{% endif %}
{% else %}
{% include 'snippets/book_titleby.html' with book=status.book %}
{% endif %}
{% elif status.mention_books %}
<a href="/book/{{ status.mention_books.first.id }}">{{ status.mention_books.first|title }}</a>
{% endif %}
</h3>
<p class="is-size-7 is-flex is-align-items-center">
<a href="{{ status.remote_id }}">{{ status.published_date|timesince }}</a>
{% if status.progress %}
<span class="ml-1">
{% if status.progress_mode == 'PG' %}
({% include 'snippets/page_text.html' with page=status.progress total_pages=status.book.pages %})
{% else %}
({{ status.progress }}%)
{% endif %}
</span>
{% endif %}
{% include 'snippets/privacy-icons.html' with item=status %}
</p>
</div>
</div>

View file

@ -3,9 +3,8 @@
{% load bookwyrm_tags %} {% load bookwyrm_tags %}
{% block dropdown-trigger %} {% block dropdown-trigger %}
<span class="icon icon-dots-three"> <span class="icon icon-dots-three m-0-mobile"></span>
<span class="is-sr-only">{% trans "More options" %}</span> <span class="is-sr-only-mobile">{% trans "More options" %}</span>
</span>
{% endblock %} {% endblock %}
{% block dropdown-list %} {% block dropdown-list %}

View file

@ -10,9 +10,12 @@
> >
{% if icon %} {% if icon %}
<span class="icon icon-{{ icon }}" title="{{ text }}"> <span class="icon icon-{{ icon }} m-0-mobile" title="{{ text }}">
<span class="is-sr-only">{{ text }}</span> <span class="is-sr-only">{{ text }}</span>
</span> </span>
{% elif icon_with_text %}
<span class="icon icon-{{ icon_with_text }} m-0-mobile" title="{{ text }}"></span>
<span class="is-sr-only-mobile">{{ text }}</span>
{% else %} {% else %}
<span>{{ text }}</span> <span>{{ text }}</span>
{% endif %} {% endif %}