migrate /recommended to /featured bug 577350

This commit is contained in:
Robert Helmer 2010-08-01 18:17:36 -07:00 коммит произвёл Jeff Balogh
Родитель 0b4e569b58
Коммит 461626612b
5 изменённых файлов: 38 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,19 @@
{% extends "browse/base_listing.html" %}
{% block content %}
<div>
{% trans %}
With so many great add-ons available, there's something for everyone.
To get you started, here's a list of some of the most popular. Enjoy!
{% endtrans %}
</div>
{% cache addons %}
<div class="featured listing">
<div class="featured-inner">
{{ addon_listing_items(addons|list|shuffle) }}
</div>
</div>
{% endcache %}
{% endblock content %}

Просмотреть файл

@ -249,3 +249,13 @@ class TestLegacyRedirects(test_utils.TestCase):
redirects('/browse/type:4', '/search-tools/')
redirects('/search-engines', '/search-tools/')
# redirects('/browse/type:7', '/plugins/')
redirects('/recommended', '/featured')
class TestFeaturedPage(amo.test_utils.ExtraSetup, test_utils.TestCase):
fixtures = ['base/fixtures', 'addons/featured']
def test_featured_addons(self):
"""Make sure that only featured add-ons are shown"""
response = self.client.get(reverse('browse.featured'))
eq_([1003], [a.id for a in response.context['addons']])

Просмотреть файл

@ -7,6 +7,8 @@ urlpatterns = patterns('',
url('^language-tools/(?P<category>[^/]+)?$', views.language_tools,
name='browse.language-tools'),
url('^featured$', views.featured, name='browse.featured'),
url('^themes/(?P<category>[^/]+)?$', views.themes,
name='browse.themes'),

Просмотреть файл

@ -314,3 +314,7 @@ def search_tools(request, category=None):
{'categories': categories, 'category': category,
'addons': addons, 'filter': filter,
'unreviewed': unreviewed})
def featured(request, category=None):
addons = Addon.objects.featured(request.APP)
return jingo.render(request, 'browse/featured.html', {'addons': addons})

Просмотреть файл

@ -99,6 +99,9 @@ urlpatterns = patterns('',
('^addons/contribute/(\d+)/?$',
lambda r, id: redirect('addons.contribute', id, permanent=True)),
('^recommended$',
lambda r: redirect('browse.featured', permanent=True)),
)
if settings.DEBUG: