← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~edwin-grubbs/launchpad/bug-652232-person-code-action-links into lp:launchpad/devel

 

Edwin Grubbs has proposed merging lp:~edwin-grubbs/launchpad/bug-652232-person-code-action-links into lp:launchpad/devel.

Requested reviews:
  Guilherme Salgado (salgado): ui
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #652232 person/team code page is missing action links
  https://bugs.launchpad.net/bugs/652232


Summary
-------

Moved action links for code.lp.net/~$person and
code.lp.net/~$person/$project into sidebar for consistency.


Implementation details
----------------------

Moved links into the sidebar.
    lib/lp/code/templates/person-branches.pt
    lib/lp/code/templates/person-codesummary.pt

Removed #page-summary css, since it's no longer used.
    lib/canonical/launchpad/icing/style.css

The person code pages and the person product code pages now share the
same template.
    lib/lp/code/browser/branchlisting.py
    lib/lp/code/browser/configure.zcml
    lib/lp/code/templates/personproduct-branches.pt

Fixed tests:
    lib/lp/code/stories/branches/xx-branchmergeproposal-listings.txt
    lib/lp/code/stories/branches/xx-person-branches.txt
    lib/lp/code/stories/branches/xx-personproduct-branch-listings.txt

Tests
-----

./bin/test -vv -t 'xx-branchmergeproposal-listings|xx-person-branches|xx-personproduct-branch-listings'

Demo and Q/A
------------

* Open http://code.launchpad.dev/~mark/
    * The links should be in the sidebar, and clicking on the links
      should take you to a page with the sidebar, except for the "active
      reviews" page.
    * If you log in as that user, you should see the "Register a branch"
      link.
* Open http://code.launchpad.dev/~mark/firefox
    * The links should be in the sidebar, and clicking on the links
      should take you to a page with the sidebar, except for the "active
      reviews" page.
    * Even if you are logged in as that user, you should never see the
      "Register a branch" link, since that page only registers branches
      under +junk, so it would be confusing because the list of firefox
      branches wouldn't show it.
-- 
https://code.launchpad.net/~edwin-grubbs/launchpad/bug-652232-person-code-action-links/+merge/38574
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~edwin-grubbs/launchpad/bug-652232-person-code-action-links into lp:launchpad/devel.
=== modified file 'lib/canonical/launchpad/icing/style.css'
--- lib/canonical/launchpad/icing/style.css	2010-09-21 01:31:47 +0000
+++ lib/canonical/launchpad/icing/style.css	2010-10-15 17:32:48 +0000
@@ -450,7 +450,7 @@
   background-color: #d18b39;
 }
 .tab-branches h1, .tab-branches h2, .tab-branches h3,
-.tab-branches #application-footer strong, .tab-branches #application-summary strong, .tab-branches #page-summary strong.count {
+.tab-branches #application-footer strong, .tab-branches #application-summary strong {
   background: none;
   color: #d18b39;
 }

=== modified file 'lib/lp/code/browser/branchlisting.py'
--- lib/lp/code/browser/branchlisting.py	2010-09-28 22:21:51 +0000
+++ lib/lp/code/browser/branchlisting.py	2010-10-15 17:32:48 +0000
@@ -976,6 +976,10 @@
     """Base class used for different person listing views."""
 
     @property
+    def show_action_menu(self):
+        return check_permission('launchpad.Edit', self.context)
+
+    @property
     def initial_values(self):
         values = super(PersonBaseBranchListingView, self).initial_values
         values['sort_by'] = BranchListingSort.MOST_RECENTLY_CHANGED_FIRST
@@ -1666,6 +1670,7 @@
     """A base view used for other person-product branch listings."""
 
     no_sort_by = (BranchListingSort.DEFAULT, BranchListingSort.PRODUCT)
+    show_action_menu = False
 
     @property
     def person(self):

=== modified file 'lib/lp/code/browser/configure.zcml'
--- lib/lp/code/browser/configure.zcml	2010-10-06 18:53:53 +0000
+++ lib/lp/code/browser/configure.zcml	2010-10-15 17:32:48 +0000
@@ -1072,7 +1072,7 @@
         permission="zope.Public"
         facet="branches"
         name="+branches"
-        template="../templates/personproduct-branches.pt"
+        template="../templates/person-branches.pt"
         />
     <browser:page
         for="lp.registry.interfaces.personproduct.IPersonProduct"
@@ -1081,7 +1081,7 @@
         permission="zope.Public"
         facet="branches"
         name="+subscribedbranches"
-        template="../templates/personproduct-branches.pt"
+        template="../templates/person-branches.pt"
         />
     <browser:page
         for="lp.registry.interfaces.personproduct.IPersonProduct"
