Merge lp:~wgrant/launchpad/git-configure-code into lp:launchpad

Proposed by William Grant
Status: Merged
Merged at revision: 17875
Proposed branch: lp:~wgrant/launchpad/git-configure-code
Merge into: lp:launchpad
Diff against target: 199 lines (+26/-53)
8 files modified
lib/lp/code/browser/branchlisting.py (+0/-11)
lib/lp/code/browser/tests/test_branchlisting.py (+0/-21)
lib/lp/code/templates/gitlisting.pt (+8/-0)
lib/lp/code/templates/product-branch-summary.pt (+3/-7)
lib/lp/code/templates/product-branches.pt (+9/-8)
lib/lp/code/templates/project-branches.pt (+1/-1)
lib/lp/registry/browser/product.py (+3/-3)
lib/lp/registry/browser/tests/pillar-views.txt (+2/-2)
To merge this branch: bzr merge lp:~wgrant/launchpad/git-configure-code
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+280248@code.launchpad.net

Commit message

Add "Configure Code" link to Product:+git.

Description of the change

Add "Configure Code" link to Product:+git.

It was already on Product:+branches. Also some cleanup of a pointless slightly-overridden menu item.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/code/browser/branchlisting.py'
2--- lib/lp/code/browser/branchlisting.py 2015-11-04 10:35:48 +0000
3+++ lib/lp/code/browser/branchlisting.py 2015-12-15 23:46:50 +0000
4@@ -56,7 +56,6 @@
5 custom_widget,
6 LaunchpadFormView,
7 )
8-from lp.app.browser.tales import MenuAPI
9 from lp.app.enums import (
10 PRIVATE_INFORMATION_TYPES,
11 ServiceUsage,
12@@ -1131,16 +1130,6 @@
13 """Whether or not the user can configure branches."""
14 return check_permission("launchpad.Edit", self.context)
15
16- @property
17- def configure_codehosting(self):
18- """Get the menu link for configuring code hosting."""
19- if not check_permission('launchpad.Edit', self.context):
20- return None
21- menu = MenuAPI(self.context).overview
22- configure_code = menu['configure_code']
23- configure_code.text = 'Configure Code'
24- return configure_code
25-
26
27 class ProductBranchStatisticsView(BranchCountSummaryView,
28 ProductBranchListingView):
29
30=== modified file 'lib/lp/code/browser/tests/test_branchlisting.py'
31--- lib/lp/code/browser/tests/test_branchlisting.py 2015-11-02 16:28:30 +0000
32+++ lib/lp/code/browser/tests/test_branchlisting.py 2015-12-15 23:46:50 +0000
33@@ -670,27 +670,6 @@
34 self.assertEqual('launchpad.dev', URI(link.url).host)
35
36
37-class TestProductConfigureCodehosting(TestCaseWithFactory):
38-
39- layer = LaunchpadFunctionalLayer
40-
41- def test_configure_codehosting_hidden(self):
42- # If the user does not have driver permissions, they are not shown
43- # the configure codehosting link.
44- product = self.factory.makeProduct()
45- browser = self.getUserBrowser(
46- canonical_url(product, rootsite='code'))
47- self.assertFalse('Configure Code' in browser.contents)
48-
49- def test_configure_codehosting_shown(self):
50- # If the user has driver permissions, they are shown the configure
51- # codehosting link.
52- product = self.factory.makeProduct()
53- browser = self.getUserBrowser(
54- canonical_url(product, rootsite='code'), user=product.owner)
55- self.assertTrue('Configure Code' in browser.contents)
56-
57-
58 class TestPersonBranchesPage(BrowserTestCase):
59 """Tests for the person branches page.
60
61
62=== modified file 'lib/lp/code/templates/gitlisting.pt'
63--- lib/lp/code/templates/gitlisting.pt 2015-06-12 04:04:28 +0000
64+++ lib/lp/code/templates/gitlisting.pt 2015-12-15 23:46:50 +0000
65@@ -41,6 +41,14 @@
66 </span>
67 </div>
68 </div>
69+
70+ <div id="involvement" class="portlet"
71+ tal:define="configure_code context/menu:overview/configure_code|nothing"
72+ tal:condition="configure_code/enabled|nothing">
73+ <ul>
74+ <li tal:content="structure configure_code/fmt:link"></li>
75+ </ul>
76+ </div>
77 </tal:has-target>
78 </metal:side>
79 <metal:main fill-slot="main">
80
81=== modified file 'lib/lp/code/templates/product-branch-summary.pt'
82--- lib/lp/code/templates/product-branch-summary.pt 2015-06-05 03:26:02 +0000
83+++ lib/lp/code/templates/product-branch-summary.pt 2015-12-15 23:46:50 +0000
84@@ -115,18 +115,14 @@
85 <div tal:condition="context/codehosting_usage/enumvalue:UNKNOWN">
86 <div
87 tal:condition="not: context/codehosting_usage/enumvalue:LAUNCHPAD"
88- tal:define="configure_codehosting view/configure_codehosting |
89- nothing">
90+ tal:define="configure_code context/menu:overview/configure_code|nothing">
91 <p>
92 <a class="sprite maybe"
93 href="https://help.launchpad.net/Code">Getting started
94 with code hosting in Launchpad</a>.</p>
95
96- <p tal:condition="context/required:launchpad.Edit"
97- id="no-code-edit">
98- <a tal:condition="configure_codehosting"
99- tal:replace="structure configure_codehosting/fmt:link"/>
100- </p>
101+ <p tal:condition="configure_code/enabled|nothing"
102+ tal:content="structure configure_code/fmt:link"></p>
103 </div>
104 </div>
105
106
107=== modified file 'lib/lp/code/templates/product-branches.pt'
108--- lib/lp/code/templates/product-branches.pt 2015-06-04 23:35:16 +0000
109+++ lib/lp/code/templates/product-branches.pt 2015-12-15 23:46:50 +0000
110@@ -39,14 +39,15 @@
111 </span>
112 </div>
113
114- <div id="involvement" class="portlet"
115- tal:define="menu context/menu:branches">
116- <p tal:define="link menu/code_import"
117- tal:condition="link/enabled"
118- tal:content="structure link/render"></p>
119- <p tal:define="configure_codehosting view/configure_codehosting | nothing"
120- tal:condition="configure_codehosting"
121- tal:replace="structure configure_codehosting/fmt:link"></p>
122+ <div id="involvement" class="portlet">
123+ <ul>
124+ <li tal:define="link context/menu:branches/code_import"
125+ tal:condition="link/enabled"
126+ tal:content="structure link/render"></li>
127+ <li tal:define="configure_code context/menu:overview/configure_code|nothing"
128+ tal:condition="configure_code/enabled|nothing"
129+ tal:replace="structure configure_code/fmt:link"></li>
130+ </ul>
131 </div>
132
133 </div>
134
135=== modified file 'lib/lp/code/templates/project-branches.pt'
136--- lib/lp/code/templates/project-branches.pt 2014-02-25 06:42:01 +0000
137+++ lib/lp/code/templates/project-branches.pt 2015-12-15 23:46:50 +0000
138@@ -25,7 +25,7 @@
139 </p>
140 <ul id="product-list" tal:repeat="product products">
141 <li>
142- <a tal:attributes="href product/@@+branches/configure_codehosting/fmt:url"
143+ <a tal:attributes="href product/menu:overview/configure_code/fmt:url"
144 tal:content="product/title" />
145 </li>
146 </ul>
147
148=== modified file 'lib/lp/registry/browser/product.py'
149--- lib/lp/registry/browser/product.py 2015-10-01 17:32:41 +0000
150+++ lib/lp/registry/browser/product.py 2015-12-15 23:46:50 +0000
151@@ -356,7 +356,7 @@
152 self.context.answers_usage != ServiceUsage.UNKNOWN)
153 states['configure_translations'] = (
154 self.context.translations_usage != ServiceUsage.UNKNOWN)
155- states['configure_codehosting'] = (
156+ states['configure_code'] = (
157 self.context.codehosting_usage != ServiceUsage.UNKNOWN)
158 return states
159
160@@ -389,7 +389,7 @@
161 configure_code.summary = "Specify the location of this project's code."
162 config_list.insert(0,
163 dict(link=configure_code,
164- configured=config_statuses['configure_codehosting']))
165+ configured=config_statuses['configure_code']))
166 return config_list
167
168 @property
169@@ -585,7 +585,7 @@
170 @enabled_with_permission('launchpad.Edit')
171 def configure_code(self):
172 """Return a link to configure code for this project."""
173- text = 'Configure code'
174+ text = 'Configure Code'
175 icon = 'edit'
176 summary = 'Configure code for this project'
177 return Link('+configure-code', text, summary, icon=icon)
178
179=== modified file 'lib/lp/registry/browser/tests/pillar-views.txt'
180--- lib/lp/registry/browser/tests/pillar-views.txt 2015-06-25 07:39:40 +0000
181+++ lib/lp/registry/browser/tests/pillar-views.txt 2015-12-15 23:46:50 +0000
182@@ -101,7 +101,7 @@
183 ... print key, view.configuration_states[key]
184 configure_answers False
185 configure_bugtracker False
186- configure_codehosting False
187+ configure_code False
188 configure_translations False
189
190 The percentage of the registration completed can be determined by
191@@ -120,7 +120,7 @@
192 ... print key, view.configuration_states[key]
193 configure_answers False
194 configure_bugtracker False
195- configure_codehosting False
196+ configure_code False
197 configure_translations True
198
199 >>> print pretty(view.registration_completeness)