{% from "_macros/deferred_icon.html" import deferred_icon %} {% from "_macros/feed_app_tile.html" import feed_app_tile %} {% from "_macros/market_button.html" import market_button %} {% from "_macros/previews.html" import preview_tray %} {% from "_macros/stars.html" import stars %} {% macro app_tile(product, feed_app=None, is_detail=False, tray=False, alt_style=False, src=None) %} {# product -- market item (app/website) feed_app - feed-app specific data is_detail - whether part of a detail page tray -- whether or not to attach a preview/screenshot tray alt_style -- is this an alternate representation of the tile (cat hidden, author shown) src -- if tile is a link, attach a src param for analytics purposes #} {% set product = apps.transform(product) %} {% set name = product.name if is_detail else product.short_name or product.name %} {% set tag = 'div' if is_detail else 'a' %} <{{ tag }} class="mkt-tile{{ ' feed-app c' if feed_app }}" data-slug="{{ product.slug }}" data-id="{{ product.id }}" {% if not is_detail %} href="{{ url(product.contentType, [product.key])|urlparams(src=src) }}" {% endif %} data-content-type="{{ product.contentType }}" {{ 'itemscope itemtype="http://schema.org/SoftwareApplication"' if not is_detail }}>

{{ name|translate(product) }}

{% if product.author and (is_detail or alt_style) %} {# TODO: When we get user profiles, update to be Person itemprop. #}
{% if is_detail -%} {{ product.author }} {% else -%} {{ product.author }} {% endif -%}
{% endif %} {% if not (is_detail or alt_style) %} {% endif %} {% if product.isApp %} {{ rating_link(is_detail=is_detail) }} {% endif %} {# Move the button below the icon/title on website detail. #} {% if not product.isWebsite or not is_detail %} {{ market_button(product, data_attrs={ 'manifest_url': product.manifest_url, 'source': src, 'slug': product.slug }) }} {% endif %}
{{ deferred_icon(product.icons[is_detail and '128' or '64'] or product.icons['64'], name|translate(product)) }}
{{ feed_app_tile(feed_app) if feed_app }} {% if is_detail %} {% if product.isWebsite %} {{ market_button(product, data_attrs={ 'manifest_url': product.manifest_url, 'source': src, 'slug': product.slug }) }} {% endif %} {% set notices = [] if product.loading else app_notices(product) %} {% if notices.length %}
{% for notice in notices %} {{ notice[0] }} {% endfor %}
{% endif %} {% endif %} {% if is_detail %} {% include "_includes/post_install_message.html" %} {% endif %} {% if tray and product.previews and len(product.previews) %} {{ preview_tray(product, src, is_detail) }} {% endif %} {% endmacro %} {% macro rating_link(is_detail=False) %} {# Detail page ratings link to the ratings list page. #} {% if is_detail %} {% if product.ratings.count %} {{ stars(product.ratings.average) }} {{ product.ratings.count|numberfmt }} {{ _plural('Review', 'Reviews', n=product.ratings.count) }} {% else %} {{ _('Not yet reviewed') }} {% endif %} {% else %} {# Stars-only rating (member of an app listing). #} {{ stars(product.ratings.average) }} {% endif %} {% endmacro %}