@@ -1090,7 +1090,7 @@
         permission="zope.Public"
         facet="branches"
         name="+registeredbranches"
-        template="../templates/personproduct-branches.pt"
+        template="../templates/person-branches.pt"
         />
     <browser:page
         for="lp.registry.interfaces.personproduct.IPersonProduct"

=== modified file 'lib/lp/code/stories/branches/xx-branchmergeproposal-listings.txt'
--- lib/lp/code/stories/branches/xx-branchmergeproposal-listings.txt	2010-09-28 19:25:54 +0000
+++ lib/lp/code/stories/branches/xx-branchmergeproposal-listings.txt	2010-10-15 17:32:48 +0000
@@ -92,8 +92,10 @@
 and approved merges.
 
     >>> browser.open('http://code.launchpad.dev/~albert')
-    >>> print_tag_with_id(browser.contents, 'page-summary')
-    1 owned branch, 1 registered branch, 1 subscribed branch
+    >>> print_tag_with_id(browser.contents, 'portlet-person-codesummary')
+    1 owned branch
+    1 registered branch
+    1 subscribed branch
     1 active review
 
 The person's active reviews also lists all of their currently requested

=== modified file 'lib/lp/code/stories/branches/xx-person-branches.txt'
--- lib/lp/code/stories/branches/xx-person-branches.txt	2010-09-22 01:05:15 +0000
+++ lib/lp/code/stories/branches/xx-person-branches.txt	2010-10-15 17:32:48 +0000
@@ -99,8 +99,10 @@
 
     >>> eric_browser = setupBrowser(auth="Basic eric@xxxxxxxxxxx:test")
     >>> eric_browser.open('http://code.launchpad.dev/~eric')
-    >>> print_tag_with_id(eric_browser.contents, 'page-summary')
-    1 owned branch, 1 registered branch, 1 subscribed branch
+    >>> print_tag_with_id(eric_browser.contents, 'portlet-person-codesummary')
+    1 owned branch
+    1 registered branch
+    1 subscribed branch
     0 active reviews
 
 Now we'll create another branch, and unsubscribe the owner from it.
@@ -111,6 +113,9 @@
     >>> logout()
 
     >>> eric_browser.open('http://code.launchpad.dev/~eric')
-    >>> print_tag_with_id(eric_browser.contents, 'page-summary')
-    2 owned branches, 2 registered branches, 1 subscribed branch
+    >>> print_tag_with_id(
+    ...     eric_browser.contents, 'portlet-person-codesummary')
+    2 owned branches
+    2 registered branches
+    1 subscribed branch
     0 active reviews

=== modified file 'lib/lp/code/stories/branches/xx-personproduct-branch-listings.txt'
--- lib/lp/code/stories/branches/xx-personproduct-branch-listings.txt	2009-07-24 02:25:27 +0000
+++ lib/lp/code/stories/branches/xx-personproduct-branch-listings.txt	2010-10-15 17:32:48 +0000
@@ -1,4 +1,6 @@
-= Person / Product listings =
+=========================
+Person / Product listings
+=========================
 
 These listings are where only the branches associated with the product and the
 person are shown, rather than all of the person's branches.
@@ -36,8 +38,8 @@
     >>> logout()
 
     >>> browser.open('http://code.launchpad.dev/~eric/fooix')
-    >>> print_tag_with_id(browser.contents, 'page-summary')
-    2 owned branches, ...
+    >>> print_tag_with_id(browser.contents, 'portlet-person-codesummary')
+    2 owned branches ...
     >>> print_tag_with_id(browser.contents, 'branchtable')
     Name                         ...
     lp://dev/~eric/fooix/feature ...

=== modified file 'lib/lp/code/templates/person-branches.pt'
--- lib/lp/code/templates/person-branches.pt	2009-09-17 00:27:40 +0000
+++ lib/lp/code/templates/person-branches.pt	2010-10-15 17:32:48 +0000
@@ -3,37 +3,40 @@
   xmlns:tal="http://xml.zope.org/namespaces/tal";
   xmlns:metal="http://xml.zope.org/namespaces/metal";
   xmlns:i18n="http://xml.zope.org/namespaces/i18n";
-  metal:use-macro="view/macro:page/main_only"
+  metal:use-macro="view/macro:page/main_side"
   i18n:domain="launchpad">
 
 <body>
 
-
-<div metal:fill-slot="main"
-     tal:define="branches view/branches">
-
-  <div style="float:right" id="floating-links"
-       tal:define="menu context/menu:branches">
+<metal:side fill-slot="side">
+
+  <div tal:define="menu context/menu:branches"
+       tal:condition="view/show_action_menu"
+       class="first portlet">
     <div tal:define="link menu/addbranch"
          tal:condition="link/enabled"
          tal:content="structure link/render" />
   </div>
 
