Order compatible apps (bug 645236)
This commit is contained in:
Родитель
62f01b1c5c
Коммит
9e57295077
|
@ -90,7 +90,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
<div><strong>{{ _('Compatibility:') }}</strong></div>
|
<div><strong>{{ _('Compatibility:') }}</strong></div>
|
||||||
<ul>
|
<ul>
|
||||||
{% for app, compat in version.compatible_apps.items() %}
|
{% for app, compat in version.compatible_apps_ordered %}
|
||||||
<li>
|
<li>
|
||||||
<div class="app-icon ed-sprite-{{ app.short }}" title="{{ app.pretty }}"></div>
|
<div class="app-icon ed-sprite-{{ app.short }}" title="{{ app.pretty }}"></div>
|
||||||
{{ compat }}
|
{{ compat }}
|
||||||
|
|
|
@ -1556,6 +1556,31 @@ class TestReview(ReviewBase):
|
||||||
eq_(tds.eq(1).find('th').text(), "Preliminarily approved")
|
eq_(tds.eq(1).find('th').text(), "Preliminarily approved")
|
||||||
eq_(tds.eq(1).find('td a').text(), "An editor")
|
eq_(tds.eq(1).find('td a').text(), "An editor")
|
||||||
|
|
||||||
|
def test_item_history_compat_ordered(self):
|
||||||
|
""" Make sure that apps in compatibility are ordered. """
|
||||||
|
self.addon_file(u'something', u'0.2', amo.STATUS_PUBLIC,
|
||||||
|
amo.STATUS_UNREVIEWED)
|
||||||
|
|
||||||
|
a1, c = Application.objects.get_or_create(id=amo.THUNDERBIRD.id)
|
||||||
|
a2, c = Application.objects.get_or_create(id=amo.SEAMONKEY.id)
|
||||||
|
av = AppVersion.objects.all()[0]
|
||||||
|
v = self.addon.versions.all()[0]
|
||||||
|
|
||||||
|
ApplicationsVersions.objects.create(version=v,
|
||||||
|
application=a1, min=av, max=av)
|
||||||
|
|
||||||
|
ApplicationsVersions.objects.create(version=v,
|
||||||
|
application=a2, min=av, max=av)
|
||||||
|
|
||||||
|
eq_(self.addon.versions.count(), 1)
|
||||||
|
url = reverse('editors.review', args=[self.addon.slug])
|
||||||
|
|
||||||
|
doc = pq(self.client.get(url).content)
|
||||||
|
icons = doc('.listing-body .app-icon')
|
||||||
|
eq_(icons.eq(0).attr('title'), "Firefox")
|
||||||
|
eq_(icons.eq(1).attr('title'), "SeaMonkey")
|
||||||
|
eq_(icons.eq(2).attr('title'), "Thunderbird")
|
||||||
|
|
||||||
def test_item_history_notes(self):
|
def test_item_history_notes(self):
|
||||||
v = self.addon.versions.all()[0]
|
v = self.addon.versions.all()[0]
|
||||||
v.releasenotes = 'hi'
|
v.releasenotes = 'hi'
|
||||||
|
|
|
@ -184,6 +184,11 @@ class Version(amo.models.ModelBase):
|
||||||
avs = self.apps.select_related(depth=1)
|
avs = self.apps.select_related(depth=1)
|
||||||
return self._compat_map(avs)
|
return self._compat_map(avs)
|
||||||
|
|
||||||
|
@amo.cached_property(writable=True)
|
||||||
|
def compatible_apps_ordered(self):
|
||||||
|
apps = self.compatible_apps.items()
|
||||||
|
return sorted(apps, key=lambda v: v[0].short)
|
||||||
|
|
||||||
def compatible_platforms(self):
|
def compatible_platforms(self):
|
||||||
"""Returns a dict of compatible file platforms for this version.
|
"""Returns a dict of compatible file platforms for this version.
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче