openidec

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 0c623826be63c0d0ca7643eebc7a71a6642e8bc2
parent ee97147ecdb50b6d80554a9eea22d6230ec74ad2
Author: Peter Kosyh <p.kosyh@gmail.com>
Date:   Fri,  4 Sep 2020 16:36:49 +0300

style

Diffstat:
Mii-node/lib/style.css | 67+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mii-node/tpl/header.tpl | 13++++++++++++-
Mii-node/tpl/index.tpl | 8++++----
Mii-node/tpl/pager.tpl | 4+++-
Mii-node/tpl/topic.tpl | 16+++++++++-------
Mii-node/tpl/topics.tpl | 7+++----
Mii-node/web.go | 13++++++++++++-
7 files changed, 110 insertions(+), 18 deletions(-)

diff --git a/ii-node/lib/style.css b/ii-node/lib/style.css @@ -12,6 +12,7 @@ .fsmaller { font-size: smaller; } + #pager { // font-size: smaller; padding: 0.5em; @@ -87,3 +88,69 @@ #echolist .odd,#topiclist .odd { background: #eaffff; } + +#topic .msg { + background-color: #ffffea; + margin-bottom: 1em; + text-align: left; + padding: 1em; + box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26); + overflow: auto; +} +#topic .selected { + background: #eaffff; +} +#topic .subj a, #topic .subj a:hover, #topic .subj a:visited { + color: #ea5555; + font-size: large; + text-decoration: none; +} +#topic .reply a, #topic .reply a:hover, #topic .reply a:visited { + color: #ea5555; + text-decoration: none; +} +#topic .info { + color: #555555; + font-size: smaller; +} + +#header { + margin: 0; + margin-left:auto; + margin-right:auto; + padding: 0; + border: 0; + border-collapse: collapse; +} + +#header .title { + width: 100%; + padding: 0 0 0.5em 0; +} +#header tr { + vertical-align: bottom; +} +#header .title .logo { + font-size: xx-large; + font-weight: bold; +} + +#header .logo a { + text-decoration: none; + color: black; +} +#header .title .info { + font-size: smaller; + color: #555555; + font-style: italic; +} + +#header .links { + padding: 0 1em 0.5em 0; +} + +@media (max-width: 640px) { + .extra { + display: none; + } +} diff --git a/ii-node/tpl/header.tpl b/ii-node/tpl/header.tpl @@ -3,10 +3,21 @@ <meta name="Robots" content="index,follow"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta charset="utf-8"/> +<meta name="viewport" content="width=device-width; initial-scale=1.0"> <link rel="icon" href="/lib/icon.png" type="image/png"> <link rel="stylesheet" type="text/css" href="/lib/style.css"> <title>go-ii</title> </head> <body> <div id="body"> -{{ with .User }}{{.Name}}{{end}} +<table id="header"> + <tr> + <td class="title"> + <span class="logo"><a href="/">ii-go</a></span> + <span class="info">II/IDEC networks</span> + </td> + <td class="links"> + {{ with .User }}{{.Name}}{{end}} + </td> +</tr> +</table> diff --git a/ii-node/tpl/index.tpl b/ii-node/tpl/index.tpl @@ -3,8 +3,8 @@ <table id="echolist" cellspacing=0 cellpadding=0> <tr class="title"> <th>Echo</th> -<th>Topics</th> -<th>Posts</th> +<th class="extra">Topics</th> +<th class="extra">Posts</th> <th>Last</th> </tr> {{range .Echoes }} @@ -14,8 +14,8 @@ <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="topics extra">{{.Topics}}</td> +<td class="count extra">{{.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 }} diff --git a/ii-node/tpl/pager.tpl b/ii-node/tpl/pager.tpl @@ -1,9 +1,11 @@ -{{$.Pages}} {{ if gt $.Pages 100 }} <div id="pager" class ="fsmaller"> {{ else }} <div id="pager"> {{ end }} +{{ if gt .Pages 1 }} +Pages: +{{ end }} {{ range .Pager }} {{ if eq . $.Page }} <span class="selected">{{.}}</span> diff --git a/ii-node/tpl/topic.tpl b/ii-node/tpl/topic.tpl @@ -1,7 +1,7 @@ {{template "header.tpl" $}} {{template "pager.tpl" $}} -<div class="topic"> +<div id="topic"> {{ range .Msg }} {{if eq $.Selected .MsgId }} <a name="{{.MsgId}}"></a> @@ -9,18 +9,20 @@ {{else}} <div class="msg"> {{end}} -<span class="msgid"><a href="/{{$.BasePath}}/reply">{{.MsgId}}</a></span><br> -<span class="msgsubj">{{.Subj}}</span> -<br/> -<span class="msginfo">{{.From}}({{.Addr}}) -> {{.To}}</span> -<br/> -<span class="msgtext"> +<span class="subj"><a href="/{{. | repto}}#{{. | repto}}">{{.Subj}}</a></span><br> +<span class="info">{{.From}}({{.Addr}}) &mdash; {{.To}}<br>{{.Date | fdate}}</span><br> +<span class="text"> +<br> {{with .Text}} {{. | msg_format}} {{end}} +<br> +<br> +<span class="reply"><a href="/{{$.BasePath}}/reply">Reply</a></span><br> </span> </div> {{ end }} </div> +{{template "pager.tpl" $}} {{template "footer.tpl"}} diff --git a/ii-node/tpl/topics.tpl b/ii-node/tpl/topics.tpl @@ -7,7 +7,7 @@ <table id="topiclist" cellspacing=0 cellpadding=0> <tr class="title"> <th>Topics</th> -<th>Posts</th> +<th class="extra">Posts</th> <th>Last post</th> </tr> {{range .Topics }} @@ -17,12 +17,11 @@ <tr class="even"> {{ end }} <td class="topic"><a href="/{{.Head.MsgId}}">{{.Head.Subj}}</a></td> -<td class="posts">{{.Count}}</td> +<td class="posts extra">{{.Count}}</td> <td class="info"><a href="/{{.Tail.MsgId}}#{{.Tail.MsgId}}">{{.Tail.Date | fdate}}</a><br>by {{.Tail.From}}</td> </tr> {{ $odd = not $odd }} {{ end }} </table> - - +{{template "pager.tpl" $}} {{template "footer.tpl"}} diff --git a/ii-node/web.go b/ii-node/web.go @@ -128,7 +128,10 @@ func getTopics(db *ii.DB, mi []*ii.MsgInfo) map[string][]string { return l[i].Off < l[j].Off }) for _, i := range l { - if i.Id == t.Id { + if i.Id == t.Id { + continue + } + if _, ok := intopic[i.Id]; ok { continue } topics[t.Id] = append(topics[t.Id], i.Id) @@ -359,6 +362,10 @@ func www_reply(user *ii.User, www WWW, w http.ResponseWriter, r *http.Request, i } func msg_format(txt string) template.HTML { + txt = strings.Replace(txt, "\r", "", -1) + txt = strings.TrimLeft(txt, "\n") + txt = strings.TrimRight(txt, "\n") + txt = strings.TrimSuffix(txt, "\n") txt = strings.Replace(txt, "&", "&amp;", -1) txt = strings.Replace(txt, "<", "&lt;", -1) txt = strings.Replace(txt, ">", "&gt;", -1) @@ -371,6 +378,10 @@ func WebInit(www *WWW, db *ii.DB) { return time.Unix(date, 0).Format("2006-01-02 15:04:05") }, "msg_format": msg_format, + "repto": func (m ii.Msg) string { + r, _ := m.Tag("repto") + return r + }, } www.db = db www.tpl = template.Must(template.New("main").Funcs(funcMap).ParseGlob("tpl/*.tpl"))