Add links to the nodes in the thread graph
Currently it's just the nodes themselves which are kind of tiny and hard to hit. Probably should add some invisible overlay.
This commit is contained in:
parent
15c70e6836
commit
8e1337bc8f
14
mbox2web
14
mbox2web
|
@ -1053,7 +1053,7 @@ class Thread:
|
||||||
if y == 0:
|
if y == 0:
|
||||||
# first message in thread
|
# first message in thread
|
||||||
# Just add a node
|
# Just add a node
|
||||||
nodes.append((x, y))
|
nodes.append((x, y, m.encmsgid))
|
||||||
m.x = x
|
m.x = x
|
||||||
m.y = y
|
m.y = y
|
||||||
else:
|
else:
|
||||||
|
@ -1064,7 +1064,7 @@ class Thread:
|
||||||
# or Thread-Index)
|
# or Thread-Index)
|
||||||
# Just start a new column to get out of the way
|
# Just start a new column to get out of the way
|
||||||
x += 1
|
x += 1
|
||||||
nodes.append((x, y))
|
nodes.append((x, y, m.encmsgid))
|
||||||
m.x = x
|
m.x = x
|
||||||
m.y = y
|
m.y = y
|
||||||
|
|
||||||
|
@ -1085,7 +1085,7 @@ class Thread:
|
||||||
# Just put the new kid directly below the parent
|
# Just put the new kid directly below the parent
|
||||||
m.x = p.x
|
m.x = p.x
|
||||||
m.y = y
|
m.y = y
|
||||||
nodes.append((m.x, m.y))
|
nodes.append((m.x, m.y, m.encmsgid))
|
||||||
edges.append((p.x, p.y, m.x, m.y))
|
edges.append((p.x, p.y, m.x, m.y))
|
||||||
p.kids = True
|
p.kids = True
|
||||||
else:
|
else:
|
||||||
|
@ -1096,7 +1096,7 @@ class Thread:
|
||||||
x += 1
|
x += 1
|
||||||
m.x = x
|
m.x = x
|
||||||
m.y = y
|
m.y = y
|
||||||
nodes.append((m.x, m.y))
|
nodes.append((m.x, m.y, m.encmsgid))
|
||||||
for r in m.in_reply_to:
|
for r in m.in_reply_to:
|
||||||
p = self.messages[r]
|
p = self.messages[r]
|
||||||
edges.append((p.x, p.y, m.x, m.y))
|
edges.append((p.x, p.y, m.x, m.y))
|
||||||
|
@ -1120,19 +1120,21 @@ class Thread:
|
||||||
yc = e[1] + 1
|
yc = e[1] + 1
|
||||||
s += f"<path d='M {e[0] * fx + fx/2} {e[1] * fy + fy/2} Q {e[2] * fx + fx/2} {yc * fy + fy/2} {e[2] * fx + fx/2} {e[3] * fy + fy/2}' stroke='black' fill='none' />"
|
s += f"<path d='M {e[0] * fx + fx/2} {e[1] * fy + fy/2} Q {e[2] * fx + fx/2} {yc * fy + fy/2} {e[2] * fx + fx/2} {e[3] * fy + fy/2}' stroke='black' fill='none' />"
|
||||||
for n in nodes:
|
for n in nodes:
|
||||||
|
s += f"<a xlink:href='../../msg/{n[2]}/' >"
|
||||||
s += f"<circle cx={n[0] * fx + fx/2} cy={n[1] * fy + fy/2} r={r} />"
|
s += f"<circle cx={n[0] * fx + fx/2} cy={n[1] * fy + fy/2} r={r} />"
|
||||||
|
s += f"</a>"
|
||||||
s += "</svg>"
|
s += "</svg>"
|
||||||
s += "</td>"
|
s += "</td>"
|
||||||
|
|
||||||
# XXX - escape!
|
# XXX - escape!
|
||||||
s += f"<td class='date'><a href='/msg/{lines[0][3]}/'>{lines[0][0]}</a></td>"
|
s += f"<td class='date'><a href='../../msg/{lines[0][3]}/'>{lines[0][0]}</a></td>"
|
||||||
s += f"<td class='from'>{html.escape(lines[0][1])}</td>"
|
s += f"<td class='from'>{html.escape(lines[0][1])}</td>"
|
||||||
s += f"<td class='subject'>{html.escape(lines[0][2])}</td>"
|
s += f"<td class='subject'>{html.escape(lines[0][2])}</td>"
|
||||||
s += "</tr>"
|
s += "</tr>"
|
||||||
|
|
||||||
for ln in lines[1:]:
|
for ln in lines[1:]:
|
||||||
s += "<tr>"
|
s += "<tr>"
|
||||||
s += f"<td class='date'><a href='/msg/{ln[3]}/'>{ln[0]}</a></td>"
|
s += f"<td class='date'><a href='../../msg/{ln[3]}/'>{ln[0]}</a></td>"
|
||||||
s += f"<td class='from'>{html.escape(ln[1])}</td>"
|
s += f"<td class='from'>{html.escape(ln[1])}</td>"
|
||||||
s += f"<td class='subject'>{html.escape(ln[2])}</td>"
|
s += f"<td class='subject'>{html.escape(ln[2])}</td>"
|
||||||
s += "</tr>"
|
s += "</tr>"
|
||||||
|
|
Loading…
Reference in New Issue