Merge lp:~jstpierre/loggerhead/css-changes into lp:loggerhead
- css-changes
- Merge into trunk-rich
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | John A Meinel | ||||
Approved revision: | 450 | ||||
Merged at revision: | 448 | ||||
Proposed branch: | lp:~jstpierre/loggerhead/css-changes | ||||
Merge into: | lp:loggerhead | ||||
Diff against target: |
260 lines (+80/-65) 6 files modified
loggerhead/controllers/annotate_ui.py (+29/-13) loggerhead/controllers/view_ui.py (+4/-4) loggerhead/static/css/global.css (+1/-1) loggerhead/static/css/view.css (+24/-20) loggerhead/templates/inventory.pt (+6/-10) loggerhead/templates/view.pt (+16/-17) |
||||
To merge this branch: | bzr merge lp:~jstpierre/loggerhead/css-changes | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
John A Meinel | Approve | ||
Review via email: mp+58855@code.launchpad.net |
Commit message
Description of the change
Jasper St. Pierre (jstpierre) wrote : | # |
"the content you want to see"
Isn't the content you want to see the annotation?
Anyway, HTML is a mess, and I'd like to figure out how to do this properly, but after Googling and talking with people, it looks like max-width is ignored for tables, so I can't use that.
Ideally, I'd really like three columns:
=======
Annotation | Line | Content
=======
* Annotation should take up the minimum amount of space without wrapping, with a maximum width of 25%., in which case it should wrap.
* Line should be 20px or so, like it is now.
* Content should have all of the extra space, if there is any. Not Annotation or Line.
I don't feel this is possible with just HTML or CSS, which is extremely disappointing.
The closest I've gotten is:
td.annotation {
max-width: 25%;
white-space: nowrap;
}
But then Content doesn't get all of the extra space (it could be in Annotation).
Robert Collins (lifeless) wrote : | # |
@jam are your concerned addressed? I think jasper is stalled at the moment.
John A Meinel (jameinel) wrote : | # |
I don't think this is perfect, but my CSS is far worse than Jasper's. So I don't have anything better to put here, and I think on the whole it is better than the current layout.
Preview Diff
1 | === modified file 'loggerhead/controllers/annotate_ui.py' | |||
2 | --- loggerhead/controllers/annotate_ui.py 2010-12-01 08:30:02 +0000 | |||
3 | +++ loggerhead/controllers/annotate_ui.py 2011-04-22 21:35:57 +0000 | |||
4 | @@ -16,6 +16,8 @@ | |||
5 | 16 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 16 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
6 | 17 | # | 17 | # |
7 | 18 | 18 | ||
8 | 19 | import itertools | ||
9 | 20 | |||
10 | 19 | from loggerhead.controllers.view_ui import ViewUI | 21 | from loggerhead.controllers.view_ui import ViewUI |
11 | 20 | from loggerhead import util | 22 | from loggerhead import util |
12 | 21 | 23 | ||
13 | @@ -29,23 +31,37 @@ | |||
14 | 29 | 31 | ||
15 | 30 | change_cache = {} | 32 | change_cache = {} |
16 | 31 | last_line_revid = None | 33 | last_line_revid = None |
25 | 32 | parity = 1 | 34 | last_lineno = None |
26 | 33 | for line_revid, text in tree.annotate_iter(file_id): | 35 | message = "" |
27 | 34 | if line_revid == last_line_revid: | 36 | |
28 | 35 | # remember which lines have a new revno and which don't | 37 | revisions = {} |
29 | 36 | new_rev = False | 38 | |
30 | 37 | else: | 39 | lineno = 0 |
31 | 38 | new_rev = True | 40 | for (line_revid, text), lineno in zip(tree.annotate_iter(file_id), itertools.count(1)): |
32 | 39 | parity ^= 1 | 41 | if line_revid != last_line_revid: |
33 | 40 | last_line_revid = line_revid | 42 | last_line_revid = line_revid |
37 | 41 | if line_revid in change_cache: | 43 | |
38 | 42 | change = change_cache[line_revid] | 44 | change = change_cache.get(line_revid, None) |
39 | 43 | else: | 45 | if change is None: |
40 | 44 | change = self._history.get_changes([line_revid])[0] | 46 | change = self._history.get_changes([line_revid])[0] |
41 | 45 | change_cache[line_revid] = change | 47 | change_cache[line_revid] = change |
42 | 46 | 48 | ||
45 | 47 | yield util.Container( | 49 | message = change.comment.splitlines()[0] |
46 | 48 | parity=parity, new_rev=new_rev, change=change) | 50 | |
47 | 51 | if last_lineno: | ||
48 | 52 | # The revspan is of lines between the last revision and this one. | ||
49 | 53 | # We set the one for the previous revision when we're creating the current revision. | ||
50 | 54 | revisions[last_lineno].revspan = lineno - last_lineno | ||
51 | 55 | |||
52 | 56 | revisions[lineno] = util.Container(change=change, message=message) | ||
53 | 57 | |||
54 | 58 | last_lineno = lineno | ||
55 | 59 | last_line_revid = line_revid | ||
56 | 60 | |||
57 | 61 | # We never set a revspan for the last revision during the loop above, so set it here. | ||
58 | 62 | revisions[last_lineno].revspan = lineno - last_lineno + 1 | ||
59 | 63 | |||
60 | 64 | return revisions | ||
61 | 49 | 65 | ||
62 | 50 | def get_values(self, path, kwargs, headers): | 66 | def get_values(self, path, kwargs, headers): |
63 | 51 | values = super(AnnotateUI, self).get_values(path, kwargs, headers) | 67 | values = super(AnnotateUI, self).get_values(path, kwargs, headers) |
64 | 52 | 68 | ||
65 | === modified file 'loggerhead/controllers/view_ui.py' | |||
66 | --- loggerhead/controllers/view_ui.py 2011-03-23 02:37:07 +0000 | |||
67 | +++ loggerhead/controllers/view_ui.py 2011-04-22 21:35:57 +0000 | |||
68 | @@ -123,10 +123,10 @@ | |||
69 | 123 | raise HTTPMovedPermanently(self._branch.context_url(['/files', revno_url, path])) | 123 | raise HTTPMovedPermanently(self._branch.context_url(['/files', revno_url, path])) |
70 | 124 | 124 | ||
71 | 125 | return { | 125 | return { |
76 | 126 | # In AnnotateUI, "annotated" is a generator giving revision | 126 | # In AnnotateUI, "annotated" is a dictionary mapping lines to changes. |
77 | 127 | # numbers per lines, but the template checks if "annotated" is | 127 | # We exploit the fact that bool({}) is False when checking whether |
78 | 128 | # true or not before using it, so we have to define it here also. | 128 | # we're in "annotated" mode. |
79 | 129 | 'annotated': False, | 129 | 'annotated': {}, |
80 | 130 | 'revno_url': revno_url, | 130 | 'revno_url': revno_url, |
81 | 131 | 'file_id': file_id, | 131 | 'file_id': file_id, |
82 | 132 | 'file_path': path, | 132 | 'file_path': path, |
83 | 133 | 133 | ||
84 | === modified file 'loggerhead/static/css/global.css' | |||
85 | --- loggerhead/static/css/global.css 2011-02-24 00:44:09 +0000 | |||
86 | +++ loggerhead/static/css/global.css 2011-04-22 21:35:57 +0000 | |||
87 | @@ -152,6 +152,7 @@ | |||
88 | 152 | float: left; | 152 | float: left; |
89 | 153 | display: inline; | 153 | display: inline; |
90 | 154 | height: 22px; | 154 | height: 22px; |
91 | 155 | line-height: 22px; | ||
92 | 155 | padding: 0 0 0 18px; | 156 | padding: 0 0 0 18px; |
93 | 156 | background: transparent url(../images/ico_description.gif) no-repeat center left; | 157 | background: transparent url(../images/ico_description.gif) no-repeat center left; |
94 | 157 | } | 158 | } |
95 | @@ -163,7 +164,6 @@ | |||
96 | 163 | } | 164 | } |
97 | 164 | 165 | ||
98 | 165 | #branch-info { | 166 | #branch-info { |
99 | 166 | width: 900px; | ||
100 | 167 | padding: 10px; | 167 | padding: 10px; |
101 | 168 | margin: 0 0 10px 0; | 168 | margin: 0 0 10px 0; |
102 | 169 | color: #666; | 169 | color: #666; |
103 | 170 | 170 | ||
104 | === modified file 'loggerhead/static/css/view.css' | |||
105 | --- loggerhead/static/css/view.css 2011-02-18 05:41:17 +0000 | |||
106 | +++ loggerhead/static/css/view.css 2011-04-22 21:35:57 +0000 | |||
107 | @@ -1,31 +1,30 @@ | |||
108 | 1 | /*table*/ | 1 | /*table*/ |
112 | 2 | .viewLineTit, | 2 | #logentries, |
113 | 3 | .viewRevTit, | 3 | .viewRev, |
114 | 4 | .viewContTit { | 4 | .viewLine { |
115 | 5 | border: 1px solid #d2d2d2; | 5 | border: 1px solid #d2d2d2; |
119 | 6 | } | 6 | } |
120 | 7 | .viewLine, | 7 | .viewRev { |
121 | 8 | .viewRev, | 8 | border-right: none; |
122 | 9 | white-space: nowrap; | ||
123 | 10 | width: 1px; | ||
124 | 11 | padding: .3em .6em; | ||
125 | 12 | } | ||
126 | 9 | .viewComm, | 13 | .viewComm, |
127 | 10 | .viewCont { | 14 | .viewCont { |
128 | 11 | border: none; | 15 | border: none; |
129 | 12 | } | 16 | } |
132 | 13 | .viewLine, | 17 | .viewLine { |
133 | 14 | .viewLineTit { | 18 | border-style: none solid none none; |
134 | 19 | width: 20px; | ||
135 | 20 | padding-left: .6em; | ||
136 | 15 | padding-right: .2em; | 21 | padding-right: .2em; |
137 | 16 | } | 22 | } |
142 | 17 | .viewLine { | 23 | .viewLine.first { |
143 | 18 | width: 37px; | 24 | border-style: solid solid none none; |
144 | 19 | } | 25 | } |
141 | 20 | .viewContTit, | ||
145 | 21 | .viewCont { | 26 | .viewCont { |
153 | 22 | width: auto; | 27 | padding-left: .4em; |
147 | 23 | padding-left: .3em; | ||
148 | 24 | } | ||
149 | 25 | .viewRevTit, | ||
150 | 26 | .viewRev { | ||
151 | 27 | width: 70px; | ||
152 | 28 | text-align: center; | ||
154 | 29 | } | 28 | } |
155 | 30 | .viewLine, | 29 | .viewLine, |
156 | 31 | .viewCont { | 30 | .viewCont { |
157 | @@ -38,6 +37,11 @@ | |||
158 | 38 | margin: 0; | 37 | margin: 0; |
159 | 39 | } | 38 | } |
160 | 40 | .viewLine { | 39 | .viewLine { |
162 | 41 | text-align: right; | 40 | text-align: center; |
163 | 41 | } | ||
164 | 42 | .viewLine { | ||
165 | 42 | font-size: 93%; | 43 | font-size: 93%; |
166 | 43 | } | 44 | } |
167 | 45 | .viewAuthors { | ||
168 | 46 | color: #999999; | ||
169 | 47 | } | ||
170 | 44 | 48 | ||
171 | === modified file 'loggerhead/templates/inventory.pt' | |||
172 | --- loggerhead/templates/inventory.pt 2011-02-23 03:01:15 +0000 | |||
173 | +++ loggerhead/templates/inventory.pt 2011-04-22 21:35:57 +0000 | |||
174 | @@ -19,22 +19,18 @@ | |||
175 | 19 | </tal:has-link> | 19 | </tal:has-link> |
176 | 20 | </tal:block> | 20 | </tal:block> |
177 | 21 | <tal:block metal:fill-slot="branchname" tal:content="string:${branch/friendly_name}" /> | 21 | <tal:block metal:fill-slot="branchname" tal:content="string:${branch/friendly_name}" /> |
180 | 22 | <tal:block metal:fill-slot="heading"> | 22 | <tal:block metal:fill-slot="heading"> |
181 | 23 | <div id="breadcrumbs"> | 23 | <div id="breadcrumbs"> |
182 | 24 | <tal:has-link condition="branch/branch_link"> | 24 | <tal:has-link condition="branch/branch_link"> |
183 | 25 | <a tal:attributes="href branch/branch_link" | 25 | <a tal:attributes="href branch/branch_link" |
184 | 26 | tal:content="branch/friendly_name"> | 26 | tal:content="branch/friendly_name"> |
185 | 27 | nice/branch/name | 27 | nice/branch/name |
186 | 28 | </a> | 28 | </a> |
187 | 29 | </tal:has-link> | 29 | </tal:has-link> |
196 | 30 | <span tal:condition="not: branch/branch_link"> | 30 | <tal:no-link condition="not: branch/branch_link"> |
197 | 31 | <span metal:use-macro="breadcrumbs/directory" /> | 31 | <span metal:use-macro="breadcrumbs/directory"></span> |
198 | 32 | </span> | 32 | </tal:no-link> |
199 | 33 | <tal:block condition="python:change"> | 33 | <span>: <span metal:use-macro="breadcrumbs/branch" /> (revision <tal:revno content="change/revno"></tal:revno>)</span> |
192 | 34 | » Viewing | ||
193 | 35 | <span metal:use-macro="breadcrumbs/branch" /> | ||
194 | 36 | for revision <span tal:content="change/revno"/> | ||
195 | 37 | </tal:block> | ||
200 | 38 | </div> | 34 | </div> |
201 | 39 | </tal:block> | 35 | </tal:block> |
202 | 40 | 36 | ||
203 | 41 | 37 | ||
204 | === modified file 'loggerhead/templates/view.pt' | |||
205 | --- loggerhead/templates/view.pt 2011-02-23 03:01:15 +0000 | |||
206 | +++ loggerhead/templates/view.pt 2011-04-22 21:35:57 +0000 | |||
207 | @@ -49,11 +49,11 @@ | |||
208 | 49 | </li> | 49 | </li> |
209 | 50 | <li tal:condition="not:annotated"> | 50 | <li tal:condition="not:annotated"> |
210 | 51 | <a tal:attributes="href python:url(['/annotate', revno_url, file_path], clear=1)" | 51 | <a tal:attributes="href python:url(['/annotate', revno_url, file_path], clear=1)" |
212 | 52 | >view revision numbers per line</a> | 52 | >view with revision information</a> |
213 | 53 | </li> | 53 | </li> |
214 | 54 | <li tal:condition="annotated"> | 54 | <li tal:condition="annotated"> |
215 | 55 | <a tal:attributes="href python:url(['/view', revno_url, file_path], clear=1)" | 55 | <a tal:attributes="href python:url(['/view', revno_url, file_path], clear=1)" |
217 | 56 | >view without revision numbers</a> | 56 | >view without revision information</a> |
218 | 57 | </li> | 57 | </li> |
219 | 58 | <li> | 58 | <li> |
220 | 59 | <a tal:attributes="href python:url(['/revision', change.revno], clear=1)">view revision</a> | 59 | <a tal:attributes="href python:url(['/revision', change.revno], clear=1)">view revision</a> |
221 | @@ -71,25 +71,24 @@ | |||
222 | 71 | 71 | ||
223 | 72 | <div class="view"> | 72 | <div class="view"> |
224 | 73 | <table id="logentries"> | 73 | <table id="logentries"> |
225 | 74 | <tr class="logheader"> | ||
226 | 75 | <th class="viewLineTit">Line</th> | ||
227 | 76 | <th class="viewRevTit" tal:condition="annotated">Revision</th> | ||
228 | 77 | <th class="viewContTit">Contents</th> | ||
229 | 78 | </tr> | ||
230 | 79 | |||
231 | 80 | <tal:rep tal:repeat="line contents"> | 74 | <tal:rep tal:repeat="line contents"> |
235 | 81 | <tr tal:define="anno python:annotated and annotated.next()" | 75 | <tr> |
236 | 82 | tal:attributes="class python:anno and 'blueRow' + str(anno.parity) or None"> | 76 | <td tal:condition="python:path('repeat/line/number') in annotated" |
237 | 83 | <td class="viewLine"> | 77 | tal:define="anno python:annotated.get(path('repeat/line/number'), None)" |
238 | 78 | tal:attributes="rowspan python:anno.revspan" | ||
239 | 79 | class="viewRev"> | ||
240 | 80 | <a tal:content="python:'%s' % (anno.change.revno,)" | ||
241 | 81 | tal:attributes="href python:url(['/revision', anno.change.revno], clear=1); | ||
242 | 82 | title python:'%s by %s, on %s (%s)' % (anno.change.revno, ', '.join(util.hide_emails(anno.change.authors)), anno.change.date.strftime('%d %b %Y %H:%M'), util.date_time(anno.change.date))"></a> | ||
243 | 83 | <span class="viewAuthors" tal:content="python:'by ' + ', '.join(util.hide_emails(anno.change.authors))" /> | ||
244 | 84 | <br /> | ||
245 | 85 | |||
246 | 86 | <span tal:content="python:anno.message"></span> | ||
247 | 87 | </td> | ||
248 | 88 | <td tal:attributes="class python:path('repeat/line/number') in annotated and 'viewLine first' or 'viewLine'"> | ||
249 | 84 | <a tal:attributes="id string:L${repeat/line/number}; href string:#L${repeat/line/number}" | 89 | <a tal:attributes="id string:L${repeat/line/number}; href string:#L${repeat/line/number}" |
250 | 85 | tal:content="repeat/line/number">1</a> | 90 | tal:content="repeat/line/number">1</a> |
251 | 86 | </td> | 91 | </td> |
252 | 87 | <td class="viewRev" tal:condition="annotated"> | ||
253 | 88 | <a tal:condition="python:anno.new_rev" | ||
254 | 89 | tal:content="python:util.trunc(anno.change.revno)" | ||
255 | 90 | tal:attributes="href python:url(['/revision', anno.change.revno], clear=1); | ||
256 | 91 | title python:'%s by %s, on %s (%s)' % (anno.change.revno, ', '.join(util.hide_emails(anno.change.authors)), anno.change.date.strftime('%d %b %Y %H:%M'), util.date_time(anno.change.date))"></a> | ||
257 | 92 | </td> | ||
258 | 93 | <td class="viewCont"><pre tal:content="structure line"></pre></td> | 92 | <td class="viewCont"><pre tal:content="structure line"></pre></td> |
259 | 94 | </tr> | 93 | </tr> |
260 | 95 | </tal:rep> | 94 | </tal:rep> |
I like the idea of the changes. But I did a quick test and the annotation column on the left 'blew up' and consumed pretty much the whole screen.
I don't think it is really usable in that state. If we can find a way to prevent the annotation information from consuming so much width I think this is ready to land.
Another thing that would be nice, but certainly doesn't block this, is if the columns were split, such that selecting text would not give you the annotations. Certainly doesn't have to be done to get this landed.
But I think it would be a usability regression if we landed this as is, because many pages will push the content you want to see off to the right.