← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~ilasc/launchpad:status-reports-ui-adjustments into launchpad:master

 

Ioana Lasc has proposed merging ~ilasc/launchpad:status-reports-ui-adjustments into launchpad:master.

Commit message:
Tidy up status reports UI code

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~ilasc/launchpad/+git/launchpad/+merge/413623
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~ilasc/launchpad:status-reports-ui-adjustments into launchpad:master.
diff --git a/lib/lp/code/browser/tests/test_branchmergeproposal.py b/lib/lp/code/browser/tests/test_branchmergeproposal.py
index 979927c..d71b1f5 100644
--- a/lib/lp/code/browser/tests/test_branchmergeproposal.py
+++ b/lib/lp/code/browser/tests/test_branchmergeproposal.py
@@ -1682,7 +1682,7 @@ class TestBranchMergeProposalView(TestCaseWithFactory):
             # that do not have status reports created for them - means we
             # should only see one entry with class 'status-reports-table'
             # on the page: reports_section[0]
-            self.assertTrue(len(reports_section) == 1)
+            self.assertEqual(1, len(reports_section))
 
     def test_unmerged_commits_from_deleted_git_ref(self):
         # Even if the source Git ref has been deleted, we still know its tip
diff --git a/lib/lp/code/browser/tests/test_gitref.py b/lib/lp/code/browser/tests/test_gitref.py
index 51178fa..75b5012 100644
--- a/lib/lp/code/browser/tests/test_gitref.py
+++ b/lib/lp/code/browser/tests/test_gitref.py
@@ -229,7 +229,7 @@ class TestGitRefView(BrowserTestCase):
             # that do not have status reports created for them - means we
             # should only see 2 entries with class 'status-reports-table'
             # on the page: reports_section[0] and reports_section[1]
-            self.assertTrue(len(reports_section) == 2)
+            self.assertEqual(2, len(reports_section))
 
     def test_clone_instructions(self):
         [ref] = self.factory.makeGitRefs(paths=["refs/heads/branch"])
diff --git a/lib/lp/code/templates/git-macros.pt b/lib/lp/code/templates/git-macros.pt
index 836409d..872b6df 100644
--- a/lib/lp/code/templates/git-macros.pt
+++ b/lib/lp/code/templates/git-macros.pt
@@ -216,30 +216,32 @@
     <tal:commit-message
       replace="structure commit_message/fmt:obfuscate-email/fmt:text-to-html" />
   </dd>
-  <dd class="subordinate collapsible status-reports-table"
-      tal:define="
-        commit_sha1 commit_info/sha1;
-        status_result python:ref.getCommitStatus(commit_sha1);
-        batchnav python:view.getStatusReports(commit_sha1) if show_status_reports else None;
-        batch python:batchnav.currentBatch() if show_status_reports else None"
-      tal:condition="python: show_status_reports and batch">
-      <div class="sprite treeCollapsed">
-        <span tal:replace="structure status_result/image:boolean" />
-      </div>
-      <table class="listing" tal:condition="batch">
-        <tbody>
-          <tr tal:repeat="report batch">
-            <td tal:content="structure report/result/enumvalue:SUCCEEDED/image:boolean" />
-            <td><a tal:attributes="href report/url|nothing" tal:content="report/title" /></td>
-            <td tal:content="report/result_summary" />
-          </tr>
-        </tbody>
-      </table>
-      <div class="lower-batch-nav">
-        <tal:navigation
-          replace="structure batchnav/@@+navigation-links-lower" />
-      </div>
-  </dd>
+  <tal:status_reports condition="show_status_reports">
+    <dd class="subordinate collapsible status-reports-table"
+        tal:define="
+          commit_sha1 commit_info/sha1;
+          status_result python:ref.getCommitStatus(commit_sha1);
+          batchnav python:view.getStatusReports(commit_sha1);
+          batch python:batchnav.currentBatch()"
+        tal:condition="batch">
+        <div class="sprite treeCollapsed">
+          <span tal:replace="structure status_result/image:boolean" />
+        </div>
+        <table class="listing" tal:condition="batch">
+          <tbody>
+            <tr tal:repeat="report batch">
+              <td tal:content="structure report/result/enumvalue:SUCCEEDED/image:boolean" />
+              <td><a tal:attributes="href report/url|nothing" tal:content="report/title" /></td>
+              <td tal:content="report/result_summary" />
+            </tr>
+          </tbody>
+        </table>
+        <div class="lower-batch-nav">
+          <tal:navigation
+            replace="structure batchnav/@@+navigation-links-lower" />
+        </div>
+    </dd>
+  </tal:status_reports>
   <div tal:define="merge_proposal python:commit_info.get('merge_proposal')"
        tal:condition="merge_proposal">
     <dd class="subordinate commit-comment"