Merge lp:~danilo/launchpad/bug-417082 into lp:launchpad

Proposed by Данило Шеган
Status: Merged
Merged at revision: not available
Proposed branch: lp:~danilo/launchpad/bug-417082
Merge into: lp:launchpad
Diff against target: None lines
To merge this branch: bzr merge lp:~danilo/launchpad/bug-417082
Reviewer Review Type Date Requested Status
Jeroen T. Vermeulen (community) Approve
Review via email: mp+10728@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Данило Шеган (danilo) wrote :

 reviewer jtv

= Bug #417082 =

Migrate translation group overview pages and all the related forms to 3.0.

I have not provided any more tests. I'd like to provide some for
Breadcrumb adapters, and at least basic tests for views but branch will
go very quickly (and I'd be happy to get a merge-conditional on that).

== Tests ==

bin/test -vvt translationgroup

== Demo and Q/A ==

https://translations.launchpad.dev/+groups/launchpad-translators
https://translations.launchpad.dev/+groups/ubuntu-translators

= Launchpad lint =

Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.

Linting changed files:
  lib/lp/translations/stories/translationgroups/05-add-translation-group.txt
  lib/lp/translations/stories/translationgroups/45-test-distro-restricted-permissions.txt
  lib/lp/translations/browser/configure.zcml
  lib/lp/translations/templates/translationgroup-reassignment.pt
  lib/lp/translations/templates/translationgroup-portlet-projects.pt
  lib/lp/translations/templates/translationgroup-index.pt
  lib/lp/translations/stories/translationgroups/30-show-group-translation-targets.txt
  lib/lp/translations/stories/translationgroups/36-change-translator.txt
  lib/lp/translations/configure.zcml
  lib/lp/translations/browser/translationgroup.py
  lib/lp/translations/stories/translationgroups/06-edit-translation-group.txt
  lib/lp/translations/stories/translationgroups/xx-link-to-documentation.txt
  lib/lp/translations/stories/translationgroups/35-appoint-translators.txt

Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

The code looks good to me, although it's a shame there are still several
"style" attributes in the TAL. The UI looks much nicer than it is now.

One thing I don't care for in the translation group page is how, under
"Projects using this group," the references to the group itself are
linkified. It does make it clear that the text refers to a named
object, but the name's capitalization generally does that anyway. It's
a bit restless to have two consecutive paragraphs each link back to the
same page they're on. Especially since there's also a link to the
Translation Teams section on the same page.

Speaking of that link: when you have that paragraph in view, unless
you're working on a telephone screen, it's just about impossible not to
have the Translation Teams section visible at the same time. I'd just
leave these links out.

I also noticed that the Guidelines URLs in the table can get a bit ugly,
but I don't see any better way of showing them.

None of this is fatal, but please make an effort to improve these points
if you can.

On the other hand, I'm deliberately not asking for breadcrumb tests. If
the breadcrumb breaks, the pagetests will show it. Or if we're going to
test that every breadcrumb in the UI appears when we expect it to, we'd
better have a generic, lightweight way of doing it everywhere. The real
problem with breadcrumbs is usually them not being designed in in the
first place, and that's not something that a test will change in this
case.

Jeroen

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/translations/browser/configure.zcml'
--- lib/lp/translations/browser/configure.zcml 2009-08-25 14:35:03 +0000
+++ lib/lp/translations/browser/configure.zcml 2009-08-25 16:52:31 +0000
@@ -448,6 +448,7 @@
448 <browser:url448 <browser:url
449 for="lp.translations.interfaces.translationgroup.ITranslationGroup"449 for="lp.translations.interfaces.translationgroup.ITranslationGroup"
450 path_expression="name"450 path_expression="name"
451 rootsite="translations"
451 parent_utility="lp.translations.interfaces.translationgroup.ITranslationGroupSet"/>452 parent_utility="lp.translations.interfaces.translationgroup.ITranslationGroupSet"/>
452 <browser:pages453 <browser:pages
453 for="lp.translations.interfaces.translationgroup.ITranslationGroup"454 for="lp.translations.interfaces.translationgroup.ITranslationGroup"
@@ -457,29 +458,26 @@
457 <browser:page458 <browser:page
458 template="../templates/translationgroup-index.pt"459 template="../templates/translationgroup-index.pt"
459 name="+index"/>460 name="+index"/>
460 461
461 <!-- TranslationGroup portlets -->462 <!-- TranslationGroup portlets -->
462 463
463 <browser:page464 <browser:page
464 name="+portlet-relateds"465 name="+portlet-projects"
465 template="../templates/translationgroup-portlet-relateds.pt"/>466 template="../templates/translationgroup-portlet-projects.pt"/>
466 <browser:page
467 name="+portlet-details"
468 template="../templates/translationgroup-portlet-details.pt"/>
469 </browser:pages>467 </browser:pages>
470 <browser:page468 <browser:page
471 name="+edit"469 name="+edit"
472 for="lp.translations.interfaces.translationgroup.ITranslationGroup"470 for="lp.translations.interfaces.translationgroup.ITranslationGroup"
473 permission="launchpad.Edit"471 permission="launchpad.Edit"
474 class="lp.translations.browser.translationgroup.TranslationGroupEditView"472 class="lp.translations.browser.translationgroup.TranslationGroupEditView"
475 template="../templates/translationgroup-edit.pt"473 template="../../app/templates/generic-edit.pt"
476 layer="canonical.launchpad.layers.TranslationsLayer"/>474 layer="canonical.launchpad.layers.TranslationsLayer"/>
477 <browser:page475 <browser:page
478 name="+appoint"476 name="+appoint"
479 for="lp.translations.interfaces.translationgroup.ITranslationGroup"477 for="lp.translations.interfaces.translationgroup.ITranslationGroup"
480 permission="launchpad.Edit"478 permission="launchpad.Edit"
481 class="lp.translations.browser.translationgroup.TranslationGroupAddTranslatorView"479 class="lp.translations.browser.translationgroup.TranslationGroupAddTranslatorView"
482 template="../templates/translationgroup-appoint.pt"480 template="../../app/templates/generic-edit.pt"
483 layer="canonical.launchpad.layers.TranslationsLayer"/>481 layer="canonical.launchpad.layers.TranslationsLayer"/>
484 <browser:page482 <browser:page
485 name="+reassign"483 name="+reassign"
486484
=== modified file 'lib/lp/translations/browser/translationgroup.py'
--- lib/lp/translations/browser/translationgroup.py 2009-08-25 14:32:37 +0000
+++ lib/lp/translations/browser/translationgroup.py 2009-08-25 16:44:22 +0000
@@ -7,6 +7,7 @@
7__all__ = [7__all__ = [
8 'TranslationGroupAddTranslatorView',8 'TranslationGroupAddTranslatorView',
9 'TranslationGroupAddView',9 'TranslationGroupAddView',
10 'TranslationGroupBreadcrumb',
10 'TranslationGroupEditView',11 'TranslationGroupEditView',
11 'TranslationGroupNavigation',12 'TranslationGroupNavigation',
12 'TranslationGroupReassignmentView',13 'TranslationGroupReassignmentView',
@@ -49,6 +50,13 @@
49 text = u"Translation groups"50 text = u"Translation groups"
5051
5152
53class TranslationGroupBreadcrumb(Breadcrumb):
54 """Builds a breadcrumb for an `ITranslationGroup`."""
55
56 @property
57 def text(self):
58 return self.context.title
59
52class TranslationGroupView:60class TranslationGroupView:
5361
54 def __init__(self, context, request):62 def __init__(self, context, request):
@@ -63,8 +71,10 @@
63 result.append({'lang': item.language.englishname,71 result.append({'lang': item.language.englishname,
64 'person': item.translator,72 'person': item.translator,
65 'code': item.language.code,73 'code': item.language.code,
74 'language' : item.language,
66 'datecreated': item.datecreated,75 'datecreated': item.datecreated,
67 'style_guide_url': item.style_guide_url,76 'style_guide_url': item.style_guide_url,
77 'context' : item,
68 })78 })
69 result.sort(key=operator.itemgetter('lang'))79 result.sort(key=operator.itemgetter('lang'))
70 return result80 return result
@@ -76,8 +86,8 @@
76 schema = ITranslator86 schema = ITranslator
77 field_names = ['language', 'translator', 'style_guide_url']87 field_names = ['language', 'translator', 'style_guide_url']
7888
79 @action("Add", name="add")89 @action("Appoint", name="appoint")
80 def add_action(self, action, data):90 def appoint_action(self, action, data):
81 """Appoint a translator to do translations for given language.91 """Appoint a translator to do translations for given language.
8292
83 Create a translator who, within this group, will be responsible for93 Create a translator who, within this group, will be responsible for
@@ -99,8 +109,18 @@
99 "There is already a translator for this language")109 "There is already a translator for this language")
100110
101 @property111 @property
112 def cancel_url(self):
113 return canonical_url(self.context)
114
115 @property
102 def next_url(self):116 def next_url(self):
103 return canonical_url(self.context)117 return self.cancel_url
118
119 label = "Appoint a translation team"
120
121 @property
122 def page_title(self):
123 return 'Apoint a translation team in "%s"' % (self.context.title)
104124
105125
106class TranslationGroupEditView(LaunchpadEditFormView):126class TranslationGroupEditView(LaunchpadEditFormView):
@@ -130,8 +150,20 @@
130 "There is already a translation group with this name")150 "There is already a translation group with this name")
131151
132 @property152 @property
153 def cancel_url(self):
154 return canonical_url(self.context)
155
156 @property
133 def next_url(self):157 def next_url(self):
134 return canonical_url(self.context)158 return self.cancel_url
159
160 @property
161 def label(self):
162 return "Change %s details" % (self.context.title)
163
164 @property
165 def page_title(self):
166 return 'Change "%s" translation group details' % (self.context.title)
135167
136168
137class TranslationGroupAddView(LaunchpadFormView):169class TranslationGroupAddView(LaunchpadFormView):
138170
=== modified file 'lib/lp/translations/configure.zcml'
--- lib/lp/translations/configure.zcml 2009-08-25 14:32:37 +0000
+++ lib/lp/translations/configure.zcml 2009-08-25 16:44:22 +0000
@@ -394,6 +394,11 @@
394 permission="launchpad.Edit"394 permission="launchpad.Edit"
395 set_schema="lp.translations.interfaces.translationgroup.ITranslationGroup"/>395 set_schema="lp.translations.interfaces.translationgroup.ITranslationGroup"/>
396 </class>396 </class>
397 <adapter
398 provides="canonical.launchpad.webapp.interfaces.IBreadcrumb"
399 for="lp.translations.interfaces.translationgroup.ITranslationGroup"
400 factory="lp.translations.browser.translationgroup.TranslationGroupBreadcrumb"
401 permission="zope.Public"/>
397402
398 <!-- TranslationGroupSet -->403 <!-- TranslationGroupSet -->
399404
400405
=== modified file 'lib/lp/translations/stories/translationgroups/05-add-translation-group.txt'
--- lib/lp/translations/stories/translationgroups/05-add-translation-group.txt 2009-08-25 10:26:43 +0000
+++ lib/lp/translations/stories/translationgroups/05-add-translation-group.txt 2009-08-25 16:42:56 +0000
@@ -82,7 +82,7 @@
8282
83 >>> docs = find_tag_by_id(admin_browser.contents, 'documentation')83 >>> docs = find_tag_by_id(admin_browser.contents, 'documentation')
84 >>> print extract_text(docs)84 >>> print extract_text(docs)
85 Please read translation instructions...85 Please read the translation instructions...
86 >>> docs_url = docs.find('a')86 >>> docs_url = docs.find('a')
87 >>> extract_link_from_tag(docs_url)87 >>> extract_link_from_tag(docs_url)
88 u'https://help.launchpad.net/Translations/PolyglotPolicies'88 u'https://help.launchpad.net/Translations/PolyglotPolicies'
@@ -113,7 +113,7 @@
113The Rosetta administrator assigns ownership of the group to Sample113The Rosetta administrator assigns ownership of the group to Sample
114Person.114Person.
115115
116 >>> browser.getLink('Reassign').click()116 >>> browser.getLink(id='link-reassign').click()
117 >>> browser.url117 >>> browser.url
118 'http://translations.launchpad.dev/+groups/monolingua/+reassign'118 'http://translations.launchpad.dev/+groups/monolingua/+reassign'
119119
@@ -124,7 +124,7 @@
124124
125The Rosetta administrator is still able to administer this group:125The Rosetta administrator is still able to administer this group:
126126
127 >>> browser.getLink('Appoint')127 >>> browser.getLink('Appoint a new translation team')
128 <...+appoint'>128 <...+appoint'>
129129
130But Sample Person is now listed as its owner:130But Sample Person is now listed as its owner:
@@ -139,7 +139,7 @@
139 >>> browser.open(139 >>> browser.open(
140 ... 'http://translations.launchpad.dev/'140 ... 'http://translations.launchpad.dev/'
141 ... 'translations/groups/monolingua/')141 ... 'translations/groups/monolingua/')
142 >>> browser.getLink('Appoint')142 >>> browser.getLink('Appoint a new translation team')
143 <...+appoint'>143 <...+appoint'>
144144
145The new groups should show up on the "Translation groups" page.145The new groups should show up on the "Translation groups" page.
146146
=== modified file 'lib/lp/translations/stories/translationgroups/06-edit-translation-group.txt'
--- lib/lp/translations/stories/translationgroups/06-edit-translation-group.txt 2009-01-22 18:53:43 +0000
+++ lib/lp/translations/stories/translationgroups/06-edit-translation-group.txt 2009-08-25 16:42:56 +0000
@@ -20,7 +20,7 @@
2020
21And select to edit its details.21And select to edit its details.
2222
23 >>> admin_browser.getLink('Edit translation group details').click()23 >>> admin_browser.getLink('Change details').click()
24 >>> print admin_browser.url24 >>> print admin_browser.url
25 http://translations.launchpad.dev/+groups/testing-translation-team/+edit25 http://translations.launchpad.dev/+groups/testing-translation-team/+edit
2626
@@ -52,7 +52,7 @@
5252
53You can also edit the generic translation instructions for the team53You can also edit the generic translation instructions for the team
5454
55 >>> admin_browser.getLink('Edit translation group details').click()55 >>> admin_browser.getLink('Change details').click()
56 >>> admin_browser.getControl('Translation instructions').value = (56 >>> admin_browser.getControl('Translation instructions').value = (
57 ... u'https://help.launchpad.net/Translations/RenamedGroup')57 ... u'https://help.launchpad.net/Translations/RenamedGroup')
58 >>> admin_browser.getControl('Change').click()58 >>> admin_browser.getControl('Change').click()
5959
=== modified file 'lib/lp/translations/stories/translationgroups/30-show-group-translation-targets.txt'
--- lib/lp/translations/stories/translationgroups/30-show-group-translation-targets.txt 2009-08-13 21:32:59 +0000
+++ lib/lp/translations/stories/translationgroups/30-show-group-translation-targets.txt 2009-08-25 16:42:56 +0000
@@ -9,15 +9,14 @@
9 >>> def find_projects_portlet(browser):9 >>> def find_projects_portlet(browser):
10 ... """Find the portlet with projects/distros this group works with.10 ... """Find the portlet with projects/distros this group works with.
11 ... """11 ... """
12 ... return find_portlet(12 ... return find_tag_by_id(browser.contents, "related-projects")
13 ... browser.contents, "This group supervises translations for")
1413
15 >>> portlet = find_projects_portlet(browser)14 >>> portlet = find_projects_portlet(browser)
16 >>> for link in portlet.findAll('a'):15 >>> for link in portlet.findAll('a'):
17 ... print '%s: %s' % (link.find(text=True), link['href'])16 ... print '%s: %s' % (link.find(text=True), link['href'])
18 Ubuntu: /ubuntu17 Ubuntu: http://launchpad.dev/ubuntu
19 NetApplet: /netapplet18 GNOME: http://launchpad.dev/gnome
20 GNOME: /gnome19 NetApplet: http://launchpad.dev/netapplet
2120
22If we disable some of these projects...21If we disable some of these projects...
2322
@@ -43,7 +42,7 @@
43 >>> portlet = find_projects_portlet(browser)42 >>> portlet = find_projects_portlet(browser)
44 >>> for link in portlet.findAll('a'):43 >>> for link in portlet.findAll('a'):
45 ... print '%s: %s' % (link.string, link['href'])44 ... print '%s: %s' % (link.string, link['href'])
46 Ubuntu: /ubuntu45 Ubuntu: http://launchpad.dev/ubuntu
4746
48Let's undo this so we don't get in trouble with other tests in this47Let's undo this so we don't get in trouble with other tests in this
49story!48story!
5049
=== modified file 'lib/lp/translations/stories/translationgroups/35-appoint-translators.txt'
--- lib/lp/translations/stories/translationgroups/35-appoint-translators.txt 2008-07-24 12:16:08 +0000
+++ lib/lp/translations/stories/translationgroups/35-appoint-translators.txt 2009-08-25 16:42:56 +0000
@@ -13,16 +13,16 @@
13 >>> browser.addHeader('Authorization', 'Basic jordi@ubuntu.com:test')13 >>> browser.addHeader('Authorization', 'Basic jordi@ubuntu.com:test')
14 >>> browser.open(14 >>> browser.open(
15 ... 'http://translations.launchpad.dev/+groups/polyglot/')15 ... 'http://translations.launchpad.dev/+groups/polyglot/')
16 >>> print find_portlet(browser.contents, 'Translation Teams')16 >>> print find_tag_by_id(browser.contents, "translation-teams-listing")
17 <...17 <...
18 No translation teams or supervisors have been appointed yet in this18 No translation teams or supervisors have been appointed in this
19 group.19 group yet.
20 ...20 ...
2121
22Verify that the appointments form displays, and offers the option to22Verify that the appointments form displays, and offers the option to
23appoint a translator.23appoint a translator.
2424
25 >>> browser.getLink('Appoint').click()25 >>> browser.getLink('Appoint a new translation team').click()
26 >>> browser.url26 >>> browser.url
27 'http://translations.launchpad.dev/+groups/polyglot/+appoint'27 'http://translations.launchpad.dev/+groups/polyglot/+appoint'
2828
@@ -30,14 +30,14 @@
3030
31 >>> browser.getControl('Language').value=['ab']31 >>> browser.getControl('Language').value=['ab']
32 >>> browser.getControl('Translator').value='name21'32 >>> browser.getControl('Translator').value='name21'
33 >>> browser.getControl('Add').click()33 >>> browser.getControl('Appoint').click()
3434
35We should get redirected back to the group page.35We should get redirected back to the group page.
3636
37 >>> browser.url37 >>> browser.url
38 'http://translations.launchpad.dev/+groups/polyglot'38 'http://translations.launchpad.dev/+groups/polyglot'
3939
40 >>> browser.getLink('Appoint').click()40 >>> browser.getLink('Appoint a new translation team').click()
41 >>> browser.url41 >>> browser.url
42 'http://translations.launchpad.dev/+groups/polyglot/+appoint'42 'http://translations.launchpad.dev/+groups/polyglot/+appoint'
4343
@@ -45,7 +45,7 @@
4545
46 >>> browser.getControl('Language').value=['af']46 >>> browser.getControl('Language').value=['af']
47 >>> browser.getControl('Translator').value='no-priv'47 >>> browser.getControl('Translator').value='no-priv'
48 >>> browser.getControl('Add').click()48 >>> browser.getControl('Appoint').click()
4949
50Now we should see both of those appointments on the polyglot page:50Now we should see both of those appointments on the polyglot page:
5151
@@ -59,10 +59,10 @@
59Appointing a new Abkhazian translator must fail gracefully, not crash as59Appointing a new Abkhazian translator must fail gracefully, not crash as
60it used to do (Bug #52991).60it used to do (Bug #52991).
6161
62 >>> browser.getLink('Appoint').click()62 >>> browser.getLink('Appoint a new translation team').click()
63 >>> browser.getControl('Language').value=['ab']63 >>> browser.getControl('Language').value=['ab']
64 >>> browser.getControl('Translator').value='name12'64 >>> browser.getControl('Translator').value='name12'
65 >>> browser.getControl('Add').click()65 >>> browser.getControl('Appoint').click()
6666
67The error means we stay on the appoint page:67The error means we stay on the appoint page:
6868
@@ -79,7 +79,7 @@
7979
80 >>> admin_browser.open(80 >>> admin_browser.open(
81 ... 'http://translations.launchpad.dev/+groups/polyglot/')81 ... 'http://translations.launchpad.dev/+groups/polyglot/')
82 >>> admin_browser.getLink('Appoint').click()82 >>> admin_browser.getLink('Appoint a new translation team').click()
83 >>> admin_browser.url83 >>> admin_browser.url
84 'http://translations.launchpad.dev/+groups/polyglot/+appoint'84 'http://translations.launchpad.dev/+groups/polyglot/+appoint'
8585
@@ -87,7 +87,7 @@
8787
88 >>> admin_browser.open(88 >>> admin_browser.open(
89 ... 'http://translations.launchpad.dev/+groups/polyglot/')89 ... 'http://translations.launchpad.dev/+groups/polyglot/')
90 >>> admin_browser.getLink('Edit translation group details').click()90 >>> admin_browser.getLink('Change details').click()
91 >>> admin_browser.url91 >>> admin_browser.url
92 'http://translations.launchpad.dev/+groups/polyglot/+edit'92 'http://translations.launchpad.dev/+groups/polyglot/+edit'
9393
@@ -98,18 +98,18 @@
98 >>> user_browser.url98 >>> user_browser.url
99 'http://translations.launchpad.dev/+groups/polyglot/'99 'http://translations.launchpad.dev/+groups/polyglot/'
100100
101 >>> user_browser.getLink('Appoint').click()101 >>> user_browser.getLink('Appoint a new translation team')
102 Traceback (most recent call last):102 Traceback (most recent call last):
103 ...103 ...
104 Unauthorized:...104 LinkNotFoundError
105105
106 >>> user_browser.open(106 >>> user_browser.open(
107 ... 'http://translations.launchpad.dev/+groups/polyglot/')107 ... 'http://translations.launchpad.dev/+groups/polyglot/')
108 >>> user_browser.url108 >>> user_browser.url
109 'http://translations.launchpad.dev/+groups/polyglot/'109 'http://translations.launchpad.dev/+groups/polyglot/'
110110
111 >>> user_browser.getLink('Edit translation group details').click()111 >>> user_browser.getLink('Change details').click()
112 Traceback (most recent call last):112 Traceback (most recent call last):
113 ...113 ...
114 Unauthorized:...114 LinkNotFoundError
115115
116116
=== modified file 'lib/lp/translations/stories/translationgroups/36-change-translator.txt'
--- lib/lp/translations/stories/translationgroups/36-change-translator.txt 2009-01-08 23:19:08 +0000
+++ lib/lp/translations/stories/translationgroups/36-change-translator.txt 2009-08-25 16:42:56 +0000
@@ -9,14 +9,16 @@
9 >>> print anon_browser.url9 >>> print anon_browser.url
10 http://translations.launchpad.dev/+groups/polyglot10 http://translations.launchpad.dev/+groups/polyglot
1111
12 >>> portlet = find_portlet(anon_browser.contents, 'Translation Teams')12 >>> portlet = find_tag_by_id(
13 ... anon_browser.contents, "translation-teams-listing")
13 >>> language_rows = portlet.find('tbody').findAll('tr')14 >>> language_rows = portlet.find('tbody').findAll('tr')
14 >>> for language_row in language_rows:15 >>> for language_row in language_rows:
15 ... lang_name = language_row.findNext('td')16 ... cell = language_row.findNext('td')
16 ... lang_team = lang_name.findNext('td')17 ... lang_name = extract_text(cell)
17 ... print '%s: %s' % (lang_name.renderContents(), lang_team.a.string)18 ... lang_team = extract_text(cell.findNext('td').findNext('a'))
18 Abkhazian: Hoary Gnome Team19 ... print '%s: %s' % (lang_name, lang_team)
19 Afrikaans: No Privileges Person20 Abkhazian (ab): Hoary Gnome Team
21 Afrikaans (af): No Privileges Person
2022
21 >>> browser.addHeader('Authorization', 'Basic jordi@ubuntu.com:test')23 >>> browser.addHeader('Authorization', 'Basic jordi@ubuntu.com:test')
22 >>> browser.open(24 >>> browser.open(
@@ -26,7 +28,7 @@
2628
27 # We are going to change the Afrikaans (af) translator.29 # We are going to change the Afrikaans (af) translator.
2830
29 >>> browser.getLink(url='af').click()31 >>> browser.getLink(id='edit-af-translator').click()
30 >>> print browser.url32 >>> print browser.url
31 http://translations.launchpad.dev/+groups/polyglot/af33 http://translations.launchpad.dev/+groups/polyglot/af
3234
@@ -78,12 +80,14 @@
7880
79 # And the 'Translation Teams' portlet shows the new information.81 # And the 'Translation Teams' portlet shows the new information.
8082
81 >>> portlet = find_portlet(browser.contents, 'Translation Teams')83 >>> portlet = find_tag_by_id(
84 ... browser.contents, "translation-teams-listing")
82 >>> language_rows = portlet.find('tbody').findAll('tr')85 >>> language_rows = portlet.find('tbody').findAll('tr')
83 >>> for language_row in language_rows:86 >>> for language_row in language_rows:
84 ... lang_name = language_row.findNext('td')87 ... cell = language_row.findNext('td')
85 ... lang_team = lang_name.findNext('td')88 ... lang_name = extract_text(cell)
86 ... print '%s: %s' % (lang_name.renderContents(), lang_team.a.string)89 ... lang_team = extract_text(cell.findNext('td').findNext('a'))
87 Abkhazian: Hoary Gnome Team90 ... print '%s: %s' % (lang_name, lang_team)
88 Welsh: No Privileges Person91 Abkhazian (ab): Hoary Gnome Team
92 Welsh (cy): No Privileges Person
8993
9094
=== modified file 'lib/lp/translations/stories/translationgroups/45-test-distro-restricted-permissions.txt'
--- lib/lp/translations/stories/translationgroups/45-test-distro-restricted-permissions.txt 2009-07-02 10:27:50 +0000
+++ lib/lp/translations/stories/translationgroups/45-test-distro-restricted-permissions.txt 2009-08-25 16:42:56 +0000
@@ -88,7 +88,7 @@
88 ... 'http://translations.launchpad.dev/+groups/polyglot/+appoint')88 ... 'http://translations.launchpad.dev/+groups/polyglot/+appoint')
89 >>> admin_browser.getControl('Language').value=['st']89 >>> admin_browser.getControl('Language').value=['st']
90 >>> admin_browser.getControl('Translator').value='name21'90 >>> admin_browser.getControl('Translator').value='name21'
91 >>> admin_browser.getControl('Add').click()91 >>> admin_browser.getControl('Appoint').click()
9292
93No Privileges Person can now enter text, but the page does warn that it93No Privileges Person can now enter text, but the page does warn that it
94will only accept suggestions.94will only accept suggestions.
9595
=== modified file 'lib/lp/translations/stories/translationgroups/xx-link-to-documentation.txt'
--- lib/lp/translations/stories/translationgroups/xx-link-to-documentation.txt 2009-08-21 18:47:31 +0000
+++ lib/lp/translations/stories/translationgroups/xx-link-to-documentation.txt 2009-08-25 16:42:56 +0000
@@ -30,11 +30,12 @@
3030
31The link now appears in the table next to the name of the team.31The link now appears in the table next to the name of the team.
3232
33 >>> info = first_tag_by_class(carlos_browser.contents, 'translator_info')33 >>> team = first_tag_by_class(carlos_browser.contents, 'translator-team')
34 >>> info_a = info.findAll('a')34 >>> print extract_text(team.findAll('a')[0])
35 >>> print extract_text(info_a[0])
36 testing Spanish team35 testing Spanish team
37 >>> print info_a[1]['href']36
37 >>> link = first_tag_by_class(carlos_browser.contents, 'translator-link')
38 >>> print link.findAll('a')[0]['href']
38 http://www.ubuntu.com/39 http://www.ubuntu.com/
3940
40Back on the translations page, the link is now present, too.41Back on the translations page, the link is now present, too.
@@ -56,7 +57,7 @@
56 ... '+groups/testing-translation-team/+appoint')57 ... '+groups/testing-translation-team/+appoint')
57 >>> carlos_browser.getControl('Language').value = ['eo']58 >>> carlos_browser.getControl('Language').value = ['eo']
58 >>> carlos_browser.getControl('Translator').value = 'name12'59 >>> carlos_browser.getControl('Translator').value = 'name12'
59 >>> carlos_browser.getControl('Add').click()60 >>> carlos_browser.getControl('Appoint').click()
60 >>> print carlos_browser.url61 >>> print carlos_browser.url
61 http://translations.launchpad.dev/+groups/testing-translation-team62 http://translations.launchpad.dev/+groups/testing-translation-team
6263
6364
=== removed file 'lib/lp/translations/templates/translationgroup-appoint.pt'
--- lib/lp/translations/templates/translationgroup-appoint.pt 2009-07-17 17:59:07 +0000
+++ lib/lp/translations/templates/translationgroup-appoint.pt 1970-01-01 00:00:00 +0000
@@ -1,48 +0,0 @@
1<html
2 xmlns="http://www.w3.org/1999/xhtml"
3 xmlns:tal="http://xml.zope.org/namespaces/tal"
4 xmlns:metal="http://xml.zope.org/namespaces/metal"
5 xmlns:i18n="http://xml.zope.org/namespaces/i18n"
6 xml:lang="en"
7 lang="en"
8 dir="ltr"
9 metal:use-macro="context/@@main_template/master"
10 i18n:domain="launchpad">
11 <body>
12 <div metal:fill-slot="main">
13 <div>
14 <a href="/+groups">Translation groups:</a>
15 <a tal:attributes="href context/fmt:url"
16 tal:content="string:${context/title} translation group">
17 Foo bar translation group
18 </a>
19 </div>
20 <h1>Appoint a translation team or supervisor</h1>
21
22 <div metal:use-macro="context/@@launchpad_form/form" />
23 </div>
24
25 <div metal:fill-slot="help">
26 <p>
27 Here you can appoint a translation team (or an individual supervisor)
28 to be responsible for a particular language within this translation
29 group. One translation team can take care of any number of languages,
30 but the group can only appoint one team for any single language. To
31 avoid mistakes, this form will not allow you to appoint a new team for
32 a language that already has one assigned in this group.
33 </p>
34 <p>
35 A supervisor does not have to be a single person. If you want to have
36 several people taking care of a single language in this translation
37 group, make them a team and appoint that whole team as the translation
38 team.
39 </p>
40 <ul class="info">
41 <li>
42 <a href="https://help.launchpad.net/RosettaFAQ"
43 >Frequently asked questions</a>
44 </li>
45 </ul>
46 </div>
47 </body>
48</html>
490
=== removed file 'lib/lp/translations/templates/translationgroup-edit.pt'
--- lib/lp/translations/templates/translationgroup-edit.pt 2009-07-17 17:59:07 +0000
+++ lib/lp/translations/templates/translationgroup-edit.pt 1970-01-01 00:00:00 +0000
@@ -1,31 +0,0 @@
1<html
2 xmlns="http://www.w3.org/1999/xhtml"
3 xmlns:tal="http://xml.zope.org/namespaces/tal"
4 xmlns:metal="http://xml.zope.org/namespaces/metal"
5 xmlns:i18n="http://xml.zope.org/namespaces/i18n"
6 xml:lang="en"
7 lang="en"
8 dir="ltr"
9 metal:use-macro="context/@@main_template/master"
10 i18n:domain="launchpad">
11 <body>
12 <div metal:fill-slot="main">
13 <div>
14 <a href="/+groups">Translation groups:</a>
15 <a tal:attributes="href context/fmt:url">
16 <tal:translation-group replace="context/title">
17 Foo bar
18 </tal:translation-group> translation group
19 </a>
20 </div>
21 <h1>
22 Edit
23 <tal:translation-group replace="context/title">
24 Foo bar
25 </tal:translation-group> translation group details
26 </h1>
27
28 <div metal:use-macro="context/@@launchpad_form/form" />
29 </div>
30 </body>
31</html>
320
=== modified file 'lib/lp/translations/templates/translationgroup-index.pt'
--- lib/lp/translations/templates/translationgroup-index.pt 2009-07-17 17:59:07 +0000
+++ lib/lp/translations/templates/translationgroup-index.pt 2009-08-25 16:42:56 +0000
@@ -3,150 +3,137 @@
3 xmlns:tal="http://xml.zope.org/namespaces/tal"3 xmlns:tal="http://xml.zope.org/namespaces/tal"
4 xmlns:metal="http://xml.zope.org/namespaces/metal"4 xmlns:metal="http://xml.zope.org/namespaces/metal"
5 xmlns:i18n="http://xml.zope.org/namespaces/i18n"5 xmlns:i18n="http://xml.zope.org/namespaces/i18n"
6 xml:lang="en"6 metal:use-macro="view/macro:page/main_only"
7 lang="en"
8 dir="ltr"
9 metal:use-macro="context/@@main_template/master"
10 i18n:domain="launchpad">7 i18n:domain="launchpad">
11 <body>8 <body>
12 <div metal:fill-slot="main">9 <div metal:fill-slot="heading">
13 <div>
14 <a href="/+groups">Translation groups</a>
15 </div>
16 <h1>10 <h1>
17 <tal:translation-group replace="context/title">11 <tal:translation-group replace="context/title">
18 Foo bar12 Foo bar
19 </tal:translation-group> translation group13 </tal:translation-group> translation group
20 </h1>14 </h1>
2115 </div>
22 <p class="documentDescription" tal:content="context/summary">16
17 <div metal:fill-slot="main"
18 style="max-width:800px;">
19 <p>
20 Administered by
21 <a tal:content="context/owner/fmt:displayname"
22 tal:attributes="href context/owner/fmt:url"
23 class="link" />
24 <a tal:condition="context/required:launchpad.Edit"
25 href="+reassign" title="Change administrator"
26 class="edit sprite" id="link-reassign"></a>
27 </p>
28
29 <div tal:content="structure context/summary/fmt:text-to-html"
30 class="summary">
23 $TranslationGroup.summary goes here. This should be quite short,31 $TranslationGroup.summary goes here. This should be quite short,
24 just a single paragraph of text really, giving a summary of32 just a single paragraph of text really, giving a summary of
25 this TranslationGroup.33 this TranslationGroup.
26 </p>34 </div>
35
27 <p id="documentation" tal:condition="context/translation_guide_url">36 <p id="documentation" tal:condition="context/translation_guide_url">
28 <em>Please read <a tal:attributes="37 <em>Please read the <a tal:attributes="
29 href context/translation_guide_url">translation instructions</a>38 href context/translation_guide_url">translation instructions</a>
30 to learn about policies, recommendations and caveats for doing39 to learn about policies, recommendations and caveats for doing
31 translations in this translation group.</em>40 translations in this translation group.</em>
32 </p>41 </p>
33 <p>42
34 Group owner:43 <div tal:condition="context/required:launchpad.Edit">
35 <a tal:content="context/owner/fmt:displayname"44 <a href="+edit" class="edit sprite">Change details</a>
36 tal:attributes="href context/owner/fmt:url"45 </div>
37 class="link" />46
38 <a tal:condition="context/required:launchpad.Edit" href="+reassign">47 <div style="height:2em;"></div><!-- separator -->
39 <img src="/@@/edit" alt="Reassign" title="Change Owner" />48
40 </a>49 <div id="translation-teams-listing">
41 </p>50 <h2><a name="teams"></a>Translation teams</h2>
4251 <tal:translators condition="context/translators">
43 <div class="left">52 <table class="sortable listing" id="group-members">
44 <div class="section">53 <thead>
45 <div class="portlet">54 <tr>
46 <h2>Translation Teams</h2>55 <th style="text-align:left">Language</th>
47 <tal:translators condition="context/translators">56 <th>Team/Supervisor</th>
48 <table class="sortable listing" id="group-members">57 <th>Guidelines</th>
49 <thead>58 <th>Appointed</th>
50 <tr>59 <th tal:condition="context/required:launchpad.Edit"></th>
51 <th>Language</th>60 </tr>
52 <th>Team/Supervisor</th>61 </thead>
53 <th></th>62 <tbody>
54 <th>Appointed</th>63 <tr tal:repeat="translator view/translator_list">
55 <th tal:condition="context/required:launchpad.Edit"></th>64 <td class="translator-language">
56 </tr>65 <a tal:attributes="href translator/language/fmt:url"
57 </thead>66 tal:content="translator/language/displayname">
58 <tbody>67 Serbian</a>
59 <tr tal:repeat="translator view/translator_list">68 </td>
60 <td tal:content="translator/lang" />69 <td class="translator-team">
61 <td class="translator_info">70 <a tal:replace="structure translator/person/fmt:link">
62 <a tal:content="translator/person/displayname"71 Translator</a>
63 tal:attributes="href translator/person/fmt:url" />72 <tal:team condition="translator/person/is_team">
64 <a tal:condition="translator/style_guide_url"73 with
65 tal:attributes="href translator/style_guide_url"74 <tal:count replace="
66 ><img src="/@@/link" alt="Doc"75 translator/person/active_member_count">6</tal:count>
76 members
77 </tal:team>
78 </td>
79 <td class="translator-link">
80 <a tal:condition="translator/style_guide_url"
81 tal:attributes="href translator/style_guide_url"
82 ><img src="/@@/link" alt="Doc"
67 tal:attributes="title translator/style_guide_url"83 tal:attributes="title translator/style_guide_url"
68 /></a>84 />
69 </td>85 <tal:link
70 <td><a tal:attributes="href translator/code"><img86 replace="translator/style_guide_url/fmt:shorten/30"
71 src="/@@/edit" alt="Change"87 ></tal:link></a>
72 title="Change Translator" /></a>88 <span tal:condition="not:translator/style_guide_url">
73 </td>89 none
74 <td>90 </span>
75 <span class="sortkey"91 <tal:notadmin
76 tal:content="translator/datecreated/fmt:datetime" />92 condition="not:context/required:launchpad.Edit">
77 <span93 &nbsp;<a tal:condition="
78 tal:attributes="title translator/datecreated/fmt:datetime"94 translator/context/required:launchpad.Edit"
79 tal:content="translator/datecreated/fmt:approximatedate">95 tal:attributes="href string:${translator/code}/+edit"
80 2007-09-1796 class="edit sprite"></a>
81 </span>97 </tal:notadmin>
82 </td>98 </td>
83 <td>99 <td>
84 <a100 <span
85 tal:attributes="href string:${translator/code}/+remove">101 tal:attributes="title translator/datecreated/fmt:datetime"
86 <input type="image" style="border: 0;"102 tal:content="translator/datecreated/fmt:approximatedate">
87 src="/@@/remove" alt="Remove Translator"103 2007-09-17
88 title="Remove Translator" name="rmform" />104 </span>
89 </a>105 </td>
90 </td>106 <td tal:condition="context/required:launchpad.Edit">
91 </tr>107 <a tal:attributes="
92 </tbody>108 href translator/code;
93 </table>109 id string:edit-${translator/code}-translator"
94 </tal:translators>110 title="Change translator and documentation link"
95 <tal:no-translators condition="not: context/translators">111 alt="Change" class="edit sprite"></a>
96 No translation teams or supervisors have been appointed yet in112 <a tal:attributes="href string:${translator/code}/+remove"
97 this group.113 alt="Remove" title="Remove translator"
98 </tal:no-translators>114 class="remove sprite"></a>
99 <ul class="menu">115 </td>
100 <tal:can-edit condition="context/required:launchpad.Edit">116 </tr>
101 <li class="add">117 </tbody>
102 <a href="+appoint">Appoint translation team or supervisor</a>118 </table>
103 </li>119 </tal:translators>
104 <li class="edit">120 <tal:no-translators condition="not: context/translators">
105 <a href="+edit">Edit translation group details</a>121 No translation teams or supervisors have been appointed in
106 </li>122 this group yet.
107 </tal:can-edit>123 </tal:no-translators>
108 <tal:cannot-edit124 <div style="margin-top:1em; margin-bottom: 2em;">
109 condition="not:context/required:launchpad.Edit">125 <a tal:condition="context/required:launchpad.Edit"
110 <li class="locked">126 href="+appoint" class="add sprite">Appoint a new translation
111 <a href="+appoint">Appoint translation team or supervisor</a>127 team</a>
112 </li>
113 <li class="locked">
114 <a href="+edit">Edit translation group details</a>
115 </li>
116 </tal:cannot-edit>
117 </ul>
118 </div>
119 </div>128 </div>
120 </div>129 </div><!-- id="translations-team-listing" -->
121 <div class="right">130
122 <div class="section">131 <div class="section">
123 <div tal:replace="structure context/@@+portlet-relateds" />132 <a name="projects"></a>
133 <div tal:replace="structure context/@@+portlet-projects" />
124 </div>134 </div>
125 </div>135
126 </div>136 </div><!-- main -->
127137
128 <div metal:fill-slot="help">
129 <p>
130 This is an overview of the
131 "<span tal:replace="context/name">transgroup</span>" translation
132 group. A translation group is a collection of teams and/or
133 people who supervise the translations for a piece of software.
134 A translation group can manage translations for any number of
135 projects into any number of languages. Translation groups make it
136 easier to coordinate and oversee large translation efforts.
137 </p>
138 <p>
139 Within the group, a translation team or individual supervisor is
140 appointed for every language that the group supports. One
141 person or team may work on multiple languages if desired, and
142 even participate in multiple translation groups.
143 </p>
144 <ul class="info">
145 <li>
146 <a href="https://help.launchpad.net/RosettaFAQ"
147 >Frequently asked questions</a>
148 </li>
149 </ul>
150 </div>
151 </body>138 </body>
152</html>139</html>
153140
=== removed file 'lib/lp/translations/templates/translationgroup-portlet-details.pt'
--- lib/lp/translations/templates/translationgroup-portlet-details.pt 2009-07-17 17:59:07 +0000
+++ lib/lp/translations/templates/translationgroup-portlet-details.pt 1970-01-01 00:00:00 +0000
@@ -1,14 +0,0 @@
1<tal:root
2 xmlns:tal="http://xml.zope.org/namespaces/tal"
3 xmlns:metal="http://xml.zope.org/namespaces/metal"
4 xmlns:i18n="http://xml.zope.org/namespaces/i18n"
5 omit-tag="">
6
7<div class="portlet" id="portlet-details">
8 <h2>Current details</h2>
9 <div class="portletBody portletContent">
10 Owner:
11 <a tal:replace="structure context/owner/fmt:link" />
12 </div>
13</div>
14</tal:root>
150
=== renamed file 'lib/lp/translations/templates/translationgroup-portlet-relateds.pt' => 'lib/lp/translations/templates/translationgroup-portlet-projects.pt'
--- lib/lp/translations/templates/translationgroup-portlet-relateds.pt 2009-08-13 21:32:59 +0000
+++ lib/lp/translations/templates/translationgroup-portlet-projects.pt 2009-08-25 16:42:56 +0000
@@ -4,45 +4,52 @@
4 xmlns:i18n="http://xml.zope.org/namespaces/i18n"4 xmlns:i18n="http://xml.zope.org/namespaces/i18n"
5 omit-tag="">5 omit-tag="">
66
7<div class="portlet" id="portlet-related">7 <h2>Projects using this group</h2>
8 <h2>This group supervises translations for</h2>8
99 <p>
10 <div class="portletBody">10 Projects listed here are using
11 <div class="portletContent">11 <a tal:attributes="href context/fmt:url"
1212 tal:content="context/title"
13 <tal:distributions condition="context/distributions">13 >this group</a> to manage their translations.
14 <h3>Distributions:</h3>14 This means that members of the group (as displayed above in
15 <ul>15 the <a href="#teams">Translation teams</a> section) are in charge
16 <li tal:repeat="distribution context/distributions">16 of managing translations for their particular language.
17 <a href="#"17 </p>
18 tal:content="distribution/displayname"18
19 tal:attributes="href distribution/fmt:url">Ubuntu</a>19 <p>
20 </li>20 Want to set your project as using
21 </ul>21 <a tal:attributes="href context/fmt:url"
22 </tal:distributions>22 tal:content="context/title"
2323 >this group</a>? Set it on Translations Settings page.
24 <tal:products condition="context/products">24 </p>
25 <h3>Projects:</h3>25
26 <ul>26 <div id="related-projects">
27 <li tal:repeat="product context/products">27 <div tal:condition="context/distributions" style="margin-top:1em;">
28 <tal:link replace="structure product/fmt:link:translations" />28 <h3 style="display: inline;">Distributions:</h3>
29 <tal:link replace="structure product/fmt:url:translations" />29 <tal:distribution
30 </li>30 repeat="distribution context/distributions">
31 </ul>31 <a href="#" tal:replace="structure distribution/fmt:link">Ubuntu
32 </tal:products>32 </a><tal:comma condition="not:repeat/distribution/end">, </tal:comma>
3333 </tal:distribution>
34 <tal:projects condition="context/projects">34 </div>
35 <h3>Project Groups:</h3>35
36 <ul>36 <div tal:condition="context/projects" style="margin-top:1em;">
37 <li tal:repeat="project context/projects">37 <h3 style="display: inline;">Project groups:</h3>
38 <a href="#"38 <tal:project
39 tal:content="project/displayname"39 repeat="project context/projects">
40 tal:attributes="href project/fmt:url">Gnome</a>40 <a href="#" tal:replace="structure project/fmt:link">GNOME
41 </li>41 </a><tal:comma condition="not:repeat/project/end">, </tal:comma>
42 </ul>42 </tal:project>
43 </tal:projects>43 </div>
4444
45 </div>45 <div tal:condition="context/products" style="margin-top:1em;">
46 <h3 style="display: inline;">Projects:</h3>
47 <tal:product
48 repeat="product context/products">
49 <a href="#" tal:replace="structure product/fmt:link">Firefox
50 </a><tal:comma condition="not:repeat/product/end">, </tal:comma>
51 </tal:product>
52 </div>
53
46 </div>54 </div>
47</div>
48</tal:root>55</tal:root>
4956
=== modified file 'lib/lp/translations/templates/translationgroup-reassignment.pt'
--- lib/lp/translations/templates/translationgroup-reassignment.pt 2009-08-13 20:28:35 +0000
+++ lib/lp/translations/templates/translationgroup-reassignment.pt 2009-08-25 13:32:26 +0000
@@ -3,27 +3,13 @@
3 xmlns:tal="http://xml.zope.org/namespaces/tal"3 xmlns:tal="http://xml.zope.org/namespaces/tal"
4 xmlns:metal="http://xml.zope.org/namespaces/metal"4 xmlns:metal="http://xml.zope.org/namespaces/metal"
5 xmlns:i18n="http://xml.zope.org/namespaces/i18n"5 xmlns:i18n="http://xml.zope.org/namespaces/i18n"
6 xml:lang="en"6 metal:use-macro="view/macro:page/main_only"
7 lang="en"
8 dir="ltr"
9 metal:use-macro="context/@@main_template/master"
10 i18n:domain="launchpad">7 i18n:domain="launchpad">
11 <body>8 <body>
12 <div metal:fill-slot="main">9 <div metal:fill-slot="main">
13 <div>
14 <a tal:attributes="href context/fmt:url">
15 <tal:translation-group replace="context/title">
16 Foo bar
17 </tal:translation-group> translation group
18 </a>
19 </div>
20 <h1>
21 Change the
22 <tal:role replace="view/ownerOrMaintainerAttr" /> of
23 <tal:thing replace="view/contextName" />
24 </h1>
2510
26 <div metal:use-macro="context/@@+object-reassignment/object-reassignment" />11 <div metal:use-macro="
12 context/@@+object-reassignment/object-reassignment" />
27 </div>13 </div>
28 </body>14 </body>
29</html>15</html>
3016