← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~abentley/launchpad/person-bug-listings into lp:launchpad

 

Aaron Bentley has proposed merging lp:~abentley/launchpad/person-bug-listings into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #887232 in Launchpad itself: "AJAX behaviour is not supported on people and team bug listings"
  https://bugs.launchpad.net/launchpad/+bug/887232

For more details, see:
https://code.launchpad.net/~abentley/launchpad/person-bug-listings/+merge/83418

= Summary =
Fix bug #887232: AJAX behaviour is not supported on people and team bug listings

== Proposed fix ==
Extract the initialization code for ListingNavigator and the widgets to a macro and use it on both bug listing pages.

== Pre-implementation notes ==
None

== Implementation details ==
There are two templates showing bug listings, AFAICT, and both are now showing the new layout: buglisting-default.pt and buglisting-embedded-advanced-search.pt  So they need common code for initializing the JS functionality.  So I pulled it into a macro.


== Tests ==
None

== Demo and Q/A ==
Go to a +bugs page for a project.  You should see the ordering widget and settings cog, and the navigation links should be green.

Go to a person's bug listing.  You should see the ordering widget and settings cog, and the navigation links should be green.



= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/bugs/templates/bugtask-macros-tableview.pt
  lib/lp/bugs/templates/buglisting-embedded-advanced-search.pt
  lib/lp/bugs/templates/buglisting-default.pt
-- 
https://code.launchpad.net/~abentley/launchpad/person-bug-listings/+merge/83418
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~abentley/launchpad/person-bug-listings into lp:launchpad.
=== modified file 'lib/lp/bugs/templates/buglisting-default.pt'
--- lib/lp/bugs/templates/buglisting-default.pt	2011-11-22 21:40:54 +0000
+++ lib/lp/bugs/templates/buglisting-default.pt	2011-11-25 16:59:25 +0000
@@ -25,6 +25,7 @@
         });
     });
   </script>
+<<<<<<< TREE
   <script type="text/javascript"
     tal:define="
       show_new_listings request/features/bugs.dynamic_bug_listings.enabled;
@@ -60,6 +61,9 @@
         });
     });
   </script>
+=======
+  <metal:activate-listing use-macro="context/@@+bugtask-macros-tableview/activate_listing_js" />
+>>>>>>> MERGE-SOURCE
 </metal:block>
 
 <body>

=== modified file 'lib/lp/bugs/templates/buglisting-embedded-advanced-search.pt'
--- lib/lp/bugs/templates/buglisting-embedded-advanced-search.pt	2011-09-02 01:19:40 +0000
+++ lib/lp/bugs/templates/buglisting-embedded-advanced-search.pt	2011-11-25 16:59:25 +0000
@@ -6,6 +6,9 @@
   metal:use-macro="view/macro:page/main_side"
   i18n:domain="launchpad">
 
+<metal:block fill-slot="head_epilogue">
+  <metal:activate-listing use-macro="context/@@+bugtask-macros-tableview/activate_listing_js" />
+</metal:block>
 <body>
   <div metal:fill-slot="side">
     <tal:menu replace="structure context/@@+global-actions" />

=== modified file 'lib/lp/bugs/templates/bugtask-macros-tableview.pt'
--- lib/lp/bugs/templates/bugtask-macros-tableview.pt	2011-01-28 22:01:27 +0000
+++ lib/lp/bugs/templates/bugtask-macros-tableview.pt	2011-11-25 16:59:25 +0000
@@ -661,4 +661,46 @@
     <div style="margin-top: 1em;"><input type="submit" name="search" value="Search" /></div>
   </form>
 </metal:advanced_search_form>
+
+
+<metal:listing_navigator define-macro="activate_listing_js">
+  <script type="text/javascript"
+    tal:define="
+      show_new_listings request/features/bugs.dynamic_bug_listings.enabled;
+      advanced_search view/shouldShowAdvancedForm"
+    tal:condition="python: show_new_listings and not advanced_search">
+    LPS.use('lp.bugs.buglisting', 'lp.ordering', 'lp.buglisting_utils',
+      function(Y) {
+        Y.on('domready', function() {
+            debugger;
+            var navigator = Y.lp.bugs.buglisting.ListingNavigator.from_page();
+            var orderby = new Y.lp.ordering.OrderByBar({
+                srcNode: Y.one('#bugs-orderby'),
+                sort_keys: [
+                    ['id', 'Bug number'],
+                    ['title', 'Bug title'],
+                    ['importance', 'Importance'],
+                    ['status', 'Status'],
+                    ['heat', 'Bug heat']
+                ],
+                active: 'importance',
+                sort_order: 'desc',
+                config_slot: true
+            });
+            orderby.render();
+            Y.on('orderbybar:sort', function(e) {
+                navigator.first_batch(e);
+            });
+            var config_node = orderby.get('config_node');
+            var list_util = new Y.lp.buglisting_utils.BugListingConfigUtil({
+                srcNode: config_node
+            });
+            list_util.render();
+            Y.on('buglisting-config-util:fields-changed', function(e) {
+                navigator.change_fields(list_util.get('field_visibility'));
+            });
+        });
+    });
+  </script>
+</metal:listing_navigator>
 </tal:root>