Merge lp://staging/~jtv/launchpad/bug-418430-stuff-to-review-3.0 into lp://staging/launchpad

Proposed by Jeroen T. Vermeulen
Status: Merged
Approved by: Jeroen T. Vermeulen
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp://staging/~jtv/launchpad/bug-418430-stuff-to-review-3.0
Merge into: lp://staging/launchpad
Diff against target: None lines
To merge this branch: bzr merge lp://staging/~jtv/launchpad/bug-418430-stuff-to-review-3.0
Reviewer Review Type Date Requested Status
Deryck Hodge (community) code Approve
Review via email: mp+10642@code.staging.launchpad.net
To post a comment you must log in.
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

= Bug 418430 =

For members of translation groups, the 3.0 personal page shows a list of
translations that await their review. If relevant, it also links to the
full list on a page called +translations-to-review.

When I started creating that page, we did not have the 3.0 macros yet so
I created it in 2.0 style. This branch fixes that. It's an easy change
since there's so little on the page.

Also, I'm adding +translations-to-review to the navigation menu for a
person in Translations. On the +translations-to-review page this shows
up as a list of related pages, since there's nothing else of interest to
show in a sidebar.

One bump in the road was getting the related-pages: I need to get
context/@@+related-pages rather than view/@@+related-pages. I don't
know why that is, but things fail horribly otherwise. I've seen sinzui
add constructors that distinguish between cases where "context" is the
view and cases where it's the underlying model object, but since in this
case there are other pages using the same navigation menu, it seemed
irresponsible to make the same change here without understanding all the
ramifications.

For testing, run the existing Translations pagetests. The only one
affected by the change was the licensing test, which unnecessarily
matches the entire navigation menu.

For Q/A:
 * Visit the home page for someone who is not in any translation groups.
   The navigation menu has no link for translations to review.
 * Visit the home page for someone who is in a translation group. Now
   the link will show up.
 * Follow that link and see the new page. It shows any translations
   awaiting review by this person, and the equivalent of the navigation
   menu at the bottom of the page.
 * Cycle through all the pages in the navigation menu, to make sure that
   I haven't broken any.

Naturally I've done this on the testing branch as well.

No lint.

Jeroen

Revision history for this message
Deryck Hodge (deryck) wrote :

Hi, Jeroen.

This looks nice!

One note about the UI, when I looked at the page itself, the two
headings -- the person name heading in an h2 and the page title in an
h1 -- were in the same purple color used for translations currently.
As I understand it, these should be light gray and green respectively.
I assume there's some current 2.0 LP style rule making all headings
this color for translations. The same is true of the bugs app, I
know. So I just call your attention to it, if you're not already
aware. Nothing to fix now, but at some point it has to be changed.
Maybe you guys have already talked about this, but just in case not, I
mention it.

I see only one minor fix to recommend:

> + <div class="top-portlet">
> + <h1>Translations to review</h1>
> + <tal:work-to-do condition="view/num_projects_and_packages_to_review">
> + <p>
> + These translations are available to be reviewed by
> + <tal:person replace="structure context/fmt:link">R. Viewer</tal:person>:
> + </p>

The h1 of the page should match the page title. In the case of the
page I sampled, the page title was "Translations for review by
Launchpad German translators" so I would expect the main h1 to be that
as well.

Otherwise, this looks good. Marking this as approved, with the
assumption that this one change will be made.

Cheers,
deryck

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

> The h1 of the page should match the page title. In the case of the
> page I sampled, the page title was "Translations for review by
> Launchpad German translators" so I would expect the main h1 to be that
> as well.
>
> Otherwise, this looks good. Marking this as approved, with the
> assumption that this one change will be made.

Consider it done, for verily it is.

Jeroen

Revision history for this message
Deryck Hodge (deryck) wrote :

> One note about the UI, when I looked at the page itself, the two
> headings -- the person name heading in an h2 and the page title in an
> h1 -- were in the same purple color used for translations currently.
> As I understand it, these should be light gray and green respectively.
> I assume there's some current 2.0 LP style rule making all headings
> this color for translations. The same is true of the bugs app, I
> know. So I just call your attention to it, if you're not already
> aware. Nothing to fix now, but at some point it has to be changed.
> Maybe you guys have already talked about this, but just in case not, I
> mention it.
>

So I made a bit of mistake here. I was thinking about the rule that the h2 should be gray, and blanked out for a minute that green is the registry color. So the h2 should be gray, and currently the h1 the app-specific color. I'm just updating the MP to admit my mistake if someone comes along later.

I did talk to beuno about this. And he does have some desire to have a single h1 color across apps. But that is a separate issue.

I filed bug 418666 about needing to have the context.title headings be gray across all app-specific pages.

