launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #19806
[Merge] lp:~wgrant/launchpad/git-configure-code into lp:launchpad
William Grant has proposed merging lp:~wgrant/launchpad/git-configure-code into lp:launchpad.
Commit message:
Add "Configure Code" link to Product:+git.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~wgrant/launchpad/git-configure-code/+merge/280248
Add "Configure Code" link to Product:+git.
It was already on Product:+branches. Also some cleanup of a pointless slightly-overridden menu item.
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/git-configure-code into lp:launchpad.
=== modified file 'lib/lp/code/browser/branchlisting.py'
--- lib/lp/code/browser/branchlisting.py 2015-11-04 10:35:48 +0000
+++ lib/lp/code/browser/branchlisting.py 2015-12-11 06:08:34 +0000
@@ -56,7 +56,6 @@
custom_widget,
LaunchpadFormView,
)
-from lp.app.browser.tales import MenuAPI
from lp.app.enums import (
PRIVATE_INFORMATION_TYPES,
ServiceUsage,
@@ -1131,16 +1130,6 @@
"""Whether or not the user can configure branches."""
return check_permission("launchpad.Edit", self.context)
- @property
- def configure_codehosting(self):
- """Get the menu link for configuring code hosting."""
- if not check_permission('launchpad.Edit', self.context):
- return None
- menu = MenuAPI(self.context).overview
- configure_code = menu['configure_code']
- configure_code.text = 'Configure Code'
- return configure_code
-
class ProductBranchStatisticsView(BranchCountSummaryView,
ProductBranchListingView):
=== modified file 'lib/lp/code/browser/tests/test_branchlisting.py'
--- lib/lp/code/browser/tests/test_branchlisting.py 2015-11-02 16:28:30 +0000
+++ lib/lp/code/browser/tests/test_branchlisting.py 2015-12-11 06:08:34 +0000
@@ -670,27 +670,6 @@
self.assertEqual('launchpad.dev', URI(link.url).host)
-class TestProductConfigureCodehosting(TestCaseWithFactory):
-
- layer = LaunchpadFunctionalLayer
-
- def test_configure_codehosting_hidden(self):
- # If the user does not have driver permissions, they are not shown
- # the configure codehosting link.
- product = self.factory.makeProduct()
- browser = self.getUserBrowser(
- canonical_url(product, rootsite='code'))
- self.assertFalse('Configure Code' in browser.contents)
-
- def test_configure_codehosting_shown(self):
- # If the user has driver permissions, they are shown the configure
- # codehosting link.
- product = self.factory.makeProduct()
- browser = self.getUserBrowser(
- canonical_url(product, rootsite='code'), user=product.owner)
- self.assertTrue('Configure Code' in browser.contents)
-
-
class TestPersonBranchesPage(BrowserTestCase):
"""Tests for the person branches page.
=== modified file 'lib/lp/code/templates/gitlisting.pt'
--- lib/lp/code/templates/gitlisting.pt 2015-06-12 04:04:28 +0000
+++ lib/lp/code/templates/gitlisting.pt 2015-12-11 06:08:34 +0000
@@ -41,6 +41,14 @@
</span>
</div>
</div>
+
+ <div id="involvement" class="portlet"
+ tal:define="configure_code context/menu:overview/configure_code|nothing"
+ tal:condition="configure_code|nothing/enabled">
+ <ul>
+ <li tal:content="structure configure_code/fmt:link"></li>
+ </ul>
+ </div>
</tal:has-target>
</metal:side>
<metal:main fill-slot="main">
=== modified file 'lib/lp/code/templates/product-branch-summary.pt'
--- lib/lp/code/templates/product-branch-summary.pt 2015-06-05 03:26:02 +0000
+++ lib/lp/code/templates/product-branch-summary.pt 2015-12-11 06:08:34 +0000
@@ -115,18 +115,14 @@
<div tal:condition="context/codehosting_usage/enumvalue:UNKNOWN">
<div
tal:condition="not: context/codehosting_usage/enumvalue:LAUNCHPAD"
- tal:define="configure_codehosting view/configure_codehosting |
- nothing">
+ tal:define="configure_code context/menu:overview/configure_code|nothing">
<p>
<a class="sprite maybe"
href="https://help.launchpad.net/Code">Getting started
with code hosting in Launchpad</a>.</p>
- <p tal:condition="context/required:launchpad.Edit"
- id="no-code-edit">
- <a tal:condition="configure_codehosting"
- tal:replace="structure configure_codehosting/fmt:link"/>
- </p>
+ <p tal:condition="configure_code/enabled"
+ tal:content="structure configure_code/fmt:link"></p>
</div>
</div>
=== modified file 'lib/lp/code/templates/product-branches.pt'
--- lib/lp/code/templates/product-branches.pt 2015-06-04 23:35:16 +0000
+++ lib/lp/code/templates/product-branches.pt 2015-12-11 06:08:34 +0000
@@ -39,14 +39,15 @@
</span>
</div>
- <div id="involvement" class="portlet"
- tal:define="menu context/menu:branches">
- <p tal:define="link menu/code_import"
- tal:condition="link/enabled"
- tal:content="structure link/render"></p>
- <p tal:define="configure_codehosting view/configure_codehosting | nothing"
- tal:condition="configure_codehosting"
- tal:replace="structure configure_codehosting/fmt:link"></p>
+ <div id="involvement" class="portlet">
+ <ul>
+ <li tal:define="link context/menu:branches/code_import"
+ tal:condition="link/enabled"
+ tal:content="structure link/render"></li>
+ <li tal:define="configure_code context/menu:overview/configure_code|nothing"
+ tal:condition="configure_code/enabled"
+ tal:replace="structure configure_code/fmt:link"></li>
+ </ul>
</div>
</div>
=== modified file 'lib/lp/code/templates/project-branches.pt'
--- lib/lp/code/templates/project-branches.pt 2014-02-25 06:42:01 +0000
+++ lib/lp/code/templates/project-branches.pt 2015-12-11 06:08:34 +0000
@@ -25,7 +25,7 @@
</p>
<ul id="product-list" tal:repeat="product products">
<li>
- <a tal:attributes="href product/@@+branches/configure_codehosting/fmt:url"
+ <a tal:attributes="href product/menu:overview/configure_code/fmt:url"
tal:content="product/title" />
</li>
</ul>
=== modified file 'lib/lp/registry/browser/product.py'
--- lib/lp/registry/browser/product.py 2015-10-01 17:32:41 +0000
+++ lib/lp/registry/browser/product.py 2015-12-11 06:08:34 +0000
@@ -356,7 +356,7 @@
self.context.answers_usage != ServiceUsage.UNKNOWN)
states['configure_translations'] = (
self.context.translations_usage != ServiceUsage.UNKNOWN)
- states['configure_codehosting'] = (
+ states['configure_code'] = (
self.context.codehosting_usage != ServiceUsage.UNKNOWN)
return states
@@ -389,7 +389,7 @@
configure_code.summary = "Specify the location of this project's code."
config_list.insert(0,
dict(link=configure_code,
- configured=config_statuses['configure_codehosting']))
+ configured=config_statuses['configure_code']))
return config_list
@property
@@ -585,7 +585,7 @@
@enabled_with_permission('launchpad.Edit')
def configure_code(self):
"""Return a link to configure code for this project."""
- text = 'Configure code'
+ text = 'Configure Code'
icon = 'edit'
summary = 'Configure code for this project'
return Link('+configure-code', text, summary, icon=icon)
=== modified file 'lib/lp/registry/browser/tests/pillar-views.txt'
--- lib/lp/registry/browser/tests/pillar-views.txt 2015-06-25 07:39:40 +0000
+++ lib/lp/registry/browser/tests/pillar-views.txt 2015-12-11 06:08:34 +0000
@@ -101,7 +101,7 @@
... print key, view.configuration_states[key]
configure_answers False
configure_bugtracker False
- configure_codehosting False
+ configure_code False
configure_translations False
The percentage of the registration completed can be determined by
@@ -120,7 +120,7 @@
... print key, view.configuration_states[key]
configure_answers False
configure_bugtracker False
- configure_codehosting False
+ configure_code False
configure_translations True
>>> print pretty(view.registration_completeness)
Follow ups