launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #06451
[Merge] lp:~wallyworld/launchpad/recipes-link-team-homepage-937689 into lp:launchpad
Ian Booth has proposed merging lp:~wallyworld/launchpad/recipes-link-team-homepage-937689 into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #937689 in Launchpad itself: "add a link on the team code home page for the +recipes view"
https://bugs.launchpad.net/launchpad/+bug/937689
For more details, see:
https://code.launchpad.net/~wallyworld/launchpad/recipes-link-team-homepage-937689/+merge/93973
== Implementation ==
Add Source package recipes link to person/team code homepage when code.simplified_branches_menu.enabled feature flag is enabled. The link is added to the right side portlet. The flag is on by default for everyone and without the flag the portlet is laid out differently so there's no point providing an implementation for when the flag is off.
The same tales macro is used for IPersonProduct view so we need to set the enabled flag for the link only when the context is IPerson.
== Test ==
Add new test to TestSimplifiedPersonBranchesView:
- test_branch_list_recipes_link
== Lint ==
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/code/browser/branchlisting.py
lib/lp/code/browser/tests/test_branchlisting.py
lib/lp/code/templates/person-codesummary.pt
--
https://code.launchpad.net/~wallyworld/launchpad/recipes-link-team-homepage-937689/+merge/93973
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wallyworld/launchpad/recipes-link-team-homepage-937689 into lp:launchpad.
=== modified file 'lib/lp/code/browser/branchlisting.py'
--- lib/lp/code/browser/branchlisting.py 2012-02-08 04:26:40 +0000
+++ lib/lp/code/browser/branchlisting.py 2012-02-21 12:21:18 +0000
@@ -839,7 +839,7 @@
usedfor = IPerson
facet = 'branches'
links = ['registered', 'owned', 'subscribed', 'addbranch',
- 'active_reviews', 'mergequeues',
+ 'active_reviews', 'mergequeues', 'source_package_recipes',
'simplified_subscribed', 'simplified_registered',
'simplified_owned', 'simplified_active_reviews']
extra_attributes = [
@@ -924,6 +924,12 @@
'+activereviews',
'Active reviews')
+ def source_package_recipes(self):
+ return Link(
+ '+recipes',
+ 'Source package recipes',
+ enabled=IPerson.providedBy(self.context))
+
@cachedproperty
def registered_branch_count(self):
"""Return the number of branches registered by self.person."""
@@ -990,6 +996,7 @@
usedfor = IPersonProduct
links = ['registered', 'owned', 'subscribed', 'active_reviews',
+ 'source_package_recipes',
'simplified_subscribed', 'simplified_registered',
'simplified_owned', 'simplified_active_reviews']
=== modified file 'lib/lp/code/browser/tests/test_branchlisting.py'
--- lib/lp/code/browser/tests/test_branchlisting.py 2012-01-15 13:32:27 +0000
+++ lib/lp/code/browser/tests/test_branchlisting.py 2012-02-21 12:21:18 +0000
@@ -33,6 +33,7 @@
SeriesSourcePackageBranchSet,
)
from lp.registry.interfaces.person import (
+ IPerson,
IPersonSet,
PersonVisibility,
)
@@ -357,6 +358,19 @@
page = self.get_branch_list_page(target=self.team)
self.assertThat(page, Not(self.registered_branches_matcher))
+ def test_branch_list_recipes_link(self):
+ # The link to the source package recipes is always displayed.
+ page = self.get_branch_list_page()
+ recipes_matcher = soupmatchers.HTMLContains(
+ soupmatchers.Tag(
+ 'Source package recipes link', 'a',
+ text='Source package recipes',
+ attrs={'href': self.base_url + '/+recipes'}))
+ if IPerson.providedBy(self.default_target):
+ self.assertThat(page, recipes_matcher)
+ else:
+ self.assertThat(page, Not(recipes_matcher))
+
class TestSimplifiedPersonProductBranchesView(
TestSimplifiedPersonBranchesView):
@@ -683,6 +697,7 @@
self.assertTrue(badname not in browser.contents)
self.assertTrue(escapedname in browser.contents)
+
class TestProjectGroupBranches(TestCaseWithFactory,
AjaxBatchNavigationMixin):
"""Test for the project group branches page."""
=== modified file 'lib/lp/code/templates/person-codesummary.pt'
--- lib/lp/code/templates/person-codesummary.pt 2011-11-01 14:05:19 +0000
+++ lib/lp/code/templates/person-codesummary.pt 2012-02-21 12:21:18 +0000
@@ -58,5 +58,9 @@
tal:content="structure menu/mergequeues/render"
/>
</tr>
+ <tr class="code-links"
+ tal:condition="menu/source_package_recipes/enabled">
+ <td tal:content="structure menu/source_package_recipes/render" />
+ </tr>
</table>
</div>