Repository: mdn/kuma

Issue:
Delete templates used in the old design, replace them with redesign-specific templates (like profile_redesign.html)



Discussion:
@lmorchard, you mentioned the performance work should involve cleaning up "half the code from templates." Am I correct that you meant KumaScript templates, not Jinja templates?

I think he meant Jinja templates...

Yup, meant jinja templates. Most of them are forked for both old and new design

Nice. I have tasks for correcting the few I know about. Good to know there are more, I'll go searching.


Resolving patch:
diff --git a/apps/devmo/views.py b/apps/devmo/views.py
--- a/apps/devmo/views.py
+++ b/apps/devmo/views.py
@@ -75,8 +75,6 @@ def profile_view(request, username):
         show_manage_roles_button = (len(roles_by_team) > 0)
 
     template = 'devmo/profile.html'
-    if flag_is_active(request, 'redesign'):
-            template = 'devmo/profile_redesign.html'
 
     return render(request, template, dict(
         profile=profile, demos=demos, demos_paginator=demos_paginator,


Test patch:
diff --git a/apps/wiki/tests/test_templates.py b/apps/wiki/tests/test_templates.py
--- a/apps/wiki/tests/test_templates.py
+++ b/apps/wiki/tests/test_templates.py
@@ -79,8 +79,8 @@ def test_document_view(self):
         response = self.client.get(r.document.get_absolute_url())
         eq_(200, response.status_code)
         doc = pq(response.content)
-        eq_(r.document.title, doc('article header h1.page-title').text())
-        eq_(r.document.html, doc('div#wikiArticle').text())
+        eq_(r.document.title, doc('main#content div.document-head h1').text())
+        eq_(r.document.html, doc('article#wikiArticle').text())
 
     @attr("breadcrumbs")
     def test_document_breadcrumbs(self):
@@ -89,13 +89,13 @@ def test_document_breadcrumbs(self):
         response = self.client.get(d1.get_absolute_url())
         eq_(200, response.status_code)
         doc = pq(response.content)
-        eq_(d1.title, doc('article header h1.page-title').text())
-        eq_(d1.title, doc('nav.crumbs').text())
+        eq_(d1.title, doc('main#content div.document-head h1').text())
+        eq_(d1.title, doc('nav.crumbs li:last-child').text())
         response = self.client.get(d2.get_absolute_url())
         eq_(200, response.status_code)
         doc = pq(response.content)
-        eq_(d2.title, doc('article header h1.page-title').text())
-        crumbs = "%s %s" % (d1.title, d2.title)
+        eq_(d2.title, doc('main#content div.document-head h1').text())
+        crumbs = "MDN %s %s" % (d1.title, d2.title)
         eq_(crumbs, doc('nav.crumbs').text())
 
     def test_english_document_no_approved_content(self):
@@ -104,9 +104,9 @@ def test_english_document_no_approved_content(self):
         response = self.client.get(r.document.get_absolute_url())
         eq_(200, response.status_code)
         doc = pq(response.content)
-        eq_(r.document.title, doc('article header h1.page-title').text())
+        eq_(r.document.title, doc('main#content div.document-head h1').text())
         eq_("This article doesn't have approved content yet.",
-            doc('div#wikiArticle').text())
+            doc('article#wikiArticle').text())
 
     def test_translation_document_no_approved_content(self):
         """Load a non-English document with no approved content, with a parent
@@ -117,14 +117,14 @@ def test_translation_document_no_approved_content(self):
         response = self.client.get(d2.get_absolute_url())
         eq_(200, response.status_code)
         doc = pq(response.content)
-        eq_(d2.title, doc('article header h1.page-title').text())
+        eq_(d2.title, doc('main#content div.document-head h1').text())
         # HACK: fr doc has different message if locale/ is updated
         ok_(
             ("This article doesn't have approved content yet." in
-                doc('div#wikiArticle').text())
+                doc('article#wikiArticle').text())
             or
             ("Cet article n'a pas encore de contenu" in
-                doc('div#wikiArticle').text())
+                doc('article#wikiArticle').text())
            )
 
     def test_document_fallback_with_translation(self):
@@ -136,7 +136,7 @@ def test_document_fallback_with_translation(self):
         url = reverse('wiki.document', args=[d2.slug], locale='fr')
         response = self.client.get(url)
         doc = pq(response.content)
-        eq_(d2.title, doc('article header h1.page-title').text())
+        eq_(d2.title, doc('main#content div.document-head h1').text())
 
         # Fallback message is shown.
         eq_(1, len(doc('#doc-pending-fallback')))
@@ -144,7 +144,7 @@ def test_document_fallback_with_translation(self):
         # on its localization.
         doc('#doc-pending-fallback').remove()
         # Included content is English.
-        eq_(pq(r.document.html).text(), doc('div#wikiArticle').text())
+        eq_(pq(r.document.html).text(), doc('article#wikiArticle').text())
 
     def test_document_fallback_no_translation(self):
         """The document template falls back to English if no translation
@@ -153,7 +153,7 @@ def test_document_fallback_no_translation(self):
         url = reverse('wiki.document', args=[r.document.slug], locale='fr')
         response = self.client.get(url)
         doc = pq(response.content)
-        eq_(r.document.title, doc('article header h1.page-title').text())
+        eq_(r.document.title, doc('main#content div.document-head h1').text())
 
         # Fallback message is shown.
         eq_(1, len(doc('#doc-pending-fallback')))
@@ -161,7 +161,7 @@ def test_document_fallback_no_translation(self):
         # on its localization.
         doc('#doc-pending-fallback').remove()
         # Included content is English.
-        eq_(pq(r.document.html).text(), doc('div#wikiArticle').text())
+        eq_(pq(r.document.html).text(), doc('article#wikiArticle').text())
 
     def test_redirect(self):
         """Make sure documents with REDIRECT directives redirect properly.
@@ -210,14 +210,14 @@ def test_non_localizable_translate_disabled(self):
         d = document(is_localizable=True, save=True)
         resp = self.client.get(d.get_absolute_url())
         doc = pq(resp.content)
-        assert 'Add translation' in doc('#tool-menus .menu li').text()
+        assert 'Add a translation' in doc('.page-buttons #translations li').text()
 
         # Make it non-localizable
         d.is_localizable = False
         d.save()
         resp = self.client.get(d.get_absolute_url())
         doc = pq(resp.content)
-        assert 'Add translation' not in doc('#tool-menus .menu li').text()
+        assert 'Add a translation' not in doc('.page-buttons #translations li').text()
 
     @attr('toc')
     def test_toc_depth(self):
@@ -232,7 +232,7 @@ def test_toc_depth(self):
         r = revision(save=True, content=doc_content, is_approved=True)
         response = self.client.get(r.document.get_absolute_url())
         eq_(200, response.status_code)
-        ok_('<div class="page-toc">' in response.content)
+        ok_('<div id="toc"' in response.content)
         new_r = revision(document=r.document, content=r.content,
                          toc_depth=0, is_approved=True)
         new_r.save()
diff --git a/apps/wiki/tests/test_views.py b/apps/wiki/tests/test_views.py
--- a/apps/wiki/tests/test_views.py
+++ b/apps/wiki/tests/test_views.py
@@ -1849,10 +1849,10 @@ def assert_tag_state(yes_tags, no_tags):
                                           args=[doc.full_path]), data)
             page = pq(response.content)
             for t in yes_tags:
-                eq_(1, page.find('.page-tags li a:contains("%s")' % t).length,
+                eq_(1, page.find('.tag-list li a:contains("%s")' % t).length,
                     '%s should NOT appear in document view tags' % t)
             for t in no_tags:
-                eq_(0, page.find('.page-tags li a:contains("%s")' % t).length,
+                eq_(0, page.find('.tag-list li a:contains("%s")' % t).length,
                     '%s should appear in document view tags' % t)
 
             # Check for the document slug (title in feeds) in the tag listing
@@ -1918,8 +1918,7 @@ def test_review_tags(self, get_current):
         # Now, ensure that warning boxes appear for the review tags.
         response = client.get(reverse('wiki.document', args=[doc.full_path]), data)
         page = pq(response.content)
-        eq_(1, page.find('.warning.review-technical').length)
-        eq_(1, page.find('.warning.review-editorial').length)
+        eq_(2, page.find('.warning.warning-review').length)
 
         # Ensure the page appears on the listing pages
         response = client.get(reverse('wiki.list_review'))
@@ -1956,8 +1955,7 @@ def test_review_tags(self, get_current):
         # Ensure only one of the tags' warning boxes appears, now.
         response = client.get(reverse('wiki.document', args=[doc.full_path]), data)
         page = pq(response.content)
-        eq_(0, page.find('.warning.review-technical').length)
-        eq_(1, page.find('.warning.review-editorial').length)
+        eq_(1, page.find('.warning.warning-review').length)
 
         # Ensure the page appears on the listing pages
         response = client.get(reverse('wiki.list_review'))