style(web): tidy the profile sidebar
3 files changed, +26 −11
- static/style.css modified +13 −3
- templates/user.html modified +8 −6
- web.go modified +5 −2
static/style.css modified
| @@ -88,10 +88,10 @@ main{padding-bottom:3rem} | ||
| 88 | 88 | nav.tabs.small{background:#e9ecef;align-self:flex-end;margin-bottom:.3rem} |
| 89 | 89 | nav.tabs.small a{padding:.1rem .8rem} |
| 90 | 90 | nav.tabs.small a.active{background:#ddd} |
| 91 | -.profile .avatar{display:block;width:280px;height:280px;margin-bottom:.7rem} | |
| 91 | +.profile .avatar{display:block;width:280px;height:280px;margin-bottom:.9rem;border-radius:6px} | |
| 92 | 92 | .profile p{margin:.2rem 0} |
| 93 | -.profile .name{font-weight:600;font-size:1.05rem} | |
| 94 | -.profile .btn.block{display:block;text-align:center;margin-top:.5rem} | |
| 93 | +.profile .name{font-weight:600;font-size:1.35rem;line-height:1.25;margin:0} | |
| 94 | +.profile .btn.block{display:block;text-align:center;margin-top:.45rem} | |
| 95 | 95 | .info{background:#d1ecf1;color:#0c5460;padding:.5rem .6rem;border:1px solid #bee5eb;margin:0} |
| 96 | 96 | .avatar{object-fit:cover;border:1px solid var(--line);background:var(--soft)} |
| 97 | 97 | .bio{margin:.5rem 0 .6rem} |
| @@ -349,3 +349,13 @@ pre.rangediff,pre.body{white-space:pre-wrap;overflow-wrap:anywhere} | ||
| 349 | 349 | .h0{background:var(--heat0)}.h1{background:var(--heat1)}.h2{background:var(--heat2)}.h3{background:var(--heat3)}.h4{background:var(--heat4)} |
| 350 | 350 | .activity .legend{display:flex;align-items:center;gap:3px;justify-content:flex-end;margin:.3rem 0 0} |
| 351 | 351 | .activity .legend i{display:inline-block;width:10px;height:10px;border-radius:2px} |
| 352 | +.profile .ident{margin-bottom:.7rem} | |
| 353 | +.profile .handle{color:var(--muted);font-size:1.05rem;margin:0} | |
| 354 | +.profile .bio{margin:0 0 .8rem} | |
| 355 | +.profile .bio p{margin:0 0 .4rem} | |
| 356 | +.facts{list-style:none;margin:0 0 1rem;padding:0;font-size:.92rem;color:var(--muted)} | |
| 357 | +.facts li{display:flex;align-items:center;gap:.45rem;margin:.25rem 0;min-width:0} | |
| 358 | +.facts a{color:var(--fg);overflow:hidden;text-overflow:ellipsis;white-space:nowrap} | |
| 359 | +.facts svg{flex:none;width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:1.4;stroke-linecap:round;stroke-linejoin:round} | |
| 360 | +.ownactions{border-top:1px solid var(--line);padding-top:.6rem} | |
| 361 | +.profile .bio.readme,.profile .bio.readme p{font-family:inherit;font-size:.98rem;line-height:1.5} | |
templates/user.html modified
| @@ -8,13 +8,15 @@ | ||
| 8 | 8 | <div class="columns user"> |
| 9 | 9 | <aside class="profile"> |
| 10 | 10 | {{if $p.Avatar}}<img class="avatar" src="/~{{.Data.Owner.Name}}/avatar?v={{$p.Avatar}}" alt="">{{end}} |
| 11 | -{{if $p.Display}}<p class="name">{{$p.Display}}</p>{{end}} | |
| 12 | -{{if $p.Location}}<p>{{$p.Location}}</p>{{end}} | |
| 13 | -{{if $p.Workplace}}<p>{{$p.Workplace}}</p>{{end}} | |
| 14 | -{{if $p.Website}}<p><a href="{{$p.Website}}" rel="nofollow me">{{$p.Website}}</a></p>{{end}} | |
| 15 | -<p class="muted small" title="{{date .Data.Owner.Created}}">Joined {{.Data.Owner.Created.Format "2 January 2006"}}</p> | |
| 11 | +<div class="ident">{{if $p.Display}}<p class="name">{{$p.Display}}</p>{{end}}<p class="handle">~{{.Data.Owner.Name}}</p></div> | |
| 16 | 12 | {{with .Data.Bio}}<div class="bio readme">{{.}}</div>{{end}} |
| 17 | -{{if $own}}<a class="btn primary block" href="/create">Create a new repository ▸</a><a class="btn block" href="/settings">Edit your profile ▸</a>{{end}} | |
| 13 | +<ul class="facts"> | |
| 14 | +{{if $p.Location}}<li><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M8 15s5-4.6 5-8.5A5 5 0 0 0 3 6.5C3 10.4 8 15 8 15z"/><circle cx="8" cy="6.5" r="1.8"/></svg>{{$p.Location}}</li>{{end}} | |
| 15 | +{{if $p.Workplace}}<li><svg viewBox="0 0 16 16" aria-hidden="true"><rect x="2" y="5" width="12" height="9" rx="1.5"/><path d="M6 5V3.5A1 1 0 0 1 7 2.5h2a1 1 0 0 1 1 1V5"/></svg>{{$p.Workplace}}</li>{{end}} | |
| 16 | +{{if $p.Website}}<li><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M6.8 9.2a3 3 0 0 0 4.2 0l2.2-2.2a3 3 0 0 0-4.2-4.2l-.9.9"/><path d="M9.2 6.8a3 3 0 0 0-4.2 0L2.8 9a3 3 0 0 0 4.2 4.2l.9-.9"/></svg><a href="{{$p.Website}}" rel="nofollow me">{{bare $p.Website}}</a></li>{{end}} | |
| 17 | +<li title="{{date .Data.Owner.Created}}"><svg viewBox="0 0 16 16" aria-hidden="true"><rect x="2" y="3" width="12" height="11" rx="1.5"/><path d="M2 6.5h12M5.5 1.5v3M10.5 1.5v3"/></svg>Joined {{.Data.Owner.Created.Format "January 2006"}}</li> | |
| 18 | +</ul> | |
| 19 | +{{if $own}}<div class="ownactions"><a class="btn primary block" href="/create">New repository</a><a class="btn block" href="/settings">Edit profile</a></div>{{end}} | |
| 18 | 20 | </aside> |
| 19 | 21 | <div class="main"> |
| 20 | 22 | {{with .Data.Activity}}<section class="activity"><div class="heathead"><p class="muted small">{{.Total}} commit{{if ne .Total 1}}s{{end}} {{if .Year}}in {{.Year}}{{else}}in the past 12 months{{end}}</p><nav class="years"><a href="?"{{if not .Year}} class="active"{{end}}>past 12 months</a>{{range .Years}}<a href="?year={{.}}"{{if eq . $.Data.Activity.Year}} class="active"{{end}}>{{.}}</a>{{end}}</nav></div>{{.Grid}}<p class="legend muted small">less <i class="h0"></i><i class="h1"></i><i class="h2"></i><i class="h3"></i><i class="h4"></i> more</p></section>{{end}} |
web.go modified
| @@ -84,8 +84,11 @@ func newServer(store *Store, root, host, name string, open bool, sshUser string) | ||
| 84 | 84 | "inc": func(i int) int { return i + 1 }, |
| 85 | 85 | "perm": perm, |
| 86 | 86 | "signer": s.signer, |
| 87 | - "add": func(a, b int) int { return a + b }, | |
| 88 | - "sub": func(a, b int) int { return a - b }, | |
| 87 | + "bare": func(u string) string { | |
| 88 | + return strings.TrimSuffix(strings.TrimPrefix(strings.TrimPrefix(u, "https://"), "http://"), "/") | |
| 89 | + }, | |
| 90 | + "add": func(a, b int) int { return a + b }, | |
| 91 | + "sub": func(a, b int) int { return a - b }, | |
| 89 | 92 | "person": func(email string) string { |
| 90 | 93 | if u, err := s.store.UserByEmail(email); err == nil { |
| 91 | 94 | return u.Name |