Merge lp:~wgrant/launchpad/more-trivialities into lp:launchpad

Proposed by William Grant on 2015-09-10
Status: Merged
Merged at revision: 17725
Proposed branch: lp:~wgrant/launchpad/more-trivialities
Merge into: lp:launchpad
Diff against target: 200 lines (+54/-15)
9 files modified
lib/canonical/launchpad/icing/css/colours.css (+2/-1)
lib/lp/app/browser/tales.py (+3/-0)
lib/lp/bugs/browser/bugmessage.py (+2/-4)
lib/lp/bugs/templates/bug-comment-add-form.pt (+1/-1)
lib/lp/code/browser/tests/test_branch.py (+4/-2)
lib/lp/code/templates/branch-macros.pt (+2/-2)
lib/lp/registry/browser/tests/test_distribution.py (+33/-0)
lib/lp/registry/templates/distribution-index.pt (+6/-5)
lib/lp/registry/templates/milestone-index.pt (+1/-0)
To merge this branch: bzr merge lp:~wgrant/launchpad/more-trivialities
Reviewer Review Type Date Requested Status
Colin Watson 2015-09-10 Approve on 2015-09-10
Review via email: mp+270656@code.launchpad.net

Commit message

Fix a few trivial UI bugs: Distribution:+index hides disabled feature links, blueprints on Milestone:+index have icons again and are sortable, BugTask:+addcomment's title doesn't duplicate the bug number, the Opinion bug status has a colour, and Branch:+index links more sensibly to merge proposals.

Description of the change

Fix a few trivial UI bugs: Distribution:+index hides disabled feature links, blueprints on Milestone:+index have icons again and are sortable, BugTask:+addcomment's title doesn't duplicate the bug number, the Opinion bug status has a colour, and Branch:+index links more sensibly to merge proposals.

To post a comment you must log in.
Colin Watson (cjwatson) wrote :