Cheers,
deryck

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/translations/browser/person.py'
2--- lib/lp/translations/browser/person.py 2009-08-19 14:25:32 +0000
3+++ lib/lp/translations/browser/person.py 2009-08-25 06:11:12 +0000
4@@ -36,11 +36,18 @@
5 from lp.translations.model.productserieslanguage import ProductSeriesLanguage
6
7
8+def person_is_reviewer(person):
9+ """Is `person` a translations reviewer?"""
10+ groups = ITranslationsPerson(person).translation_groups
11+ return groups.any() is not None
12+
13+
14 class PersonTranslationsMenu(NavigationMenu):
15
16 usedfor = IPerson
17 facet = 'translations'
18- links = ('overview', 'licensing', 'imports')
19+ links = ('overview', 'licensing', 'imports', 'translations_to_review')
20+ title = "Related pages"
21
22 def overview(self):
23 text = 'Overview'
24@@ -55,6 +62,11 @@
25 enabled = (self.context == self.user)
26 return Link('+licensing', text, enabled=enabled)
27
28+ def translations_to_review(self):
29+ text = 'Translations to review'
30+ enabled = person_is_reviewer(self.context)
31+ return Link('+translations-to-review', text, enabled=enabled)
32+
33
34 class PersonTranslationView(LaunchpadView):
35 """View for translation-related Person pages."""
36@@ -96,7 +108,7 @@
37 @property
38 def person_is_reviewer(self):
39 """Is this person in a translation group?"""
40- return len(self.translation_groups) != 0
41+ return person_is_reviewer(self.context)
42
43 def should_display_message(self, translationmessage):
44 """Should a certain `TranslationMessage` be displayed.
45
46=== modified file 'lib/lp/translations/stories/standalone/xx-licensing.txt'
47--- lib/lp/translations/stories/standalone/xx-licensing.txt 2009-07-01 20:45:39 +0000
48+++ lib/lp/translations/stories/standalone/xx-licensing.txt 2009-08-25 06:39:38 +0000
49@@ -16,7 +16,7 @@
50 >>> print browser.title
51 Translations licensing
52 >>> print extract_text(find_main_content(browser.contents))
53- Overview / Translations licensing / Import queue
54+ Overview / Translations licensing / ...
55 Sorry to interrupt...
56
57 Karl is asked whether he wants to license his translations.
58
59=== modified file 'lib/lp/translations/templates/person-translations-to-review.pt'
60--- lib/lp/translations/templates/person-translations-to-review.pt 2009-08-19 16:48:17 +0000
61+++ lib/lp/translations/templates/person-translations-to-review.pt 2009-08-25 06:11:12 +0000
62@@ -3,57 +3,58 @@
63 xmlns:tal="http://xml.zope.org/namespaces/tal"
64 xmlns:metal="http://xml.zope.org/namespaces/metal"
65 xmlns:i18n="http://xml.zope.org/namespaces/i18n"
66- xml:lang="en"
67- lang="en"
68- dir="ltr"
69- metal:use-macro="view/macro:page/onecolumn"
70+ metal:use-macro="view/macro:page/main_only"
71 >
72 <body>
73 <div metal:fill-slot="main">
74- <h1>Translations to review</h1>
75- <tal:work-to-do condition="view/num_projects_and_packages_to_review">
76- <p>
77- These translations are available to be reviewed by
78- <tal:person replace="structure context/fmt:link">R. Viewer</tal:person>:
79- </p>
80+ <div class="top-portlet">
81+ <h1>Translations to review</h1>
82+ <tal:work-to-do condition="view/num_projects_and_packages_to_review">
83+ <p>
84+ These translations are available to be reviewed by
85+ <tal:person replace="structure context/fmt:link">R. Viewer</tal:person>:
86+ </p>
87
88- <table class="listing"
89- id="translations-to-review-table"
90- style="max-width:800px">
91- <tr tal:repeat="target_info view/all_projects_and_packages_to_review">
92- <td>
93- <tal:product condition="target_info/is_product"
94- replace="structure target_info/target/fmt:link">
95- alsa-utils
96- </tal:product>
97- <tal:package condition="not: target_info/is_product">
98- <a tal:attributes="href target_info/target/fmt:url">
99- <img src="/@@/distribution" />
100- <tal:packagename replace="target_info/target/name">
101- alsa-utils
102- </tal:packagename>
103+ <table class="listing"
104+ id="translations-to-review-table"
105+ style="max-width:800px">
106+ <tr tal:repeat="target_info view/all_projects_and_packages_to_review">
107+ <td>
108+ <tal:product condition="target_info/is_product"
109+ replace="structure target_info/target/fmt:link">
110+ alsa-utils
111+ </tal:product>
112+ <tal:package condition="not: target_info/is_product">
113+ <a tal:attributes="href target_info/target/fmt:url">
114+ <img src="/@@/distribution" />
115+ <tal:packagename replace="target_info/target/name">
116+ alsa-utils
117+ </tal:packagename>
118+ </a>
119+ </tal:package>
120+ </td>
121+ <td>
122+ needs
123+ <a tal:attributes="href target_info/link">
124+ <tal:stringcount replace="target_info/count_wording">
125+ 1 string
126+ </tal:stringcount>
127+ reviewed
128 </a>
129- </tal:package>
130- </td>
131- <td>
132- needs
133- <a tal:attributes="href target_info/link">
134- <tal:stringcount replace="target_info/count_wording">
135- 1 string
136- </tal:stringcount>
137- reviewed
138- </a>
139- </td>
140- </tr>
141- </table>
142-
143- </tal:work-to-do>
144- <tal:no-work condition="not: view/num_projects_and_packages_to_review">
145- <p>
146- No translations waiting for review by
147- <tal:person replace="structure context/fmt:link">R. Viewer</tal:person>.
148- </p>
149- </tal:no-work>
150+ </td>
151+ </tr>
152+ </table>
153+
154+ </tal:work-to-do>
155+ <tal:no-work condition="not: view/num_projects_and_packages_to_review">
156+ <p>
157+ No translations waiting for review by
158+ <tal:person replace="structure context/fmt:link">R. Viewer</tal:person>.
159+ </p>
160+ </tal:no-work>
161+ </div>
162+
163+ <tal:menu replace="structure context/@@+related-pages" />
164 </div>
165 </body>
166 </html>