+  <tal:summary replace="structure context/@@+codesummary"/>
+
+</metal:side>
+
+<div metal:fill-slot="main"
+     tal:define="branches view/branches">
+
   <div id="no-branch-message" tal:condition="not: view/branch_count">
     <p tal:content="view/no_branch_message">
       There are no branches related to Eric the Viking today.
     </p>
   </div>
 
-  <tal:summary replace="structure context/@@+codesummary"/>
-
   <tal:has-branches condition="view/branch_count">
-
     <tal:branchlisting
         content="structure branches/@@+branch-listing" />
   </tal:has-branches>
 
-  <div tal:replace="structure context/@@+portlet-teambranches" />
+  <tal:teambranches replace="structure context/@@+portlet-teambranches" />
 </div>
 </body>
 </html>

=== modified file 'lib/lp/code/templates/person-codesummary.pt'
--- lib/lp/code/templates/person-codesummary.pt	2009-08-27 05:42:10 +0000
+++ lib/lp/code/templates/person-codesummary.pt	2010-10-15 17:32:48 +0000
@@ -2,28 +2,35 @@
   xmlns:tal="http://xml.zope.org/namespaces/tal";
   xmlns:metal="http://xml.zope.org/namespaces/metal";
   xmlns:i18n="http://xml.zope.org/namespaces/i18n";
-  id="page-summary"
+  id="portlet-person-codesummary"
+  class="portlet"
   tal:define="menu context/menu:branches"
   tal:condition="menu/show_summary">
 
-  <p>
-    <strong class="count" tal:content="menu/owned_branch_count">100</strong>
-    <tal:link condition="menu"
-        replace="structure menu/owned/render"
-        />,
-    <strong class="count" tal:content="menu/registered_branch_count">100</strong>
-    <tal:link condition="menu"
-        replace="structure menu/registered/render"
-        />,
-    <strong class="count" tal:content="menu/subscribed_branch_count">100</strong>
-    <tal:link condition="menu"
-        replace="structure menu/subscribed/render"
-        />
-  </p>
-  <p id="merge-counts">
-    <strong class="count" tal:content="menu/active_review_count">5</strong>
-    <tal:link condition="menu"
-        replace="structure menu/active_reviews/render"
-        />
-  </p>
+  <table>
+    <tr class="code-links">
+      <td class="code-count" tal:content="menu/owned_branch_count">100</td>
+      <td tal:condition="menu"
+          tal:content="structure menu/owned/render"
+          />
+    </tr>
+    <tr>
+      <td class="code-count" tal:content="menu/registered_branch_count">100</td>
+      <td tal:condition="menu"
+          tal:content="structure menu/registered/render"
+          />
+    </tr>
+    <tr>
+      <td class="code-count" tal:content="menu/subscribed_branch_count">100</td>
+      <td tal:condition="menu"
+          tal:content="structure menu/subscribed/render"
+          />
+    </tr>
+    <tr id="merge-counts">
+      <td class="code-count" tal:content="menu/active_review_count">5</td>
+      <td tal:condition="menu"
+          tal:content="structure menu/active_reviews/render"
+          />
+    </tr>
+  </table>
 </div>

=== removed file 'lib/lp/code/templates/personproduct-branches.pt'
--- lib/lp/code/templates/personproduct-branches.pt	2009-09-17 00:27:40 +0000
+++ lib/lp/code/templates/personproduct-branches.pt	1970-01-01 00:00:00 +0000
@@ -1,31 +0,0 @@
-<html
-  xmlns="http://www.w3.org/1999/xhtml";
-  xmlns:tal="http://xml.zope.org/namespaces/tal";
-  xmlns:metal="http://xml.zope.org/namespaces/metal";
-  xmlns:i18n="http://xml.zope.org/namespaces/i18n";
-  metal:use-macro="view/macro:page/main_only"
-  i18n:domain="launchpad">
-
-<body>
-
-<div metal:fill-slot="main"
-     tal:define="branches view/branches">
-
-  <div id="no-branch-message" tal:condition="not: view/branch_count">
-    <p tal:content="view/no_branch_message">
-      There are no branches related to Eric the Viking today.
-    </p>
-  </div>
-
-  <tal:summary replace="structure context/@@+codesummary"/>
-
-  <tal:has-branches condition="view/branch_count">
-
-    <tal:branchlisting
-        content="structure branches/@@+branch-listing" />
-  </tal:has-branches>
-
-  <div tal:replace="structure context/@@+portlet-teambranches" />
-</div>
-</body>
-</html>


Follow ups