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
=== modified file 'lib/lp/registry/browser/distributionsourcepackage.py'
--- lib/lp/registry/browser/distributionsourcepackage.py 2009-09-22 13:27:30 +0000
+++ lib/lp/registry/browser/distributionsourcepackage.py 2009-09-25 20:45:25 +0000
@@ -198,7 +198,7 @@
198 implements(IDistributionSourcePackageActionMenu)198 implements(IDistributionSourcePackageActionMenu)
199199
200 @property200 @property
201 def page_title(self):201 def label(self):
202 return self.context.title202 return self.context.title
203203
204 def setUpFields(self):204 def setUpFields(self):
205205
=== modified file 'lib/lp/registry/browser/distroseries.py'
--- lib/lp/registry/browser/distroseries.py 2009-09-22 19:52:18 +0000
+++ lib/lp/registry/browser/distroseries.py 2009-09-25 20:45:25 +0000
@@ -442,15 +442,8 @@
442 'name', 'displayname', 'title', 'summary', 'description', 'version',442 'name', 'displayname', 'title', 'summary', 'description', 'version',
443 'parent_series']443 'parent_series']
444444
445 @property445 label = 'Register a series'
446 def label(self):446 page_title = label
447 """See `LaunchpadFormView`."""
448 return 'Register a series in %s' % self.context.displayname
449
450 @property
451 def page_title(self):
452 """The page title."""
453 return self.label
454447
455 @action(_('Create Series'), name='create')448 @action(_('Create Series'), name='create')
456 def createAndAdd(self, action, data):449 def createAndAdd(self, action, data):
457450
=== modified file 'lib/lp/registry/browser/sourcepackage.py'
--- lib/lp/registry/browser/sourcepackage.py 2009-09-23 02:09:58 +0000
+++ lib/lp/registry/browser/sourcepackage.py 2009-09-25 20:45:25 +0000
@@ -124,15 +124,8 @@
124 schema = ISourcePackage124 schema = ISourcePackage
125 field_names = ['productseries']125 field_names = ['productseries']
126126
127 @property127 label = 'Define upstream link'
128 def label(self):128 page_title = label
129 """See `LaunchpadFormView`."""
130 return 'Define upstream link for %s' % self.context.title
131
132 @property
133 def page_title(self):
134 """The page title."""
135 return self.label
136129
137 @property130 @property
138 def cancel_url(self):131 def cancel_url(self):
@@ -163,10 +156,8 @@
163 self.processForm()156 self.processForm()
164157
165 @property158 @property
166 def page_title(self):159 def label(self):
167 """The HTML page title."""160 return self.context.title
168 return smartquote('"%s" source package in %s') % (
169 self.context.name, self.context.distroseries.title)
170161
171 @property162 @property
172 def cancel_url(self):163 def cancel_url(self):
173164
=== modified file 'lib/lp/registry/browser/tests/distroseries-views.txt'
--- lib/lp/registry/browser/tests/distroseries-views.txt 2009-08-17 22:56:55 +0000
+++ lib/lp/registry/browser/tests/distroseries-views.txt 2009-09-25 20:45:25 +0000
@@ -196,9 +196,9 @@
196196
197 >>> view = create_view(ubuntu, '+addseries')197 >>> view = create_view(ubuntu, '+addseries')
198 >>> print view.page_title198 >>> print view.page_title
199 Register a series in Ubuntu199 Register a series
200 >>> print view.label200 >>> print view.label
201 Register a series in Ubuntu201 Register a series
202202
203 >>> print view.cancel_url203 >>> print view.cancel_url
204 http://launchpad.dev/ubuntu204 http://launchpad.dev/ubuntu
205205
=== modified file 'lib/lp/registry/model/sourcepackage.py'
--- lib/lp/registry/model/sourcepackage.py 2009-09-16 04:31:39 +0000
+++ lib/lp/registry/model/sourcepackage.py 2009-09-25 20:45:25 +0000
@@ -21,6 +21,7 @@
2121
22from canonical.database.constants import UTC_NOW22from canonical.database.constants import UTC_NOW
23from canonical.database.sqlbase import flush_database_updates, sqlvalues23from canonical.database.sqlbase import flush_database_updates, sqlvalues
24from canonical.lazr.utils import smartquote
24from lp.code.model.branch import Branch25from lp.code.model.branch import Branch
25from lp.bugs.model.bug import get_bug_tags_open_count26from lp.bugs.model.bug import get_bug_tags_open_count
26from lp.bugs.model.bugtarget import BugTargetBase27from lp.bugs.model.bugtarget import BugTargetBase
@@ -287,10 +288,9 @@
287288
288 @property289 @property
289 def title(self):290 def title(self):
290 titlestr = self.sourcepackagename.name291 """See `ISourcePackage`."""
291 titlestr += ' in ' + self.distribution.displayname292 return smartquote('"%s" source package in %s') % (
292 titlestr += ' ' + self.distroseries.displayname293 self.sourcepackagename.name, self.distroseries.displayname)
293 return titlestr
294294
295 @property295 @property
296 def distribution(self):296 def distribution(self):
297297
=== modified file 'lib/lp/registry/templates/distributionsourcepackage-index.pt'
--- lib/lp/registry/templates/distributionsourcepackage-index.pt 2009-09-14 19:48:13 +0000
+++ lib/lp/registry/templates/distributionsourcepackage-index.pt 2009-09-25 20:45:25 +0000
@@ -18,10 +18,6 @@
18 </tal:devmode>18 </tal:devmode>
19</metal:block>19</metal:block>
2020
21<tal:heading metal:fill-slot="heading">
22 <h1 tal:content="view/page_title"/>
23</tal:heading>
24
25<tal:side metal:fill-slot="side">21<tal:side metal:fill-slot="side">
26 <tal:menu replace="structure view/@@+global-actions" />22 <tal:menu replace="structure view/@@+global-actions" />
2723
2824
=== modified file 'lib/lp/registry/templates/sourcepackage-index.pt'
--- lib/lp/registry/templates/sourcepackage-index.pt 2009-09-15 05:26:07 +0000
+++ lib/lp/registry/templates/sourcepackage-index.pt 2009-09-25 20:45:25 +0000
@@ -9,8 +9,6 @@
9 <div metal:fill-slot="main"9 <div metal:fill-slot="main"
10 tal:define="current context/currentrelease">10 tal:define="current context/currentrelease">
11 <div class="top-portlet">11 <div class="top-portlet">
12 <h1 tal:content="view/page_title"></h1>
13
14 <h2>Versions published</h2>12 <h2>Versions published</h2>
1513
16 <p class="warning message" tal:condition="not:current">14 <p class="warning message" tal:condition="not:current">

Subscribers

People subscribed via source and target branches

to status/vote changes: