{% extends 'notifications/items/layout.html' %}
{% load i18n %}
{% load utilities %}
{% load humanize %}

{% block primary_link %}{% spaceless %}
{% with related_list=notification.related_list_items.first.book_list %}
{% if related_list.curation != "curated" %}
    {{ related_list.local_path }}
{% else %}
    {% url 'list-curate' related_list.id %}
{% endif %}
{% endwith %}
{% endspaceless %}{% endblock %}

{% block icon %}
<span class="icon icon-plus"></span>
{% endblock %}

{% block description %}
{% with related_list=notification.related_list_items.first.book_list %}
{% with book_path=notification.related_list_items.first.book.local_path %}
{% with book_title=notification.related_list_items.first.book|book_title %}
{% with second_book_path=notification.related_list_items.all.1.book.local_path %}
{% with second_book_title=notification.related_list_items.all.1.book|book_title %}
{% with list_name=related_list.name %}

{% url 'list' related_list.id as list_path %}
{% url 'list-curate' related_list.id as list_curate_path %}

{% if notification.related_list_items.count == 1 %}
    {% if related_list.curation != "curated" %}
        {% blocktrans trimmed %}
        <a href="{{ related_user_link }}">{{ related_user }}</a>
        added <em><a href="{{ book_path }}">{{ book_title }}</a></em>
        to your list "<a href="{{ list_path }}">{{ list_name }}</a>"
        {% endblocktrans %}
    {% else %}
        {% blocktrans trimmed %}
        <a href="{{ related_user_link }}">{{ related_user }}</a>
        suggested adding <em><a href="{{ book_path }}">{{ book_title }}</a></em>
        to your list "<a href="{{ list_curate_path }}">{{ list_name }}</a>"
        {% endblocktrans %}
    {% endif %}
{% elif notification.related_list_items.count == 2 %}
    {% if related_list.curation != "curated" %}
        {% blocktrans trimmed %}
        <a href="{{ related_user_link }}">{{ related_user }}</a>
        added <em><a href="{{ book_path }}">{{ book_title }}</a></em>
        and <em><a href="{{ second_book_path }}">{{ second_book_title }}</a></em>
        to your list "<a href="{{ list_path }}">{{ list_name }}</a>"
        {% endblocktrans %}
    {% else %}
        {% blocktrans trimmed %}
        <a href="{{ related_user_link }}">{{ related_user }}</a>
        suggested adding <em><a href="{{ book_path }}">{{ book_title }}</a></em>
        and <em><a href="{{ second_book_path }}">{{ second_book_title }}</a></em>
        to your list "<a href="{{ list_curate_path }}">{{ list_name }}</a>"
        {% endblocktrans %}
    {% endif %}
{% else %}
    {% with count=notification.related_list_items.count|add:"-2" %}
    {% with display_count=count|intcomma %}
    {% if count < 1 %}
        {# This happens if the list item was deleted #}
        {% blocktrans trimmed %}
        <a href="{{ related_user_link }}">{{ related_user }}</a>
        added a book to one of your lists
        {% endblocktrans %}
    {% elif related_list.curation != "curated" %}

        {% blocktrans trimmed count counter=count %}
        <a href="{{ related_user_link }}">{{ related_user }}</a>
        added <em><a href="{{ book_path }}">{{ book_title }}</a></em>,
        <em><a href="{{ second_book_path }}">{{ second_book_title }}</a></em>,
        and {{ display_count }} other book
        to your list "<a href="{{ list_path }}">{{ list_name }}</a>"
        {% plural %}
        <a href="{{ related_user_link }}">{{ related_user }}</a>
        added <em><a href="{{ book_path }}">{{ book_title }}</a></em>,
        <em><a href="{{ second_book_path }}">{{ second_book_title }}</a></em>,
        and {{ display_count }} other books
        to your list "<a href="{{ list_path }}">{{ list_name }}</a>"
        {% endblocktrans %}

    {% else %}

        {% blocktrans trimmed count counter=count %}
        <a href="{{ related_user_link }}">{{ related_user }}</a>
        suggested adding <em><a href="{{ book_path }}">{{ book_title }}</a></em>,
        <em><a href="{{ second_book_path }}">{{ second_book_title }}</a></em>,
        and {{ display_count }} other book
        to your list "<a href="{{ list_curate_path }}">{{ list_name }}</a>"
        {% plural %}
        <a href="{{ related_user_link }}">{{ related_user }}</a>
        suggested adding <em><a href="{{ book_path }}">{{ book_title }}</a></em>,
        <em><a href="{{ second_book_path }}">{{ second_book_title }}</a></em>,
        and {{ display_count }} other books
        to your list "<a href="{{ list_curate_path }}">{{ list_name }}</a>"
        {% endblocktrans %}

    {% endif %}
    {% endwith %}
    {% endwith %}
{% endif %}

{% endwith %}
{% endwith %}
{% endwith %}
{% endwith %}
{% endwith %}
{% endwith %}
{% endblock %}

