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

Proposed by Данило Шеган
Status: Merged
Approved by: Jeroen T. Vermeulen
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~danilo/launchpad/bug-455771
Merge into: lp:launchpad
Diff against target: 50 lines
2 files modified
lib/lp/translations/stories/distroseries/xx-distroseries-translations.txt (+28/-0)
lib/lp/translations/templates/distroseries-translations.pt (+3/-1)
To merge this branch: bzr merge lp:~danilo/launchpad/bug-455771
Reviewer Review Type Date Requested Status
Jeroen T. Vermeulen (community) Approve
Review via email: mp+13699@code.launchpad.net

Commit message

Do not provide translation focus portlet if translation focus is not set.

To post a comment you must log in.
Revision history for this message
Данило Шеган (danilo) wrote :

= Bug 455771 =

Do not try to link to translation focus series if it isn't defined.

= Demo & QA =

https://translations.edge.launchpad.net/debian/sid
https://translations.launchpad.dev/debian/sid

= Tests =

bin/test -vvt distroseries-translations.txt

= Lint =

No complaints.

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

Kudos for fixing this. Two points though:

1. You now have a conditional top-portlet div. Can that be fixed by creating a separate top-portlet and then putting the conditional div either below or inside it?

2. It's not clear what the additional test is testing. Always a problem with "look, it doesn't blow up" fixes. I'd suggest giving the div an HTML id and having the test show its absence.

Hope we can get through this soon, since I'm EOD and I'm sure you want this branch done.

review: Needs Fixing
Revision history for this message
Данило Шеган (danilo) wrote :

1. There's nothing wrong with a conditional top-portlet div. If you think there is, you'll have to explain what it is :)

2. Yeah, test is problematic. I'll folow your advice.

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

> 1. There's nothing wrong with a conditional top-portlet div. If you think
> there is, you'll have to explain what it is :)

Frankly I don't really know what it is, but I'm assuming we wouldn't have top-portlet if it didn't do something desirable.

So I'll approve with a stern "put that in your pipe and smoke it, young man" look. :)

review: Approve
Revision history for this message
Данило Шеган (danilo) wrote :

Incremental diff:

=== modified file 'lib/lp/translations/stories/distroseries/xx-distroseries-translations.txt'
--- lib/lp/translations/stories/distroseries/xx-distroseries-translations.txt 2009-10-21 07:42:20 +0000
+++ lib/lp/translations/stories/distroseries/xx-distroseries-translations.txt 2009-10-22 10:53:49 +0000
@@ -172,10 +172,30 @@
 just prevents that the translation import script, which is executed by cron,
 handle translation imports for this distro series.

+== Translation focus ==
+
+If translation focus is not set, there is no recommendation of what
+release series should be translated.
+
     >>> login('<email address hidden>')
     >>> distribution = factory.makeDistribution(name='earthian')
- >>> distroseries = factory.makeDistroRelease(name='1.4', distribution=distribution)
- >>> logout()
- >>> admin_browser.open('http://translations.launchpad.dev/earthian/1.4')
- >>> admin_browser.url
- 'http://translations.launchpad.dev/earthian/1.4'
+ >>> distroseries = factory.makeDistroRelease(
+ ... name='1.4', distribution=distribution)
+ >>> logout()
+ >>> print distribution.translation_focus
+ None
+ >>> admin_browser.open('http://translations.launchpad.dev/earthian/1.4')
+ >>> print find_tag_by_id(admin_browser.contents, 'translation-focus')
+ None
+
+If focus is set, nice explanatory text is displayed.
+
+ >>> login('<email address hidden>')
+ >>> focus_series = factory.makeDistroRelease(
+ ... name='1.6', distribution=distribution)
+ >>> distribution.translation_focus = focus_series
+ >>> logout()
+ >>> admin_browser.open('http://translations.launchpad.dev/earthian/1.4')
+ >>> print extract_text(
+ ... find_tag_by_id(admin_browser.contents, 'translation-focus'))
+ Launchpad currently recommends translating 1.6.

=== modified file 'lib/lp/translations/templates/distroseries-translations.pt'
--- lib/lp/translations/templates/distroseries-translations.pt 2009-10-21 07:42:20 +0000
+++ lib/lp/translations/templates/distroseries-translations.pt 2009-10-22 10:13:40 +0000
@@ -14,6 +14,7 @@
         <div></div><!-- to clear-up all floats -->
       </div>
       <div class="top-portlet"
+ id="translation-focus"
            tal:condition="context/distribution/translation_focus">
         <p tal:condition="not:view/is_translation_focus">
           Launchpad currently recommends translating

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/translations/stories/distroseries/xx-distroseries-translations.txt'
2--- lib/lp/translations/stories/distroseries/xx-distroseries-translations.txt 2009-09-14 13:54:29 +0000
3+++ lib/lp/translations/stories/distroseries/xx-distroseries-translations.txt 2009-10-22 10:58:12 +0000
4@@ -171,3 +171,31 @@
5 There are no visible user interface changes once this flag is changed. It
6 just prevents that the translation import script, which is executed by cron,
7 handle translation imports for this distro series.
8+
9+== Translation focus ==
10+
11+If translation focus is not set, there is no recommendation of what
12+release series should be translated.
13+
14+ >>> login('admin@canonical.com')
15+ >>> distribution = factory.makeDistribution(name='earthian')
16+ >>> distroseries = factory.makeDistroRelease(
17+ ... name='1.4', distribution=distribution)
18+ >>> logout()
19+ >>> print distribution.translation_focus
20+ None
21+ >>> admin_browser.open('http://translations.launchpad.dev/earthian/1.4')
22+ >>> print find_tag_by_id(admin_browser.contents, 'translation-focus')
23+ None
24+
25+If focus is set, nice explanatory text is displayed.
26+
27+ >>> login('admin@canonical.com')
28+ >>> focus_series = factory.makeDistroRelease(
29+ ... name='1.6', distribution=distribution)
30+ >>> distribution.translation_focus = focus_series
31+ >>> logout()
32+ >>> admin_browser.open('http://translations.launchpad.dev/earthian/1.4')
33+ >>> print extract_text(
34+ ... find_tag_by_id(admin_browser.contents, 'translation-focus'))
35+ Launchpad currently recommends translating 1.6.
36
37=== modified file 'lib/lp/translations/templates/distroseries-translations.pt'
38--- lib/lp/translations/templates/distroseries-translations.pt 2009-09-25 16:07:06 +0000
39+++ lib/lp/translations/templates/distroseries-translations.pt 2009-10-22 10:58:12 +0000
40@@ -13,7 +13,9 @@
41 </a>
42 <div></div><!-- to clear-up all floats -->
43 </div>
44- <div class="top-portlet">
45+ <div class="top-portlet"
46+ id="translation-focus"
47+ tal:condition="context/distribution/translation_focus">
48 <p tal:condition="not:view/is_translation_focus">
49 Launchpad currently recommends translating
50 <tal:target replace="