{% comment %} This template is used to display references on multi-item search, reference list/search page, book references tab, and via ajax on reference histogram. Currently supports both display for both solr search result (all search/list views) and db model (ajax request via reference histogram). {% endcomment %} {% load static markdownify %}
{# instance url for solr reference #} {% url 'books:detail' slug=reference.instance_slug as instance_url %} {% firstof reference.instance_digital_edition reference.instance.digital_edition as has_digital_edition %}
{% if has_digital_edition %} {# get instance slug from solr result or database model #} {# NOTE: check for instance.slug first, because instance_slug exists on model but is the *work* slug #} {% firstof reference.instance.slug reference.instance_slug as instance_slug %} {# get detail page canvas id from solr or associated intervention #} {% firstof reference.page_canvas_id reference.interventions.first.canvas.short_id as page_slug %} {# if page view is available, display page thumbnail and link to canvas detail view #} {% if page_slug %} View the page containing this reference in {% firstof reference.instance_title reference.instance.display_title %} {% else %} {# if page view is not available, display cover thumbnail and link to book bibliography page #} View bibliographic details for {% firstof reference.instance_title reference.instance.display_title %} (detail of this page not available) {% endif %} {% else %} {% endif %}
{% with instance=reference.instance %} {{ reference.reference_type }}

{% with has_digital_edition|yesno:"a,span" as tag %} <{{ tag }} class="item__link" href="{% firstof instance_url reference.instance_url %}">{% firstof reference.instance_title instance.display_title %} {# collected work title for book section - solr version, database version #} {% if reference.instance_collection_title or reference.instance.collected_in %} in {% firstof reference.instance_collection_title reference.instance.collected_in.display_title %} {%endif %} {% endwith %}

{# solr #} {% url 'books:list' as library_url %} {% if reference.instance_author_firstname_last %} {# errors in tests if value is None #} {% for author in reference.instance_author_firstname_last %} {% if forloop.first %}{% endif %} {{ author }}{% if forloop.first %}{% endif %}{% if not forloop.last %}; {% endif %} {% endfor %} {% endif %} {# database #} {% if instance.work %} {% for author in instance.work.authors.all %} {{ author.firstname_last }}{% if not forloop.last %}; {% endif %} {% endfor %} {% endif %}

{# solr #} {% if reference.instance_copyright_year %}

{{ reference.instance_copyright_year }}{% if reference.instance_copy %} - {{ reference.instance_copy }}{% endif %}

{% endif %} {# db model #} {% if instance.copyright_year %}

{{ instance.copyright_year }}{% if instance.copy %} - {{ instance.copy }}{% endif %}

{% endif %} {% if reference.book_page %}

p{% if '-' in reference.book_page %}p{% endif %}. {{ reference.book_page }}

{% endif %} {# assuming always french for now, since from Derrida's published works #}

{{ reference.anchor_text|default:''|markdownify }}

Cited in {{ reference.derridawork }} p.{{ reference.derridawork_page }}

{% endwith %}