commit 36f88a94be2ad7b4a301e505a7fe773b384f04e9
parent f2240eb26d2c410f9c3ccec24f221d9a997d3930
Author: Peter Kosyh <p.kosyh@gmail.com>
Date: Fri, 4 Sep 2020 11:39:56 +0300
Style up
Diffstat:
4 files changed, 74 insertions(+), 9 deletions(-)
diff --git a/ii-node/lib/style.css b/ii-node/lib/style.css
@@ -1,3 +1,56 @@
.msgtext {
white-space: pre-wrap;
}
+.selected {
+ background: red;
+}
+#echolist {
+ margin: 0;
+ margin-left:auto;
+ margin-right:auto;
+ padding: 0;
+ border: 1px solid #55aaaa;
+}
+#echolist a,a:visited,a:hover {
+ color: #000000;
+ text-decoration: underline;
+}
+#echolist th {
+ text-align: left;
+ color: white;
+ font-weight: bold;
+}
+
+#echolist .echo {
+ font-weight: normal;
+ text-align: left;
+}
+#echolist .count, .topics {
+ text-align: center;
+}
+#echolist .info {
+ color: #777777;
+ font-size: smaller;
+}
+#echolist .subj {
+ font-weight: bold;
+}
+#echolist th,td,tr {
+ border: 0;
+ margin: 0;
+ padding: 0.5em;
+ border-collapse: collapse;
+}
+
+#echolist .title {
+ background: #55aaaa;
+ padding: 0;
+ margin: 0;
+}
+#echolist .even {
+ background: #ffffea;
+}
+
+#echolist .odd {
+ background: #eaffff;
+}
diff --git a/ii-node/tpl/index.tpl b/ii-node/tpl/index.tpl
@@ -1,19 +1,24 @@
{{template "header.tpl" $}}
-
-<table class="echolist">
-<tr>
+{{ $odd := false }}
+<table id="echolist" cellspacing=0 cellpadding=0>
+<tr class="title">
<th>Name</th>
<th>Topics</th>
<th>Posts</th>
<th>Last</th>
</tr>
{{range .Echoes }}
-<tr>
-<td><a href="{{.Name}}">{{.Name}}</a></td>
-<td>{{.Topics}}</td>
-<td>{{.Count}}</td>
-<td>{{with .Msg}}{{.Date | fdate}}[{{.From}}] {{.Subj}}{{end}}</td>
+{{ if $odd }}
+<tr class="odd">
+{{ else }}
+<tr class="even">
+{{ end }}
+<td class="echo"><a href="{{.Name}}">{{.Name}}</a></td>
+<td class="topics">{{.Topics}}</td>
+<td class="count">{{.Count}}</td>
+<td class="info">{{with .Msg}}<span class="subj">{{.Subj}}</span><br><a href="/{{.MsgId}}#{{.MsgId}}">{{.Date | fdate}}</a> by {{.From}}{{end}}</td>
</tr>
+{{ $odd = not $odd }}
{{ end }}
</table>
diff --git a/ii-node/tpl/topic.tpl b/ii-node/tpl/topic.tpl
@@ -3,7 +3,12 @@
<div class="topic">
{{ range .Msg }}
+{{if eq $.Selected .MsgId }}
+<a name="{{.MsgId}}"></a>
+<div class="msg selected">
+{{else}}
<div class="msg">
+{{end}}
<span class="msgid"><a href="/{{$.BasePath}}/reply">{{.MsgId}}</a></span><br>
<span class="msgsubj">{{.Subj}}</span>
<br/>
diff --git a/ii-node/web.go b/ii-node/web.go
@@ -22,6 +22,7 @@ type WebContext struct {
Pager []int
BasePath string
User *ii.User
+ Selected string
}
func www_register(user *ii.User, www WWW, w http.ResponseWriter, r *http.Request) error {
@@ -241,7 +242,8 @@ func www_topic(user *ii.User, www WWW, w http.ResponseWriter, r *http.Request, i
} else if topic != mi.Id {
for k, v := range ids {
if v == mi.Id {
- ids = ids[k:]
+ page = k / PAGE_SIZE + 1
+ ctx.Selected = mi.Id
break
}
}