~bigbes/sr-ht-dolt

bb8ce43b699435a1b43302e70fe9c1e29a9d0f23 — Eugene Blikh 11 days ago b5b0823
web: restyle dashboard and database lists after git.sr.ht

Replace the bare 'Your databases' heading and compact grid with the
git.sr.ht dashboard layout: a sidebar column with a welcome blurb plus
block buttons (create database, configure dolt credentials), and the
shared event-list cards for the database list. The repoList partial now
renders each database as an event card — name, visibility as small
muted text (non-public only, like git.sr.ht), description below — and
the profile page picks the same partial up automatically.

Adds a 'lower' template func for the visibility label and drops the now
unused .repo-list grid from main.scss (.event-list ships with the core
theme already).
4 files changed, 31 insertions(+), 19 deletions(-)

M scss/main.scss
M web/templates.go
M web/templates/index.html
M web/templates/partials.html
M scss/main.scss => scss/main.scss +0 -8
@@ 16,11 16,3 @@
    font-family: $font-family-monospace;
  }
}

// Compact grid for the database list on user and dashboard pages.
.repo-list {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-gap: 0.25rem 1rem;
  align-items: baseline;
}

M web/templates.go => web/templates.go +1 -0
@@ 128,6 128,7 @@ func templateFuncs(icons map[string]template.HTML) template.FuncMap {
		// humansize renders a byte count as a human-readable size.
		"humansize": humanizeSize,
		"upper":     strings.ToUpper,
		"lower":     strings.ToLower,
		// inc/dec support 1-based page arithmetic in pagination links.
		"inc": func(n int) int { return n + 1 },
		"dec": func(n int) int { return n - 1 },

M web/templates/index.html => web/templates/index.html +18 -5
@@ 1,14 1,27 @@
{{define "content" -}}
{{if .CurrentUser}}
<div class="row">
  <div class="col-md-8">
    <h2>Your databases</h2>
  <div class="col-md-4">
    <p>
      Welcome back, {{.CurrentUser.Username}}! This is your Dolt database
      hosting service: <code>dolt clone</code>, <code>push</code> and
      <code>pull</code> over HTTPS, with a web UI for browsing branches,
      commits and tables.
    </p>
    <a href="/create" class="btn btn-primary btn-block"
      >Create new database {{icon "caret-right"}}</a>
    <a href="/settings/keys" class="btn btn-default btn-block"
      >Configure dolt credentials {{icon "caret-right"}}</a>
  </div>
  <div class="col-md-4 text-right">
    <a href="/create" class="btn btn-primary">{{icon "plus-square"}} Create database</a>
  <div class="col-md-8">
    <hr class="d-md-none" />
    {{template "repoList" .Repos}}
    {{if .Repos}}
    <a href="/~{{.CurrentUser.Username}}" class="btn btn-default pull-right"
      >More on your profile {{icon "caret-right"}}</a>
    {{end}}
  </div>
</div>
{{template "repoList" .Repos}}
{{else}}
<div class="header-extension"></div>
<h2>{{.SiteName}} <span class="text-danger">{{.SiteLabel}}</span></h2>

M web/templates/partials.html => web/templates/partials.html +12 -6
@@ 38,13 38,19 @@

{{define "repoList" -}}
{{if .}}
<div class="repo-list">
<div class="event-list">
  {{range .}}
  <span>
    <a href="/~{{.OwnerName}}/{{.Name}}">~{{.OwnerName}}/{{.Name}}</a>
    {{template "visibilityBadge" .Visibility}}
  </span>
  <span class="text-muted">{{.Description}}</span>
  <div class="event">
    <h4>
      <a href="/~{{.OwnerName}}/{{.Name}}">~{{.OwnerName}}/{{.Name}}</a>
      {{if ne (printf "%s" .Visibility) "PUBLIC"}}
      <small class="pull-right">{{lower (printf "%s" .Visibility)}}</small>
      {{end}}
    </h4>
    {{if .Description}}
    <p>{{.Description}}</p>
    {{end}}
  </div>
  {{end}}
</div>
{{else}}