Code review comment for lp:~danilo/launchpad/bug-423836-a

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

У пет, 11. 09 2009. у 07:18 +0000, Michael Nelson пише:

> >> This CSS could possibly be much simpler if you put
> >> the 'translation-stats' class on the table element (instead of on the
> >> tbody). Then you could remove the overall-translation-stats class and do:
> >
> > That's actually what I started with. However, fighting legacy CSS code
> > is hell. 'table.listing tbody td' takes precedence over
> > 'table.translation-stats tbody td'. I am not yet ready to do away with
> > class='listing' on these tables, though, simply because I am not trying
> > to solve all the problems with these pages. It's mostly mechanical
> > changes, and no real redesign.
>
> OK. It's up to you, but I'm guessing:
>
> table.listing.translation-stats tbody td {...}

> would take precedence (ie. selecting both classes - as it's more
> specific). I'm not fussed either way - what you've got works, and it's
> not a huge improvement to remove one class.

Actually, it seems the problem was the 'tr' I had in when I tried this.
It "suddenly" just works.

Btw, I wouldn't think of combining classes like this, so thanks for the
pointer: I am sure it'll be useful in the future, but the simpler stuff
works here :)

> >>> +tbody.translation-stats td {
> >> table.translation-stats td {...
> >>
> >> (that way you don't need a separate rule for the tfoot below.)
> >
> > Actually, the 'cascading' of CSS seems to cause me problems in at least
> > Epiphany (xulrunner 1.9): if I set the rule up like that (that's what I
> > started with), it doesn't get picked up. I'll play a bit more with CSS
> > and will follow up.
> >
> > It's good to know that even CSS precedence rules differ between
> > browsers. :(
>
> Really? That is very strange. Try the more specific one I mentioned
> above - selecting both classes - I'd be interested to know why it was
> been over-ruled... is there something like firebug for epiphany?

Oh, it seems they don't differ: I was using a CSS rule with 'tr' in it
as well, and that probably caused problems. With that removed, it works
in Epiphany as well.

Also, I was under the impression that you tried this out in Firefox 3.5:
I did try this out in whatever-firefox-is-in-jaunty with firebug (which
is how I've seen that it doesn't really work properly). There is not
yet anything like firebug for epiphany, so in hard cases, I resort to
firefox :)

> Well *sorrrry* - I'd forgotten it was you helping barry with the rules -
> in previous reviews people haven't been aware. Next time I'll just keep
> my mouth shut ;)

Not at all! I think you should keep mentioning it: it's important that
everybody is aware of it.

> > Perhaps it'd make some sense for me to provide Navigation class for
> > ITranslationGroupSet, just so it's more consistent and so no confusion
> > arises in the future. Or perhaps just comment that this doesn't show up
> > in the request.traversed_objects because it doesn't provide Navigation
> > class.
> >
> > What do you think?
>
> I think a comment would be fine - it would have cleared up my confusion.

Done.

> No problem - I hope you didn't feel patronized by me pointing out things
> that were already obvious to you.

Don't worry at all: it's better to state the obvious than not and then
worry if somebody knows about something or not. I've long learned not
to be fussed about that with reviews (it was tough the first few months
in LP development :), because I realized that it helps me improve my
style as well.

For instance, you may have thought it obvious to combine classes like
you did above, but I didn't. So, keep up the good work!

Cheers,
Danilo

1=== modified file 'lib/canonical/launchpad/icing/style-3-0.css'
2--- lib/canonical/launchpad/icing/style-3-0.css 2009-09-11 06:57:21 +0000
3+++ lib/canonical/launchpad/icing/style-3-0.css 2009-09-11 08:20:21 +0000
4@@ -685,6 +685,9 @@ table.listing thead {
5 table.listing th {
6 font-weight: bold;
7 }
8+table.narrow-listing {
9+ width: 45em;
10+}
11
12 ul.language, li.language {
13 list-style-image: url(/@@/language);
14@@ -759,14 +762,14 @@ div.translations-legend {
15 padding-top: 2em;
16 padding-bottom: 1em;
17 }
18-tbody.translation-stats td {
19+table.translation-stats td {
20 text-align:center;
21 }
22-tbody.translation-stats td.template-name {
23+table.translation-stats td.template-name {
24 text-align:left;
25 }
26-tfoot tr.overall-translation-stats td,
27-tfoot tr.overall-translation-stats th {
28+table.translation-stats tfoot td,
29+table.translation-stats tfoot th {
30 background-color: #f7f7f7;
31 border: 0px;
32 border-top: 2px solid #d2d2d2;
33@@ -775,12 +778,9 @@ tfoot tr.overall-translation-stats th {
34 padding-bottom: 5px;
35 font-weight: bold;
36 }
37-tfoot tr.overall-translation-stats th {
38+table.translation-stats tfoot th {
39 text-align:left;
40 }
41-tfoot tr.overall-translation-stats td {
42+table.translation-stats tfoot td {
43 text-align:center;
44 }
45-table.narrow-listing {
46- width: 45em;
47-}
48
49=== modified file 'lib/lp/translations/browser/tests/test_breadcrumbs.py'
50--- lib/lp/translations/browser/tests/test_breadcrumbs.py 2009-09-10 10:27:20 +0000
51+++ lib/lp/translations/browser/tests/test_breadcrumbs.py 2009-09-11 08:20:13 +0000
52@@ -104,6 +104,9 @@ class TestTranslationGroupsBreadcrumbs(B
53 group_set = getUtility(ITranslationGroupSet)
54 url = canonical_url(group_set, rootsite='translations')
55 # Translation group listing is top-level, so no breadcrumbs show up.
56+ # Note that the first parameter is an empty list because
57+ # ITranslationGroupSet doesn't register Navigation class, and
58+ # thus doesn't show up in request.traversed_objects.
59 self._testContextBreadcrumbs(
60 [], [], [],
61 url=url)
62
63=== modified file 'lib/lp/translations/templates/serieslanguage-index.pt'
64--- lib/lp/translations/templates/serieslanguage-index.pt 2009-09-09 18:52:48 +0000
65+++ lib/lp/translations/templates/serieslanguage-index.pt 2009-09-11 08:20:21 +0000
66@@ -51,7 +51,7 @@
67 <div style="max-width:840px;">
68 <tal:navigation replace="structure view/batchnav/@@+navigation-links-upper" />
69
70- <table class="listing sortable" id="translationstatuses">
71+ <table class="listing sortable translation-stats">
72 <thead>
73 <tr>
74 <th>Template Name</th>
75@@ -64,7 +64,7 @@
76 <th>By</th>
77 </tr>
78 </thead>
79- <tbody class="translation-stats">
80+ <tbody>
81 <tr tal:repeat="entry view/pofiles"
82 tal:attributes="id string:${entry/potemplate/name}">
83 <td class="template-name">
84@@ -159,7 +159,7 @@
85 </td>
86 </tr>
87 <tfoot>
88- <tr class="overall-translation-stats">
89+ <tr>
90 <th>Overall statistics:</th>
91 <td><span tal:replace="context/messageCount">N</span></td>
92 <td>
93

« Back to merge proposal