Merge lp:~edwin-grubbs/launchpad/bug-436229-distroseries-page-titles into lp:launchpad/db-devel

Proposed by Edwin Grubbs
Status: Merged
Approved by: Barry Warsaw
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~edwin-grubbs/launchpad/bug-436229-distroseries-page-titles
Merge into: lp:launchpad/db-devel
Diff against target: 139 lines
7 files modified
lib/lp/registry/browser/distributionsourcepackage.py (+1/-1)
lib/lp/registry/browser/distroseries.py (+2/-9)
lib/lp/registry/browser/sourcepackage.py (+4/-13)
lib/lp/registry/browser/tests/distroseries-views.txt (+2/-2)
lib/lp/registry/model/sourcepackage.py (+4/-4)
lib/lp/registry/templates/distributionsourcepackage-index.pt (+0/-4)
lib/lp/registry/templates/sourcepackage-index.pt (+0/-2)
To merge this branch: bzr merge lp:~edwin-grubbs/launchpad/bug-436229-distroseries-page-titles
Reviewer Review Type Date Requested Status
Paul Hummer (community) ui Approve
Barry Warsaw (community) code ui* Approve
Review via email: mp+12439@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Edwin Grubbs (edwin-grubbs) wrote :

Summary
-------

This branch removes redundancies from the $distro/+addseries and
$distroseries/+edit-packaging page titles and labels.

It also makes the $distrosourcepackage/+index and $sourcepackage/+index
pages use the label attribute.

DistributionSourcePackageView.label was just returning the title attribute
from the model, so I did the same for the SourcePackageView.label, and
I updated the SourcePackage.title to format the string just like
DistributionSourcePackageView.title, since that was what the browser code
was doing effectively. The only small change I made to that was to use
the DistroSeries.displayname instead of the title, which made the
SourcePackage.title cleaner.

Tests
-----

./bin/test -vv -t whatever

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

* Open http://launchpad.dev/...

* Check that the <title> and <h1> don't have redundancies.
  * https://launchpad.dev/ubuntu/+addseries
  * https://launchpad.dev/ubuntu/warty/+source/mozilla-firefox/+edit-packaging
* Check that the <h1> appears above the breadcrumbs instead of below it.
  * https://launchpad.dev/ubuntu/warty/+source/mozilla-firefox/
* Removed fill-slot="heading" which was doing the exact same thing as using
  the label would.
  * https://launchpad.dev/ubuntu/+source/mozilla-firefox/

Revision history for this message
Barry Warsaw (barry) wrote :

Thanks for making these fixes!

