diff --git a/apps/amo/templates/amo/403_apps.html b/apps/amo/templates/amo/403_apps.html new file mode 100644 index 00000000000..496680627a3 --- /dev/null +++ b/apps/amo/templates/amo/403_apps.html @@ -0,0 +1,23 @@ +{% set addon_type = amo.ADDON_WEBAPP %} +{% extends 'base_modal.html' if request.is_ajax() else 'impala/base_side_categories.html' %} + +{% block title %}{{ _('Oops') }}{% endblock %} + +{# TODO(apps): Finalize copy. #} + +{% block primary %} +
+
+

Oops! Not allowed.

+
+
+

You tried to do something that you weren't allowed to.

+ {% if csrf %} + {% trans %} +

Try going back to the previous page, refreshing + and then trying again.

+ {% endtrans %} + {% endif %} +
+
+{% endblock %} diff --git a/apps/amo/templates/amo/404_apps.html b/apps/amo/templates/amo/404_apps.html new file mode 100644 index 00000000000..a7f109820d0 --- /dev/null +++ b/apps/amo/templates/amo/404_apps.html @@ -0,0 +1,43 @@ +{% set addon_type = amo.ADDON_WEBAPP %} +{% extends 'impala/base_side_categories.html' %} + +{% block title %}{{ _('Not Found') }}{% endblock %} + +{% set search = url('apps.search') %} +{% set home = url('apps.home') %} + +{# TODO(apps): Finalize copy. #} + +{% block primary %} +
+
+

We're sorry, but we can't find what you're looking for.

+
+
+

+ The page or file you requested wasn't found on our site. It's possible that + you clicked a link that's out of date, or typed in the address incorrectly. +

+ +

Or you can just jump over to some of the popular pages on our website.

+ +
+
+{% endblock %} diff --git a/apps/amo/templates/amo/500_apps.html b/apps/amo/templates/amo/500_apps.html new file mode 100644 index 00000000000..b8e99ced63e --- /dev/null +++ b/apps/amo/templates/amo/500_apps.html @@ -0,0 +1,23 @@ +{% set addon_type = amo.ADDON_WEBAPP %} +{% extends 'impala/base_side_categories.html' %} + +{% block title %}{{ _('Oops') }}{% endblock %} + +{% set home = url('apps.home') %} + +{# TODO(apps): Finalize copy. #} + +{% block primary %} +
+
+

Oops! We had an error.

+
+
+

We'll get to fixing that soon.

+

+ You can try refreshing the page, or head back to the + Apps homepage. +

+
+
+{% endblock %} diff --git a/apps/amo/tests/test_views.py b/apps/amo/tests/test_views.py index 962a33b5d6c..a29fbfbef59 100644 --- a/apps/amo/tests/test_views.py +++ b/apps/amo/tests/test_views.py @@ -28,23 +28,31 @@ from users.models import UserProfile - -def test_404_no_app(): - """Make sure a 404 without an app doesn't turn into a 500.""" - # That could happen if helpers or templates expect APP to be defined. - url = reverse('amo.monitor') - response = test.Client().get(url + 'nonsense') - eq_(response.status_code, 404) - - -def test_404_app_links(): - response = test.Client().get('/en-US/thunderbird/xxxxxxx') - eq_(response.status_code, 404) - links = pq(response.content)('[role=main] ul li a:not([href^=mailto])') - eq_(len(links), 4) - for link in links: - href = link.attrib['href'] - assert href.startswith('/en-US/thunderbird'), href +class Test404(amo.tests.TestCase): + + def test_404_no_app(self): + """Make sure a 404 without an app doesn't turn into a 500.""" + # That could happen if helpers or templates expect APP to be defined. + url = reverse('amo.monitor') + response = self.client.get(url + 'nonsense') + eq_(response.status_code, 404) + self.assertTemplateUsed(response, 'amo/404.html') + + def test_404_app_links(self): + response = self.client.get('/en-US/thunderbird/xxxxxxx') + eq_(response.status_code, 404) + self.assertTemplateUsed(response, 'amo/404.html') + links = pq(response.content)('[role=main] ul li a:not([href^=mailto])') + eq_(len(links), 4) + for link in links: + href = link.attrib['href'] + assert href.startswith('/en-US/thunderbird'), href + + @patch.object(settings, 'APP_PREVIEW', True) + def test_404_webapps(self): + response = self.client.get('/xxx', follow=True) + eq_(response.status_code, 404) + self.assertTemplateUsed(response, 'amo/404_apps.html') class TestCommon(amo.tests.TestCase): diff --git a/apps/amo/views.py b/apps/amo/views.py index d8322ba699b..1120c7561b4 100644 --- a/apps/amo/views.py +++ b/apps/amo/views.py @@ -67,19 +67,26 @@ def robots(request): def handler404(request): - return jingo.render(request, 'amo/404.html', status=404) + webapp = settings.APP_PREVIEW + template = 'amo/404%s.html' % ('_apps' if webapp else '') + return jingo.render(request, template, {'webapp': webapp}, status=404) def handler500(request): + webapp = settings.APP_PREVIEW + template = 'amo/500%s.html' % ('_apps' if webapp else '') arecibo = getattr(settings, 'ARECIBO_SERVER_URL', '') if arecibo: post(request, 500) - return jingo.render(request, 'amo/500.html', status=500) + return jingo.render(request, template, {'webapp': webapp}, status=500) def csrf_failure(request, reason=''): - return jingo.render(request, 'amo/403.html', - {'csrf': 'CSRF' in reason}, status=403) + webapp = settings.APP_PREVIEW + template = 'amo/403%s.html' % ('_apps' if webapp else '') + return jingo.render(request, template, + {'csrf': 'CSRF' in reason, 'webapp': webapp}, + status=403) def loaded(request): diff --git a/media/css/impala/prose.less b/media/css/impala/prose.less index a5a8f61941b..b862656cc35 100644 --- a/media/css/impala/prose.less +++ b/media/css/impala/prose.less @@ -31,6 +31,11 @@ margin-left: 1em; margin-bottom: 1em; } + > ul, > ol, > p { + &:first-child { + margin-top: 0; + } + } b, strong { font-weight: bold; } diff --git a/media/css/impala/site.less b/media/css/impala/site.less index dd5cdd35463..91522382238 100644 --- a/media/css/impala/site.less +++ b/media/css/impala/site.less @@ -75,13 +75,6 @@ header + .island { width: 500px; } -.full { - .border-box; - float: none; - margin: auto 0 !important; - width: 100%; -} - .primary { margin-left: 210px; position: relative; @@ -106,6 +99,13 @@ header + .island { } } +.full { + .border-box; + float: none; + margin: auto 0 !important; + width: 100%; +} + .secondary { float: left; width: 180px;