Re-styles suggstions to show the recommender's notes

I also just shuffled the card around to fit more text.
This commit is contained in:
Mouse Reeve 2024-08-25 19:16:22 -07:00
parent 7603d18879
commit cc70e83687
3 changed files with 73 additions and 56 deletions

View file

@ -1,4 +1,5 @@
{% load i18n %}
{% load book_display_tags %}
<h2 class="title is-3" id="suggestions-section">
{% trans "Suggestions" %}
@ -16,19 +17,29 @@
{% else %}
<ol class="columns is-multiline">
{% for item in items %}
<li class="mb-5 column is-one-quarter">
<li class="mb-5 column is-half">
<div class="card">
<div class="card-content pb-3">
{% with book=item.book %}
<div class="card-content pb-3 columns">
{% with item_book=item.book %}
<div class="column is-one-quarter">
<div class="is-cover">
<a href="{{ item.book.local_path }}" aria-hidden="true">
{% include 'snippets/book_cover.html' with cover_class='is-h-m-mobile is-h-m-tablet is-align-items-flex-start' size='medium' %}
<a href="{{ item_book.local_path }}" aria-hidden="true">
{% include 'snippets/book_cover.html' with cover_class='is-h-m-mobile is-h-m-tablet is-align-items-flex-start' size='medium' book=item_book %}
</a>
</div>
</div>
<div class="column is-three-quarters">
<p class="mt-3">
{% include 'snippets/book_titleby.html' %}
{% include 'snippets/book_titleby.html' with book=item_book %}
</p>
{% if item_book|book_description %}
<blockquote>
{% with full=item_book|book_description trim_length=20 %}
{% include 'snippets/trimmed_text.html' with hide_more=True %}
{% endwith %}
{% endif %}
{% include "lists/list_item_notes.html" with list=book.suggestion_list hide_edit=True %}
</div>
{% endwith %}
</div>
<div class="card-footer is-stacked-mobile has-background-tertiary is-align-items-stretch">
@ -48,7 +59,7 @@
</div>
</li>
{% endfor %}
<li class="mb-5 column is-one-quarter">
<li class="mb-5 column is-full">
{% include "book/suggestion_list/search.html" %}
</li>
</ol>

View file

@ -80,50 +80,8 @@
</div>
</div>
{% endwith %}
{% include "lists/list_item_notes.html" with item=item %}
{% if item.notes %}
<div class="media notification">
<figure class="media-left" aria-hidden="true">
{% include "snippets/avatar.html" with user=item.user %}
</figure>
<div class="media-content">
<div class="content">
<header>
{% url 'user-feed' item.user|username as user_path %}
{% blocktrans trimmed with username=item.user.display_name %}
<a href="{{ user_path }}">{{ username }}</a> says:
{% endblocktrans %}
</header>
{{ item.notes|to_markdown|safe }}
</div>
{% if item.user == request.user %}
<div>
<details class="details-panel box">
<summary>
<span role="heading" aria-level="3">
{% trans "Edit notes" %}
<span class="details-close icon icon-pencil" aria-hidden="true"></span>
</span>
</summary>
{% include "lists/edit_item_form.html" with book=item.book %}
</details>
</div>
{% endif %}
</div>
</div>
{% elif item.user == request.user %}
<div>
<details class="details-panel box">
<summary>
<span role="heading" aria-level="3">
{% trans "Add notes" %}
<span class="details-close icon icon-x" aria-hidden="true"></span>
</span>
</summary>
{% include "lists/edit_item_form.html" with book=item.book %}
</details>
</div>
{% endif %}
</div>
<div class="card-footer is-stacked-mobile has-background-tertiary is-align-items-stretch">
<div class="card-footer-item">

View file

@ -0,0 +1,48 @@
{% load i18n %}
{% load utilities %}
{% load markdown %}
{% if item.notes %}
<div class="media notification">
<figure class="media-left" aria-hidden="true">
{% include "snippets/avatar.html" with user=item.user %}
</figure>
<div class="media-content">
<div class="content">
<header>
{% url 'user-feed' item.user|username as user_path %}
{% blocktrans trimmed with username=item.user.display_name %}
<a href="{{ user_path }}">{{ username }}</a> says:
{% endblocktrans %}
</header>
{{ item.notes|to_markdown|safe }}
</div>
{% if item.user == request.user and not hide_edit %}
<div>
<details class="details-panel box">
<summary>
<span role="heading" aria-level="3">
{% trans "Edit notes" %}
<span class="details-close icon icon-pencil" aria-hidden="true"></span>
</span>
</summary>
{% include "lists/edit_item_form.html" with book=item.book %}
</details>
</div>
{% endif %}
</div>
</div>
{% elif item.user == request.user and not hide_edit %}
<div>
<details class="details-panel box">
<summary>
<span role="heading" aria-level="3">
{% trans "Add notes" %}
<span class="details-close icon icon-x" aria-hidden="true"></span>
</span>
</summary>
{% include "lists/edit_item_form.html" with book=item.book %}
</details>
</div>
{% endif %}