review: Approve (code ui*)
Revision history for this message
Paul Hummer (rockstar) :
review: Approve (ui)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/registry/browser/distributionsourcepackage.py'
2--- lib/lp/registry/browser/distributionsourcepackage.py 2009-09-22 13:27:30 +0000
3+++ lib/lp/registry/browser/distributionsourcepackage.py 2009-09-25 20:45:25 +0000
4@@ -198,7 +198,7 @@
5 implements(IDistributionSourcePackageActionMenu)
6
7 @property
8- def page_title(self):
9+ def label(self):
10 return self.context.title
11
12 def setUpFields(self):
13
14=== modified file 'lib/lp/registry/browser/distroseries.py'
15--- lib/lp/registry/browser/distroseries.py 2009-09-22 19:52:18 +0000
16+++ lib/lp/registry/browser/distroseries.py 2009-09-25 20:45:25 +0000
17@@ -442,15 +442,8 @@
18 'name', 'displayname', 'title', 'summary', 'description', 'version',
19 'parent_series']
20
21- @property
22- def label(self):
23- """See `LaunchpadFormView`."""
24- return 'Register a series in %s' % self.context.displayname
25-
26- @property
27- def page_title(self):
28- """The page title."""
29- return self.label
30+ label = 'Register a series'
31+ page_title = label
32
33 @action(_('Create Series'), name='create')
34 def createAndAdd(self, action, data):
35
36=== modified file 'lib/lp/registry/browser/sourcepackage.py'
37--- lib/lp/registry/browser/sourcepackage.py 2009-09-23 02:09:58 +0000
38+++ lib/lp/registry/browser/sourcepackage.py 2009-09-25 20:45:25 +0000
39@@ -124,15 +124,8 @@
40 schema = ISourcePackage
41 field_names = ['productseries']
42
43- @property
44- def label(self):
45- """See `LaunchpadFormView`."""
46- return 'Define upstream link for %s' % self.context.title
47-
48- @property
49- def page_title(self):
50- """The page title."""
51- return self.label
52+ label = 'Define upstream link'
53+ page_title = label
54
55 @property
56 def cancel_url(self):
57@@ -163,10 +156,8 @@
58 self.processForm()
59
60 @property
61- def page_title(self):
62- """The HTML page title."""
63- return smartquote('"%s" source package in %s') % (
64- self.context.name, self.context.distroseries.title)
65+ def label(self):
66+ return self.context.title
67
68 @property
69 def cancel_url(self):
70
71=== modified file 'lib/lp/registry/browser/tests/distroseries-views.txt'
72--- lib/lp/registry/browser/tests/distroseries-views.txt 2009-08-17 22:56:55 +0000
73+++ lib/lp/registry/browser/tests/distroseries-views.txt 2009-09-25 20:45:25 +0000
74@@ -196,9 +196,9 @@
75
76 >>> view = create_view(ubuntu, '+addseries')
77 >>> print view.page_title
78- Register a series in Ubuntu
79+ Register a series
80 >>> print view.label
81- Register a series in Ubuntu
82+ Register a series
83
84 >>> print view.cancel_url
85 http://launchpad.dev/ubuntu
86
87=== modified file 'lib/lp/registry/model/sourcepackage.py'
88--- lib/lp/registry/model/sourcepackage.py 2009-09-16 04:31:39 +0000
89+++ lib/lp/registry/model/sourcepackage.py 2009-09-25 20:45:25 +0000
90@@ -21,6 +21,7 @@
91
92 from canonical.database.constants import UTC_NOW
93 from canonical.database.sqlbase import flush_database_updates, sqlvalues
94+from canonical.lazr.utils import smartquote
95 from lp.code.model.branch import Branch
96 from lp.bugs.model.bug import get_bug_tags_open_count
97 from lp.bugs.model.bugtarget import BugTargetBase
98@@ -287,10 +288,9 @@
99
100 @property
101 def title(self):
102- titlestr = self.sourcepackagename.name
103- titlestr += ' in ' + self.distribution.displayname
104- titlestr += ' ' + self.distroseries.displayname
105- return titlestr
106+ """See `ISourcePackage`."""
107+ return smartquote('"%s" source package in %s') % (
108+ self.sourcepackagename.name, self.distroseries.displayname)
109
110 @property
111 def distribution(self):
112
113=== modified file 'lib/lp/registry/templates/distributionsourcepackage-index.pt'
114--- lib/lp/registry/templates/distributionsourcepackage-index.pt 2009-09-14 19:48:13 +0000
115+++ lib/lp/registry/templates/distributionsourcepackage-index.pt 2009-09-25 20:45:25 +0000
116@@ -18,10 +18,6 @@
117 </tal:devmode>
118 </metal:block>
119
120-<tal:heading metal:fill-slot="heading">
121- <h1 tal:content="view/page_title"/>
122-</tal:heading>
123-
124 <tal:side metal:fill-slot="side">
125 <tal:menu replace="structure view/@@+global-actions" />
126
127
128=== modified file 'lib/lp/registry/templates/sourcepackage-index.pt'
129--- lib/lp/registry/templates/sourcepackage-index.pt 2009-09-15 05:26:07 +0000
130+++ lib/lp/registry/templates/sourcepackage-index.pt 2009-09-25 20:45:25 +0000
131@@ -9,8 +9,6 @@
132 <div metal:fill-slot="main"
133 tal:define="current context/currentrelease">
134 <div class="top-portlet">
135- <h1 tal:content="view/page_title"></h1>
136-
137 <h2>Versions published</h2>
138
139 <p class="warning message" tal:condition="not:current">

Subscribers

People subscribed via source and target branches

to status/vote changes: