Merge lp:~jstpierre/loggerhead/css-changes into lp:loggerhead

Proposed by Jasper St. Pierre
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
Reviewer Review Type Date Requested Status
John A Meinel Approve
Review via email: mp+58855@code.launchpad.net
To post a comment you must log in.
Revision history for this message
John A Meinel (jameinel) wrote :

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.

review: Needs Fixing
Revision history for this message
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).

Revision history for this message
Robert Collins (lifeless) wrote :

@jam are your concerned addressed? I think jasper is stalled at the moment.

Revision history for this message
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.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'loggerhead/controllers/annotate_ui.py'
--- loggerhead/controllers/annotate_ui.py 2010-12-01 08:30:02 +0000
+++ loggerhead/controllers/annotate_ui.py 2011-04-22 21:35:57 +0000
@@ -16,6 +16,8 @@
16# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA16# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17#17#
1818
19import itertools
20
19from loggerhead.controllers.view_ui import ViewUI21from loggerhead.controllers.view_ui import ViewUI
20from loggerhead import util22from loggerhead import util
2123
@@ -29,23 +31,37 @@
29 31
30 change_cache = {}32 change_cache = {}
31 last_line_revid = None33 last_line_revid = None
32 parity = 134 last_lineno = None
33 for line_revid, text in tree.annotate_iter(file_id):35 message = ""
34 if line_revid == last_line_revid:36
35 # remember which lines have a new revno and which don't37 revisions = {}
36 new_rev = False38
37 else:39 lineno = 0
38 new_rev = True40 for (line_revid, text), lineno in zip(tree.annotate_iter(file_id), itertools.count(1)):
39 parity ^= 141 if line_revid != last_line_revid:
40 last_line_revid = line_revid42 last_line_revid = line_revid
41 if line_revid in change_cache:43
42 change = change_cache[line_revid]44 change = change_cache.get(line_revid, None)
43 else:45 if change is None:
44 change = self._history.get_changes([line_revid])[0]46 change = self._history.get_changes([line_revid])[0]
45 change_cache[line_revid] = change47 change_cache[line_revid] = change
4648
47 yield util.Container(49 message = change.comment.splitlines()[0]
48 parity=parity, new_rev=new_rev, change=change)50
51 if last_lineno:
52 # The revspan is of lines between the last revision and this one.
53 # We set the one for the previous revision when we're creating the current revision.
54 revisions[last_lineno].revspan = lineno - last_lineno
55
56 revisions[lineno] = util.Container(change=change, message=message)
57
58 last_lineno = lineno
59 last_line_revid = line_revid
60
61 # We never set a revspan for the last revision during the loop above, so set it here.
62 revisions[last_lineno].revspan = lineno - last_lineno + 1
63
64 return revisions
49 65
50 def get_values(self, path, kwargs, headers):66 def get_values(self, path, kwargs, headers):
51 values = super(AnnotateUI, self).get_values(path, kwargs, headers)67 values = super(AnnotateUI, self).get_values(path, kwargs, headers)
5268
=== modified file 'loggerhead/controllers/view_ui.py'
--- loggerhead/controllers/view_ui.py 2011-03-23 02:37:07 +0000
+++ loggerhead/controllers/view_ui.py 2011-04-22 21:35:57 +0000
@@ -123,10 +123,10 @@
123 raise HTTPMovedPermanently(self._branch.context_url(['/files', revno_url, path]))123 raise HTTPMovedPermanently(self._branch.context_url(['/files', revno_url, path]))
124124
125 return {125 return {
126 # In AnnotateUI, "annotated" is a generator giving revision126 # In AnnotateUI, "annotated" is a dictionary mapping lines to changes.
127 # numbers per lines, but the template checks if "annotated" is127 # We exploit the fact that bool({}) is False when checking whether
128 # true or not before using it, so we have to define it here also.128 # we're in "annotated" mode.
129 'annotated': False,129 'annotated': {},
130 'revno_url': revno_url,130 'revno_url': revno_url,
131 'file_id': file_id,131 'file_id': file_id,
132 'file_path': path,132 'file_path': path,
133133
=== modified file 'loggerhead/static/css/global.css'
--- loggerhead/static/css/global.css 2011-02-24 00:44:09 +0000
+++ loggerhead/static/css/global.css 2011-04-22 21:35:57 +0000
@@ -152,6 +152,7 @@
152 float: left;152 float: left;
153 display: inline;153 display: inline;
154 height: 22px;154 height: 22px;
155 line-height: 22px;
155 padding: 0 0 0 18px;156 padding: 0 0 0 18px;
156 background: transparent url(../images/ico_description.gif) no-repeat center left;157 background: transparent url(../images/ico_description.gif) no-repeat center left;
157 }158 }
@@ -163,7 +164,6 @@
163 }164 }
164165
165#branch-info {166#branch-info {
166 width: 900px;
167 padding: 10px;167 padding: 10px;
168 margin: 0 0 10px 0;168 margin: 0 0 10px 0;
169 color: #666;169 color: #666;
170170
=== modified file 'loggerhead/static/css/view.css'
--- loggerhead/static/css/view.css 2011-02-18 05:41:17 +0000
+++ loggerhead/static/css/view.css 2011-04-22 21:35:57 +0000
@@ -1,31 +1,30 @@
1/*table*/1/*table*/
2.viewLineTit,2#logentries,
3.viewRevTit,3.viewRev,
4.viewContTit {4.viewLine {
5 border: 1px solid #d2d2d2;5 border: 1px solid #d2d2d2;
6 }6}
7.viewLine,7.viewRev {
8.viewRev,8 border-right: none;
9 white-space: nowrap;
10 width: 1px;
11 padding: .3em .6em;
12}
9.viewComm,13.viewComm,
10.viewCont {14.viewCont {
11 border: none;15 border: none;
12 }16 }
13.viewLine,17.viewLine {
14.viewLineTit {18 border-style: none solid none none;
19 width: 20px;
20 padding-left: .6em;
15 padding-right: .2em;21 padding-right: .2em;
16 }22 }
17.viewLine {23.viewLine.first {
18 width: 37px;24 border-style: solid solid none none;
19 }25}
20.viewContTit,
21.viewCont {26.viewCont {
22 width: auto;27 padding-left: .4em;
23 padding-left: .3em;
24 }
25.viewRevTit,
26.viewRev {
27 width: 70px;
28 text-align: center;
29 }28 }
30.viewLine,29.viewLine,
31.viewCont {30.viewCont {
@@ -38,6 +37,11 @@
38 margin: 0;37 margin: 0;
39 }38 }
40.viewLine {39.viewLine {
41 text-align: right;40 text-align: center;
41 }
42.viewLine {
42 font-size: 93%;43 font-size: 93%;
43 }44 }
45.viewAuthors {
46 color: #999999;
47}
4448
=== modified file 'loggerhead/templates/inventory.pt'
--- loggerhead/templates/inventory.pt 2011-02-23 03:01:15 +0000
+++ loggerhead/templates/inventory.pt 2011-04-22 21:35:57 +0000
@@ -19,22 +19,18 @@
19 </tal:has-link>19 </tal:has-link>
20 </tal:block>20 </tal:block>
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}" />
22 <tal:block metal:fill-slot="heading">22 <tal:block metal:fill-slot="heading">
23 <div id="breadcrumbs">23 <div id="breadcrumbs">
24 <tal:has-link condition="branch/branch_link">24 <tal:has-link condition="branch/branch_link">
25 <a tal:attributes="href branch/branch_link"25 <a tal:attributes="href branch/branch_link"
26 tal:content="branch/friendly_name">26 tal:content="branch/friendly_name">
27 nice/branch/name27 nice/branch/name
28 </a>28 </a>
29 </tal:has-link>29 </tal:has-link>
30 <span tal:condition="not: branch/branch_link">30 <tal:no-link condition="not: branch/branch_link">
31 <span metal:use-macro="breadcrumbs/directory" />31 <span metal:use-macro="breadcrumbs/directory"></span>
32 </span>32 </tal:no-link>
33 <tal:block condition="python:change">33 <span>: <span metal:use-macro="breadcrumbs/branch" /> (revision <tal:revno content="change/revno"></tal:revno>)</span>
34 &#187; Viewing
35 <span metal:use-macro="breadcrumbs/branch" />
36 for revision <span tal:content="change/revno"/>
37 </tal:block>
38 </div>34 </div>
39 </tal:block>35 </tal:block>
4036
4137
=== modified file 'loggerhead/templates/view.pt'
--- loggerhead/templates/view.pt 2011-02-23 03:01:15 +0000
+++ loggerhead/templates/view.pt 2011-04-22 21:35:57 +0000
@@ -49,11 +49,11 @@
49 </li>49 </li>
50 <li tal:condition="not:annotated">50 <li tal:condition="not:annotated">
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)"
52 >view revision numbers per line</a>52 >view with revision information</a>
53 </li>53 </li>
54 <li tal:condition="annotated">54 <li tal:condition="annotated">
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)"
56 >view without revision numbers</a>56 >view without revision information</a>
57 </li>57 </li>
58 <li>58 <li>
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>
@@ -71,25 +71,24 @@
7171
72 <div class="view">72 <div class="view">
73 <table id="logentries">73 <table id="logentries">
74 <tr class="logheader">
75 <th class="viewLineTit">Line</th>
76 <th class="viewRevTit" tal:condition="annotated">Revision</th>
77 <th class="viewContTit">Contents</th>
78 </tr>
79
80 <tal:rep tal:repeat="line contents">74 <tal:rep tal:repeat="line contents">
81 <tr tal:define="anno python:annotated and annotated.next()"75 <tr>
82 tal:attributes="class python:anno and 'blueRow' + str(anno.parity) or None">76 <td tal:condition="python:path('repeat/line/number') in annotated"
83 <td class="viewLine">77 tal:define="anno python:annotated.get(path('repeat/line/number'), None)"
78 tal:attributes="rowspan python:anno.revspan"
79 class="viewRev">
80 <a tal:content="python:'%s' % (anno.change.revno,)"
81 tal:attributes="href python:url(['/revision', anno.change.revno], clear=1);
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>
83 <span class="viewAuthors" tal:content="python:'by ' + ', '.join(util.hide_emails(anno.change.authors))" />
84 <br />
85
86 <span tal:content="python:anno.message"></span>
87 </td>
88 <td tal:attributes="class python:path('repeat/line/number') in annotated and 'viewLine first' or 'viewLine'">
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}"
85 tal:content="repeat/line/number">1</a>90 tal:content="repeat/line/number">1</a>
86 </td>91 </td>
87 <td class="viewRev" tal:condition="annotated">
88 <a tal:condition="python:anno.new_rev"
89 tal:content="python:util.trunc(anno.change.revno)"
90 tal:attributes="href python:url(['/revision', anno.change.revno], clear=1);
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>
92 </td>
93 <td class="viewCont"><pre tal:content="structure line"></pre></td>92 <td class="viewCont"><pre tal:content="structure line"></pre></td>
94 </tr>93 </tr>
95 </tal:rep>94 </tal:rep>

Subscribers

People subscribed via source and target branches