From 71fc00bfacde170b8d03174fbb4df4362176bd14 Mon Sep 17 00:00:00 2001 From: Chris Van Date: Thu, 10 Nov 2011 17:01:46 -0500 Subject: [PATCH] fix heading and page title for devhub apps pages (bug 701230) --- apps/devhub/helpers.py | 2 +- apps/devhub/templates/devhub/base.html | 22 ++++++++++++++----- apps/devhub/templates/devhub/base_impala.html | 4 ++-- apps/devhub/tests/test_views.py | 20 +++++++++++++++-- media/css/impala/developers.less | 14 ++++++++++++ media/css/impala/header.less | 4 ++-- media/css/zamboni/amo_headerfooter.css | 16 +------------- templates/base.html | 6 ++--- templates/impala/base.html | 4 ++-- 9 files changed, 59 insertions(+), 33 deletions(-) diff --git a/apps/devhub/helpers.py b/apps/devhub/helpers.py index d74592ceb3..1a479b52e8 100644 --- a/apps/devhub/helpers.py +++ b/apps/devhub/helpers.py @@ -32,7 +32,7 @@ def dev_page_title(context, title=None, addon=None): else: devhub = _('Developer Hub') title = '%s :: %s' % (title, devhub) if title else devhub - return page_title(context, title) + return page_title(context, title, force_webapps=context.get('webapp')) @register.function diff --git a/apps/devhub/templates/devhub/base.html b/apps/devhub/templates/devhub/base.html index 0276b379bd..e9a8fa623e 100644 --- a/apps/devhub/templates/devhub/base.html +++ b/apps/devhub/templates/devhub/base.html @@ -20,17 +20,27 @@ {% block site_header_title %}

- - {# l10n: 'Developer Hub' is larger/emphasized and should appear in the tag' #} - {{ _('Add-on Developer Hub')|safe }} + + {% if webapp %} + Apps Developer Preview + {% else %} + {# L10n: Text in small tag is smaller and on its own line. #} + {% trans %} + Add-on Developer Hub + {% endtrans %} + {% endif %}

{% endblock %} {% block aux_nav %} -
  • - {{ _('Back to Add-ons') }}
  • +
  • + {% if webapp %} + {{ _('Back to Apps') }} + {% else %} + {{ _('Back to Add-ons') }} + {% endif %} +
  • {% endblock %} {% block navbar %} diff --git a/apps/devhub/templates/devhub/base_impala.html b/apps/devhub/templates/devhub/base_impala.html index edba7e0caf..6632144bd9 100644 --- a/apps/devhub/templates/devhub/base_impala.html +++ b/apps/devhub/templates/devhub/base_impala.html @@ -27,9 +27,9 @@ {% block site_header_title %}

    - + {% if webapp %} - {% trans %}App Developer Preview{% endtrans %} + Apps Developer Preview {% else %} {# L10n: Text in small tag is smaller and on its own line #} {% trans %} diff --git a/apps/devhub/tests/test_views.py b/apps/devhub/tests/test_views.py index b633a5d8ba..72881ced04 100644 --- a/apps/devhub/tests/test_views.py +++ b/apps/devhub/tests/test_views.py @@ -149,8 +149,19 @@ class TestDashboard(HubTest): def setUp(self): super(TestDashboard, self).setUp() self.url = reverse('devhub.addons') + self.apps_url = reverse('devhub.apps') eq_(self.client.get(self.url).status_code, 200) + def test_addons_page_title(self): + eq_(pq(self.client.get(self.url).content)('title').text(), + 'Manage My Add-ons :: Developer Hub :: Add-ons for Firefox') + + @mock.patch.object(settings, 'APP_PREVIEW', False) + def test_apps_page_title(self): + waffle.models.Flag.objects.create(name='accept-webapps', everyone=True) + eq_(pq(self.client.get(self.apps_url).content)('title').text(), + 'Manage My Apps :: Developer Hub :: Apps Marketplace') + def get_action_links(self, addon_id): r = self.client.get(self.url) doc = pq(r.content) @@ -216,7 +227,7 @@ class TestDashboard(HubTest): waffle.models.Flag.objects.create(name='accept-webapps', everyone=True) app = Addon.objects.get(id=self.clone_addon(1)[0]) app.update(type=amo.ADDON_WEBAPP) - doc = pq(self.client.get(reverse('devhub.apps')).content) + doc = pq(self.client.get(self.apps_url).content) item = doc('.item[data-addonid=%s]' % app.id) assert item.find('p.downloads'), 'Expected weekly downloads' assert not item.find('p.users'), 'Unexpected ADU' @@ -238,7 +249,7 @@ class TestDashboard(HubTest): waffle.models.Flag.objects.create(name='accept-webapps', everyone=True) app = Addon.objects.get(id=self.clone_addon(1)[0]) app.update(type=amo.ADDON_WEBAPP, status=amo.STATUS_NULL) - doc = pq(self.client.get(reverse('devhub.apps')).content) + doc = pq(self.client.get(self.apps_url).content) assert doc('.item[data-addonid=%s] p.incomplete' % app.id), ( 'Expected message about incompleted add-on') @@ -2933,6 +2944,11 @@ class BaseWebAppTest(BaseUploadTest, UploadAddon, amo.tests.TestCase): class TestCreateWebApp(BaseWebAppTest): + @mock.patch.object(settings, 'APP_PREVIEW', False) + def test_page_title(self): + eq_(pq(self.client.get(self.url).content)('title').text(), + 'Step 2 :: Developer Hub :: Apps Marketplace') + def test_post_app_redirect(self): r = self.post() addon = Addon.objects.get() diff --git a/media/css/impala/developers.less b/media/css/impala/developers.less index 5a7f5cae7b..256e54e1ca 100644 --- a/media/css/impala/developers.less +++ b/media/css/impala/developers.less @@ -1,5 +1,19 @@ @import 'lib'; +.developer-hub #masthead .site-title { + small, strong { + display: block; + } + strong { + font-size: 48px; + line-height: 40px; + } +} + +.developer-hub #page #masthead .site-title { + margin-top: -10px; +} + .html-rtl.developer-hub { .menu-nav { margin-right: 0; diff --git a/media/css/impala/header.less b/media/css/impala/header.less index 3813ceb9f7..56134cfb45 100644 --- a/media/css/impala/header.less +++ b/media/css/impala/header.less @@ -2,11 +2,11 @@ .amo-header { font-family: @head-sans; - margin-bottom: 35px; + margin-bottom: 25px; } #masthead { - padding-top: 35px; + padding-top: 45px; max-width: 600px; } diff --git a/media/css/zamboni/amo_headerfooter.css b/media/css/zamboni/amo_headerfooter.css index f52701b466..18fd05324b 100644 --- a/media/css/zamboni/amo_headerfooter.css +++ b/media/css/zamboni/amo_headerfooter.css @@ -83,24 +83,10 @@ body { .site-title { padding-top: 16px; - max-width: 512px; + max-width: 600px; margin-bottom: 0; } -.developer-hub .site-title { - padding-top: 20px; -} - -.developer-hub .site-title small { - display: block; -} - -.developer-hub .site-title strong { - display: block; - line-height: 40px; - font-size: 48px; -} - html[lang=it] .site-title a { font-size: 32px; } diff --git a/templates/base.html b/templates/base.html index 65d004ec62..7a54a3ab2b 100644 --- a/templates/base.html +++ b/templates/base.html @@ -63,9 +63,9 @@ -
    -