move div.item out to an inclusion tag
This commit is contained in:
Родитель
118956cbfe
Коммит
7157592734
|
@ -82,3 +82,11 @@ def contribution(addon, text='', src='', show_install=False, show_help=True):
|
|||
'has_suggested': bool(addon.suggested_amount),
|
||||
'pledge': pledge,
|
||||
}))
|
||||
|
||||
|
||||
@register.inclusion_tag('addons/listing_items.html')
|
||||
@jinja2.contextfunction
|
||||
def addon_listing_items(context, addons):
|
||||
c = dict(context.items())
|
||||
c['addons'] = addons
|
||||
return c
|
||||
|
|
|
@ -62,43 +62,7 @@
|
|||
<div class="addon-listing addon-listing-{{ filter.field }}">
|
||||
{% for key, addons in addon_sets.items() %}
|
||||
<div id="list-{{ key }}">
|
||||
{% for addon in addons %}
|
||||
{% cache addon %}
|
||||
<div class="item">
|
||||
<div class="install">Install button</div>
|
||||
<h3>
|
||||
<a href="{{ addon.get_url_path() }}">{{ addon.name }}</a>
|
||||
<span>
|
||||
{% trans users=users_list(addon.authors.all()) %}
|
||||
by {{ users }}
|
||||
{% endtrans %}
|
||||
</span>
|
||||
</h3>
|
||||
<a href="{{ addon.get_url_path() }}">
|
||||
<img class="icon" width="32" height="32" src="{{ addon.icon_url }}"
|
||||
alt="{{ addon.name }}">
|
||||
</a>
|
||||
<blockquote>
|
||||
{{ addon.description|truncate(250) }}
|
||||
</blockquote>
|
||||
<div class="meta">
|
||||
{{ addon|reviews_link }}
|
||||
<span class="downloads">
|
||||
{% with num=addon.weekly_downloads %}
|
||||
{# L10n: {0} is the number of downloads. #}
|
||||
{{ ngettext("<strong>{0}</strong> weekly download",
|
||||
"<strong>{0}</strong> weekly downloads",
|
||||
num)|f(num|numberfmt)|safe }}
|
||||
{% endwith %}
|
||||
</span>
|
||||
<span class="updated">
|
||||
{{ _('Updated {0}')|f(addon.last_updated|datetime) }}
|
||||
</span>
|
||||
{{ support_addon(addon) }}
|
||||
</div>
|
||||
</div>
|
||||
{% endcache %}
|
||||
{% endfor %}
|
||||
{{ addon_listing_items(addons) }}
|
||||
<div class="listing-footer">
|
||||
{# TODO(jbalogh): browse and rss page urls #}
|
||||
<a class="subscribe" href="#">
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
{% cache addons %}
|
||||
{% for addon in addons %}
|
||||
{% cache addon %}
|
||||
<div class="item">
|
||||
{{ install_button(addon) }}
|
||||
<h3>
|
||||
<a href="{{ addon.get_url_path() }}">{{ addon.name }}</a>
|
||||
<span>
|
||||
{% trans users=users_list(addon.authors.all()) %}
|
||||
by {{ users }}
|
||||
{% endtrans %}
|
||||
</span>
|
||||
</h3>
|
||||
<a href="{{ addon.get_url_path() }}">
|
||||
<img class="icon" width="32" height="32" src="{{ addon.icon_url }}"
|
||||
alt="{{ addon.name }}">
|
||||
</a>
|
||||
<blockquote>
|
||||
{{ addon.description|truncate(250) }}
|
||||
</blockquote>
|
||||
<div class="meta">
|
||||
{{ addon|reviews_link }}
|
||||
<span class="downloads">
|
||||
{% with num=addon.weekly_downloads %}
|
||||
{# L10n: {0} is the number of downloads. #}
|
||||
{{ ngettext("<strong>{0}</strong> weekly download",
|
||||
"<strong>{0}</strong> weekly downloads",
|
||||
num)|f(num|numberfmt)|safe }}
|
||||
{% endwith %}
|
||||
</span>
|
||||
<span class="updated">
|
||||
{{ _('Updated {0}')|f(addon.last_updated|datetime) }}
|
||||
</span>
|
||||
{{ support_addon(addon) }}
|
||||
</div>
|
||||
</div>
|
||||
{% endcache %}
|
||||
{% endfor %}
|
||||
{% endcache %}
|
Загрузка…
Ссылка в новой задаче