I wonder if this will result in a weird empty portlet on Distribution:+index in the case where a distribution has none of the features tested there enabled (e.g. Debian)? Otherwise looks fine, thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/canonical/launchpad/icing/css/colours.css'
2--- lib/canonical/launchpad/icing/css/colours.css 2012-10-26 04:42:32 +0000
3+++ lib/canonical/launchpad/icing/css/colours.css 2015-09-10 12:52:58 +0000
4@@ -106,7 +106,8 @@
5 color: green;
6 }
7 .statusINVALID, .statusINVALID a,
8-.statusWONTFIX, .statusWONTFIX a {
9+.statusWONTFIX, .statusWONTFIX a,
10+.statusOPINION, .statusOPINION a {
11 color: #555;
12 }
13 .importanceCRITICAL, .importanceCRITICAL a {
14
15=== modified file 'lib/lp/app/browser/tales.py'
16--- lib/lp/app/browser/tales.py 2015-07-23 14:32:50 +0000
17+++ lib/lp/app/browser/tales.py 2015-09-10 12:52:58 +0000
18@@ -1047,6 +1047,9 @@
19
20 return sprite_str
21
22+ def icon(self):
23+ return '<span class="%s"></span>' % self.sprite_css()
24+
25 def badges(self):
26
27 badges = ''
28
29=== modified file 'lib/lp/bugs/browser/bugmessage.py'
30--- lib/lp/bugs/browser/bugmessage.py 2012-01-01 02:58:52 +0000
31+++ lib/lp/bugs/browser/bugmessage.py 2015-09-10 12:52:58 +0000
32@@ -28,15 +28,13 @@
33 schema = IBugMessageAddForm
34 initial_focus_widget = None
35
36+ page_title = "Add a comment or attachment"
37+
38 @property
39 def label(self):
40 return 'Add a comment or attachment to bug #%d' % self.context.bug.id
41
42 @property
43- def page_title(self):
44- return self.label
45-
46- @property
47 def initial_values(self):
48 return dict(subject=self.context.bug.followup_subject())
49
50
51=== modified file 'lib/lp/bugs/templates/bug-comment-add-form.pt'
52--- lib/lp/bugs/templates/bug-comment-add-form.pt 2012-09-21 02:51:51 +0000
53+++ lib/lp/bugs/templates/bug-comment-add-form.pt 2015-09-10 12:52:58 +0000
54@@ -10,7 +10,7 @@
55 >
56 Remember, this bug report is a duplicate of
57 <a href="#" tal:attributes="href context/bug/duplicateof/fmt:url">bug
58- #<span tal:replace="context/bug/duplicateof/id">42</span></a><br/>.
59+ #<span tal:replace="context/bug/duplicateof/id">42</span></a>.<br/>
60 Comment here only if you think the duplicate status is wrong.
61 </div>
62 <input
63
64=== modified file 'lib/lp/code/browser/tests/test_branch.py'
65--- lib/lp/code/browser/tests/test_branch.py 2015-05-07 13:57:33 +0000
66+++ lib/lp/code/browser/tests/test_branch.py 2015-09-10 12:52:58 +0000
67@@ -466,6 +466,7 @@
68 # These values are extracted here and used below.
69 linked_bug_rendered_text = "\n".join(linked_bug_text)
70 mp_url = canonical_url(mp, force_local_path=True)
71+ branch_url = canonical_url(mp.source_branch, force_local_path=True)
72 branch_display_name = mp.source_branch.displayname
73
74 browser = self.getUserBrowser(canonical_url(branch))
75@@ -493,8 +494,9 @@
76
77 links = revision_content.findAll('a')
78 self.assertEqual(mp_url, links[2]['href'])
79- self.assertEqual(linked_bug_urls[0], links[3]['href'])
80- self.assertEqual(linked_bug_urls[1], links[4]['href'])
81+ self.assertEqual(branch_url, links[3]['href'])
82+ self.assertEqual(linked_bug_urls[0], links[4]['href'])
83+ self.assertEqual(linked_bug_urls[1], links[5]['href'])
84
85 def test_view_for_user_with_artifact_grant(self):
86 # Users with an artifact grant for a branch related to a private
87
88=== modified file 'lib/lp/code/templates/branch-macros.pt'
89--- lib/lp/code/templates/branch-macros.pt 2015-06-10 10:25:28 +0000
90+++ lib/lp/code/templates/branch-macros.pt 2015-09-10 12:52:58 +0000
91@@ -274,8 +274,8 @@
92 <div tal:define="merge_proposal python:rev_info['merge_proposal']"
93 tal:condition="merge_proposal">
94 <dd class="subordinate revision-comment">
95- Merged branch <a tal:attributes="href merge_proposal/fmt:url"
96- tal:content="merge_proposal/source_branch/displayname">source branch</a>
97+ <a tal:attributes="href merge_proposal/fmt:url">Merged</a> branch
98+ <a tal:replace="structure merge_proposal/source_branch/fmt:link">source branch</a>
99 <tal:linkedbugs
100 define="linked_bugtasks python:rev_info['linked_bugtasks']"
101 condition="linked_bugtasks">
102
103=== modified file 'lib/lp/registry/browser/tests/test_distribution.py'
104--- lib/lp/registry/browser/tests/test_distribution.py 2012-08-13 21:04:17 +0000
105+++ lib/lp/registry/browser/tests/test_distribution.py 2015-09-10 12:52:58 +0000
106@@ -9,6 +9,7 @@
107 from lazr.restful.interfaces import IJSONRequestCache
108 import soupmatchers
109 from testtools.matchers import (
110+ MatchesAll,
111 MatchesAny,
112 Not,
113 )
114@@ -19,6 +20,7 @@
115 from lp.registry.interfaces.series import SeriesStatus
116 from lp.services.webapp import canonical_url
117 from lp.testing import (
118+ admin_logged_in,
119 login_celebrity,
120 login_person,
121 TestCaseWithFactory,
122@@ -98,6 +100,37 @@
123 self.assertThat(view.render(), series_header_match)
124 self.assertThat(view.render(), Not(add_series_match))
125
126+ def test_mirrors_links(self):
127+ view = create_initialized_view(self.distro, "+index")
128+ cd_mirrors_link = soupmatchers.HTMLContains(soupmatchers.Tag(
129+ "CD mirrors link", "a", text="CD mirrors"))
130+ archive_mirrors_link = soupmatchers.HTMLContains(soupmatchers.Tag(
131+ "Archive mirrors link", "a", text="Archive mirrors"))
132+ self.assertThat(
133+ view(), Not(MatchesAny(cd_mirrors_link, archive_mirrors_link)))
134+ with admin_logged_in():
135+ self.distro.supports_mirrors = True
136+ self.assertThat(
137+ view(), MatchesAll(cd_mirrors_link, archive_mirrors_link))
138+
139+ def test_ppas_link(self):
140+ view = create_initialized_view(self.distro, "+index")
141+ ppas_link = soupmatchers.HTMLContains(soupmatchers.Tag(
142+ "PPAs link", "a", text="Personal Package Archives"))
143+ self.assertThat(view(), Not(ppas_link))
144+ with admin_logged_in():
145+ self.distro.supports_ppas = True
146+ self.assertThat(view(), ppas_link)
147+
148+ def test_builds_link(self):
149+ view = create_initialized_view(self.distro, "+index")
150+ builds_link = soupmatchers.HTMLContains(soupmatchers.Tag(
151+ "Builds link", "a", text="Builds"))
152+ self.assertThat(view(), Not(builds_link))
153+ with admin_logged_in():
154+ self.distro.official_packages = True
155+ self.assertThat(view(), builds_link)
156+
157
158 class TestDistributionView(TestCaseWithFactory):
159 """Tests the DistributionView."""
160
161=== modified file 'lib/lp/registry/templates/distribution-index.pt'
162--- lib/lp/registry/templates/distribution-index.pt 2014-07-07 03:32:50 +0000
163+++ lib/lp/registry/templates/distribution-index.pt 2015-09-10 12:52:58 +0000
164@@ -95,18 +95,19 @@
165 define="overview_menu context/menu:overview">
166 <tal:menu replace="structure context/@@+global-actions" />
167
168- <div id="packages-archives" class="portlet">
169+ <div id="packages-archives" class="portlet"
170+ tal:condition="python: context.supports_mirrors or context.supports_ppas or context.official_packages">
171 <ul>
172- <li>
173+ <li tal:condition="context/supports_mirrors">
174 <a tal:replace="structure overview_menu/cdimage_mirrors/fmt:link" />
175 </li>
176- <li>
177+ <li tal:condition="context/supports_mirrors">
178 <a tal:replace="structure overview_menu/archive_mirrors/fmt:link" />
179 </li>
180- <li>
181+ <li tal:condition="context/supports_ppas">
182 <a tal:replace="structure overview_menu/ppas/fmt:link" />
183 </li>
184- <li>
185+ <li tal:condition="context/official_packages">
186 <a tal:replace="structure overview_menu/builds/fmt:link" />
187 </li>
188 </ul>
189
190=== modified file 'lib/lp/registry/templates/milestone-index.pt'
191--- lib/lp/registry/templates/milestone-index.pt 2015-01-29 18:48:37 +0000
192+++ lib/lp/registry/templates/milestone-index.pt 2015-09-10 12:52:58 +0000
193@@ -243,6 +243,7 @@
194 <tbody>
195 <tr tal:repeat="spec specs">
196 <td class="icon left">
197+ <span class="sortkey" tal:content="spec/title" />
198 <span tal:content="structure spec/image:icon" />
199 </td>
200 <td>