← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~dooferlad/launchpad/upcomingwork_show_incomplete_bp into lp:launchpad

 

James Tunnicliffe has proposed merging lp:~dooferlad/launchpad/upcomingwork_show_incomplete_bp into lp:launchpad.

Requested reviews:
  James Tunnicliffe (dooferlad)
  Graham Binns (gmb)
Related bugs:
  Bug #999717 in Launchpad itself: "upcomingwork view blueprints should be initially expanded if incomplete"
  https://bugs.launchpad.net/launchpad/+bug/999717

For more details, see:
https://code.launchpad.net/~dooferlad/launchpad/upcomingwork_show_incomplete_bp/+merge/105846

The upcomingwork view shows blueprints that a team or individual is working on. Currently all blueprint work items start in the collapsed view, but we have had a request to have incomplete blueprints to be initially expanded.

This change adds an alt tag to the percentage complete image as well as a title, so it can be reliably found in the DOM and the information encoded in the alt tag used to find if a blueprint is complete or not. Of course, this has a pleasing side-effect of making the page more accessible.
-- 
https://code.launchpad.net/~dooferlad/launchpad/upcomingwork_show_incomplete_bp/+merge/105846
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.
=== modified file 'lib/lp/registry/browser/person.py'
--- lib/lp/registry/browser/person.py	2012-05-07 16:43:13 +0000
+++ lib/lp/registry/browser/person.py	2012-05-17 13:36:23 +0000
@@ -4520,6 +4520,11 @@
         return '{0:.0f}'.format(
             100.0 * len(self.done_items) / len(self._items))
 
+    @property
+    def has_incomplete_work(self):
+        """Return True if there are incomplete work items."""
+        return len(self.done_items) < len(self._items)
+
     def append(self, item):
         self._items.append(item)
 

=== modified file 'lib/lp/registry/browser/tests/test_person_upcomingwork.py'
--- lib/lp/registry/browser/tests/test_person_upcomingwork.py	2012-04-05 13:49:54 +0000
+++ lib/lp/registry/browser/tests/test_person_upcomingwork.py	2012-05-17 13:36:23 +0000
@@ -173,6 +173,16 @@
         container.append(self.MockWorkItem(True))
         self.assertEqual('67', container.percent_done)
 
+    def test_has_incomplete_work(self):
+        # If there are incomplete work items,
+        # WorkItemContainer.has_incomplete_work will return True.
+        container = WorkItemContainer()
+        item = self.MockWorkItem(False)
+        container.append(item)
+        self.assertTrue(container.has_incomplete_work)
+        item.is_complete = True
+        self.assertFalse(container.has_incomplete_work)
+
 
 class TestPersonUpcomingWork(BrowserTestCase):
 

=== modified file 'lib/lp/registry/templates/person-upcomingwork.pt'
--- lib/lp/registry/templates/person-upcomingwork.pt	2012-04-05 13:45:31 +0000
+++ lib/lp/registry/templates/person-upcomingwork.pt	2012-05-17 13:36:23 +0000
@@ -89,7 +89,10 @@
       <tbody>
         <tr class="expandable">
           <td>
-            <a href="#" class="expander">&nbsp;</a>
+            <a href="#" class="expander"
+              tal:condition="not: container/has_incomplete_work">&nbsp;</a>
+            <a href="#" class="expander expanded"
+              tal:condition="container/has_incomplete_work">&nbsp;</a>
             <span tal:replace="structure container/html_link" />
           </td>
           <td tal:content="structure container/target_link" />


References