diff --git a/apps/devhub/templates/devhub/addons/listing/items.html b/apps/devhub/templates/devhub/addons/listing/items.html index a09eb119dc..1eee0cb283 100644 --- a/apps/devhub/templates/devhub/addons/listing/items.html +++ b/apps/devhub/templates/devhub/addons/listing/items.html @@ -24,9 +24,15 @@
  • {{ _('Latest version: {1}'| f(link, addon.current_version))|xssafe }}
  • {% endif %} - {# L10n: {0} is a date. #} -
  • {{ _('Last updated: {0}'| + {% if sorting == 'created' %} + {# L10n: {0} is a date. #} +
  • {{ _('Created: {0}'| + f(addon.created|datetime))|safe }}
  • + {% else %} + {# L10n: {0} is a date. #} +
  • {{ _('Last updated: {0}'| f(addon.last_updated|datetime))|safe }}
  • + {% endif %} {% endif %}
  • {{ _('Status:') }} diff --git a/apps/devhub/tests/test_views.py b/apps/devhub/tests/test_views.py index 5d343fe676..8cd747d3f3 100644 --- a/apps/devhub/tests/test_views.py +++ b/apps/devhub/tests/test_views.py @@ -11,6 +11,7 @@ from django.core import mail from django.utils.http import urlencode import jingo +from jingo.helpers import datetime as datetime_filter import mock from nose.tools import eq_, assert_not_equal, assert_raises from nose.plugins.attrib import attr @@ -323,6 +324,26 @@ class TestDashboard(HubTest): eq_(doc('.blog-posts li a').eq(0).text(), "hi 0") eq_(doc('.blog-posts li a').eq(4).text(), "hi 4") + def test_sort_created_filter(self): + a_pk = self.clone_addon(1)[0] + addon = Addon.objects.get(pk=a_pk) + response = self.client.get(self.url + '?sort=created') + doc = pq(response.content) + eq_(doc('.item-details').length, 1) + d = doc('.item-details .date-created') + eq_(d.length, 1) + eq_(d.remove('strong').text(), datetime_filter(addon.created)) + + def test_sort_updated_filter(self): + a_pk = self.clone_addon(1)[0] + addon = Addon.objects.get(pk=a_pk) + response = self.client.get(self.url) + doc = pq(response.content) + eq_(doc('.item-details').length, 1) + d = doc('.item-details .date-updated') + eq_(d.length, 1) + eq_(d.remove('strong').text(), datetime_filter(addon.last_updated)) + class TestAppDashboard(AppHubTest):