{% macro write_a_review(entity_type, entity_id) %} {{ _('Review') }} {% endmacro %} {% macro print_message(message, category) %} {% if category == "error" %} {% set alert_class="alert-danger" %} {% elif category == "warning" %} {% set alert_class="alert-warning" %} {% elif category == "success" %} {% set alert_class="alert-success" %} {% else %} {% set alert_class="alert-info" %} {% endif %}
{{ message }}
{% endmacro %} {% macro scope_desc(scope) %} {% if scope == "user" %} {{ _('Profile data') }} {% elif scope == "review" %} {{ _('Reviews') }} {% elif scope == "client" %} {{ _('Applications') }} {% elif scope == "authorization" %} {{ _('Authorization') }} {% elif scope == "vote" %} {{ _('Review votes') }} {% endif %} {% endmacro %} {% macro cover_art(entity_id, entity_type, attributes='', overlay_type=False, source_credit=False, size=250, release_group_page=False) %} {# Note: when passing in `attributes`, don't quote attribute values; they will be added automatically #} {% if entity_type == 'event' %} {% if overlay_type %} {{ _('Event') }} {% endif %} {% elif entity_type == 'place' %} {% if overlay_type %} {{ _('Place') }} {% endif %} {% elif entity_type == 'work' %} {% if overlay_type %} {{ _('Work') }} {% endif %} {% elif entity_type == 'artist' %} {% if overlay_type %} {{ _('Artist') }} {% endif %} {% elif entity_type == 'label' %} {% if overlay_type %} {{ _('Label') }} {% endif %} {% elif entity_type == 'recording' %} {% if overlay_type %} {{ _('Recording') }} {% endif %} {% elif entity_type == 'bb_edition_group' %} {% if overlay_type %} {{ _('Edition Group') }} {% endif %} {% elif entity_type == 'bb_literary_work' %} {% if overlay_type %} {{ _('Literary Work') }} {% endif %} {% elif entity_type == 'bb_author' %} {% if overlay_type %} {{ _('Author') }} {% endif %} {% elif entity_type == 'bb_series' %} {% if overlay_type %} {{ _('Series') }} {% endif %} {% elif entity_type == 'release_group' %} {% if overlay_type %} {{ _('Release Group') }} {% endif %} {% endif %} {% endmacro %} {% macro review_credit(review) %} {% set user_string = '%s'|safe % (url_for('user.reviews', user_ref=review.user.user_ref), review.user.display_name) %} {{ _('Review by %(user)s', user=user_string) }} {% endmacro %} {% macro spotify_player(release_group_id, spotify_mappings, show_add_message=False) -%}
{% if spotify_mappings %} {{ _('View Spotify mapping information') }} {% elif show_add_message %} {{ _('We don’t have a mapping between this release group and Spotify. Please help us find the right album.') }}
{{ _('Match this!') }}
{% endif %}
{%- endmacro %} {% macro show_external_reviews(reviews) %} {% if reviews %} {% for review in reviews %}
  • {{ review.url.url }}
  • {% endfor %} {% endif %} {% endmacro %} {% macro show_tags(tags) %} {% if tags %} {% for tag in tags %} {{ tag }} {%- if not loop.last -%} , {% endif %} {% endfor %} {% else %}

    {{ _('(none)') }}

    {% endif %} {% endmacro %} {% macro soundcloud_player(soundcloud_url) %}
    {% if soundcloud_url %} {% endif %}
    {% endmacro %} {% macro show_embedded_player(soundcloud_url, spotify_release_group_id, spotify_mappings, spotify_show_add_message=False) %} {% if soundcloud_url %} {{ soundcloud_player(soundcloud_url) }} {% else %} {{ spotify_player(spotify_release_group_id, spotify_mappings, spotify_show_add_message) }} {% endif %} {% endmacro %} {% macro show_avg_rating(rating, count, show_glyphicon=True) %} {% if show_glyphicon %} {% endif %} {{ rating }}/5 {{ ngettext('based on %(num)s rating', 'based on %(num)s ratings', count) }} {% endmacro %} {% macro comment_credit(comment) %} {% set user_string = '%s'|safe % (url_for('user.reviews', user_ref= comment.user.user_ref), comment.user.display_name) %} {{ _('%(user)s', user=user_string) }} {% endmacro %} {% macro entity_rate_form(entity_type, entity_type_readable) %} {% if current_user.is_authenticated %}

    {{ _('Rate this {}:'.format(entity_type_readable)) }}


    {{ rating_form.hidden_tag() }}
    {{ rating_form.rating(class="rating", id="rating") }}
    {% else %} {{ _('

    Sign in to rate!

    ', link=url_for('login.index', next=url_for('{}.entity'.format(entity_type), id=id))) }} {% endif %} {% endmacro %} {% macro display_artist_credit(result) %} {% if result['artist-credit-phrase'] is defined and result['artist-credit'] is defined and result['artist-credit'] %} {{ result['artist-credit-phrase'] }} {% elif result['artist-relation-list'] is defined and result['artist-relation-list'] %} {{ result['artist-relation-list'][0]['artist']['name'] or '-' }} {% set count = result['artist-relation-list'] | length %} {% if count > 1 %} + {{ count - 1 }} {{ _("more") }} {% endif %} {% else %} - {% endif %} {% endmacro %} {% macro display_pagination(current_page, count, limit, page_info, parameter) %} {% set total_pages = (count/limit)|round(method='ceil')|int %} {% if count > limit %}
    {% endif %} {% endmacro %} {%- macro show_life_span(entity, show_full_date) %} {%- if entity['life-span'] is defined %} {%- if entity['life-span']['begin'] is defined %} {%- if show_full_date -%} {{ entity['life-span']['begin'] }} {%- else -%} {{ entity['life-span']['begin'][:4] }} {%- endif %} {%- endif %} {%- if entity['life-span']['end'] is defined %} – {%- if show_full_date -%} {{ entity['life-span']['end'] }} {%- else -%} {{ entity['life-span']['end'][:4] }} {%- endif %} {%- endif %} {%- endif %} {%- endmacro %} {% macro show_review_buttons(id, my_review, entity_type) %} {% if not my_review %} {{ _('Write a review') }} {% else %} {{ _('Edit my review') }} {% endif %} {% endmacro %}