Thanks for the review!
Here is the latest diff.
=== modified file 'lib/lp/translations/browser/potemplate.py'
--- lib/lp/translations/browser/potemplate.py 2009-12-14 15:50:40 +0000
+++ lib/lp/translations/browser/potemplate.py 2009-12-21 19:26:06 +0000
@@ -286,12 +286,25 @@
by_source_count = self.context.relatives_by_source.count()
if (by_source_count > self.SHOW_RELATED_TEMPLATES):
other = by_source_count - self.SHOW_RELATED_TEMPLATES
+ if (self.context.distroseries):
+ # XXX adiroiban 2009-12-21 bug=499058: A canonical_url for
+ # SourcePackageName is needed to avoid hardcoding this URL.
+ url = (canonical_url(
+ self.context.distroseries, rootsite="translations") +
+ "/+source/" + self.context.sourcepackagename.name +
+ "/+translations")
+ else:
+ url = canonical_url(
+ self.context.productseries,
+ rootsite="translations",
+ view_name="+templates")
if other == 1:
- return "one other template"
+ return " and one other template." % url
else:
- return "%d other templates" % other
+ return " and %d other templates." % (
+ url, other)
else:
- return None
+ return ""
@property
def related_templates_by_name(self):
=== modified file 'lib/lp/translations/stories/standalone/xx-potemplate-index.txt'
--- lib/lp/translations/stories/standalone/xx-potemplate-index.txt 2009-12-14 15:50:40 +0000
+++ lib/lp/translations/stories/standalone/xx-potemplate-index.txt 2009-12-21 19:44:38 +0000
@@ -114,7 +114,7 @@
When the branch or the source package contains less than five templates
they are all displayed on the template page.
-A source package with for templates are created.
+A source package with five templates is created.
>>> from zope.component import getUtility
>>> from canonical.launchpad.interfaces.launchpad import (
@@ -140,7 +140,7 @@
... sourcepackagename=package.sourcepackagename, name='fifth')
>>> logout()
-Visiting any template from the same page, user see link to the other
+Visiting any template from the same page, user sees link to the other
templates.
>>> browser.open(
@@ -155,7 +155,7 @@
For five template, the page displays the first four templates in
alphabetical order, and a link to the page listing all templates.
-Another template is added to the same source package to test this behaviour.
+Another template is added to the same source package.
>>> login('')
>>> template = factory.makePOTemplate(
@@ -179,7 +179,7 @@
alphabetical order, and a link to the page listing
all templates, stating the number of other templates.
-Another template is added to the same source package to test this behaviour.
+Another template is added to the same source package.
>>> login('')
>>> template = factory.makePOTemplate(
@@ -204,6 +204,48 @@
... package.name))
True
+The "other templates" link for product series templates is leading to a
+page showing all templates for that product series.
+
+A product series with 7 templates is created.
+
+ >>> from zope.component import getUtility
+ >>> from canonical.launchpad.interfaces.launchpad import (
+ ... ILaunchpadCelebrities)
+ >>> login('')
+ >>> product = factory.makeProduct(name="fusa", official_rosetta=True)
+ >>> product_trunk = product.getSeries('trunk')
+ >>> template = factory.makePOTemplate(
+ ... productseries=product_trunk, name='first')
+ >>> template = factory.makePOTemplate(
+ ... productseries=product_trunk, name='second')
+ >>> template = factory.makePOTemplate(
+ ... productseries=product_trunk, name='third')
+ >>> template = factory.makePOTemplate(
+ ... productseries=product_trunk, name='forth')
+ >>> template = factory.makePOTemplate(
+ ... productseries=product_trunk, name='fifth')
+ >>> template = factory.makePOTemplate(
+ ... productseries=product_trunk, name='sixth')
+ >>> template = factory.makePOTemplate(
+ ... productseries=product_trunk, name='seventh')
+ >>> logout()
+
+ >>> browser.open((
+ ... "http://translations.launchpad.dev/"
+ ... "fusa/trunk/+pots/%s") % template.name)
+ >>> relatives = find_tag_by_id(
+ ... browser.contents, 'potemplate-relatives')
+ >>> print extract_text(relatives)
+ Other templates here: fifth, first, forth, second
+ and 2 other templates.
+
+ >>> browser.getLink('2 other templates').click()
+ >>> browser.url == (
+ ... 'http://translations.launchpad.dev/'
+ ... 'fusa/trunk/+templates')
+ True
+
Administering templates
-----------------------
=== modified file 'lib/lp/translations/templates/potemplate-index.pt'
--- lib/lp/translations/templates/potemplate-index.pt 2009-12-14 15:50:40 +0000
+++ lib/lp/translations/templates/potemplate-index.pt 2009-12-21 19:26:17 +0000
@@ -47,13 +47,9 @@
tal:content="pot/name">A POTemplate
,
- and
-
- 17 other templates
- .
-
+ -->
+ and 17 other templates
+