diff options
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | pkg/handler/git/handler.go | 40 | ||||
| -rw-r--r-- | pkg/handler/router.go | 2 | ||||
| -rw-r--r-- | pkg/service/git.go | 36 | ||||
| -rw-r--r-- | scss/main.scss | 50 | ||||
| -rw-r--r-- | scss/tree.scss | 59 | ||||
| -rw-r--r-- | templates/base.qtpl | 2 | ||||
| -rw-r--r-- | templates/base.qtpl.go | 2 | ||||
| -rw-r--r-- | templates/gititemlog.qtpl | 4 | ||||
| -rw-r--r-- | templates/gititemlog.qtpl.go | 8 | ||||
| -rw-r--r-- | templates/gititemtree.qtpl | 24 | ||||
| -rw-r--r-- | templates/gititemtree.qtpl.go | 114 | ||||
| -rw-r--r-- | templates/gitlist.qtpl | 11 | ||||
| -rw-r--r-- | templates/gitlist.qtpl.go | 159 | ||||
| -rw-r--r-- | templates/navbar.qtpl | 3 | ||||
| -rw-r--r-- | templates/navbar.qtpl.go | 130 | 
16 files changed, 406 insertions, 240 deletions
| @@ -12,9 +12,11 @@ run: sass tmpl  test:  	go test -v --tags=unit ./... +# this is meant for "prod" build  sass-slug:  	mkdir -p static  	sassc \ +		--style compressed \  		-I scss scss/main.scss static/main.$(COMMIT).css  sass: diff --git a/pkg/handler/git/handler.go b/pkg/handler/git/handler.go index 28cc99e..7bdf372 100644 --- a/pkg/handler/git/handler.go +++ b/pkg/handler/git/handler.go @@ -2,8 +2,10 @@ package git  import (  	"bytes" +	"io"  	"log/slog"  	"net/http" +	"os"  	"path/filepath"  	"git.gabrielgio.me/cerrado/pkg/ext" @@ -15,11 +17,15 @@ import (  	"github.com/alecthomas/chroma/v2/styles"  	"github.com/go-git/go-git/v5/plumbing"  	"github.com/go-git/go-git/v5/plumbing/object" +	"github.com/gomarkdown/markdown" +	markdownhtml "github.com/gomarkdown/markdown/html" +	"github.com/gomarkdown/markdown/parser"  )  type (  	GitHandler struct {  		gitService gitService +		readmePath string  	}  	gitService interface { @@ -31,11 +37,16 @@ type (  		ListTags(name string) ([]*object.Tag, error)  		ListBranches(name string) ([]*plumbing.Reference, error)  	} + +	configurationRepository interface { +		GetRootReadme() string +	}  ) -func NewGitHandler(gitService gitService) *GitHandler { +func NewGitHandler(gitService gitService, confRepo configurationRepository) *GitHandler {  	return &GitHandler{  		gitService: gitService, +		readmePath: confRepo.GetRootReadme(),  	}  } @@ -46,7 +57,32 @@ func (g *GitHandler) List(w http.ResponseWriter, _ *http.Request) {  		return  	} -	gitList := &templates.GitListPage{repos} +	f, err := os.Open(g.readmePath) +	if err != nil { +		slog.Error("Error loading readme file", "error", err) +		return +	} + +	bs, err := io.ReadAll(f) +	if err != nil { +		slog.Error("Error reading readme file bytes", "error", err) +		return +	} + +	extensions := parser.CommonExtensions | parser.AutoHeadingIDs | parser.NoEmptyLineBeforeBlock +	p := parser.NewWithExtensions(extensions) +	doc := p.Parse(bs) + +	htmlFlag := markdownhtml.CommonFlags | markdownhtml.HrefTargetBlank +	opts := markdownhtml.RendererOptions{Flags: htmlFlag} +	renderer := markdownhtml.NewRenderer(opts) + +	bs = markdown.Render(doc, renderer) + +	gitList := &templates.GitListPage{ +		Respositories: repos, +		About:         bs, +	}  	templates.WritePageTemplate(w, gitList)  } diff --git a/pkg/handler/router.go b/pkg/handler/router.go index de5117c..bf13ad5 100644 --- a/pkg/handler/router.go +++ b/pkg/handler/router.go @@ -20,7 +20,7 @@ func MountHandler(  	configRepo *serverconfig.ConfigurationRepository,  ) (http.Handler, error) {  	var ( -		gitHandler   = git.NewGitHandler(gitService) +		gitHandler   = git.NewGitHandler(gitService, configRepo)  		aboutHandler = about.NewAboutHandler(configRepo)  		configHander = config.ConfigFile(configRepo)  	) diff --git a/pkg/service/git.go b/pkg/service/git.go index f886785..31a1cbb 100644 --- a/pkg/service/git.go +++ b/pkg/service/git.go @@ -1,21 +1,24 @@  package service  import ( +	"log/slog" +	"os"  	"path"  	"git.gabrielgio.me/cerrado/pkg/config"  	"git.gabrielgio.me/cerrado/pkg/git" +	"git.gabrielgio.me/cerrado/pkg/u"  	"github.com/go-git/go-git/v5/plumbing"  	"github.com/go-git/go-git/v5/plumbing/object"  )  type (  	Repository struct { -		Name              string -		Title             string -		LastCommitMessage string -		LastCommitDate    string -		Ref               string +		Name           string +		Title          string +		Description    string +		LastCommitDate string +		Ref            string  	}  	GitService struct { @@ -46,9 +49,6 @@ func (g *GitService) ListRepositories() ([]*Repository, error) {  		if err != nil {  			return nil, err  		} -		if err != nil { -			return nil, err -		}  		obj, err := repo.LastCommit()  		if err != nil { @@ -60,13 +60,23 @@ func (g *GitService) ListRepositories() ([]*Repository, error) {  			return nil, err  		} +		d := path.Join(r.Path, "description") +		description := "" +		if u.FileExist(d) { +			if b, err := os.ReadFile(d); err == nil { +				description = string(b) +			} else { +				slog.Error("Error loading description file", "err", err) +			} +		} +  		baseName := path.Base(r.Path)  		repos[i] = &Repository{ -			Name:              baseName, -			Title:             baseName, -			LastCommitMessage: obj.Message, -			LastCommitDate:    obj.Author.When.Format(timeFormat), -			Ref:               head.Name().Short(), +			Name:           baseName, +			Title:          baseName, +			Description:    description, +			LastCommitDate: obj.Author.When.Format(timeFormat), +			Ref:            head.Name().Short(),  		}  	} diff --git a/scss/main.scss b/scss/main.scss index bb7d7f0..b3ba649 100644 --- a/scss/main.scss +++ b/scss/main.scss @@ -19,8 +19,31 @@ $headings-margin-bottom: 0;  @import "bootstrap/scss/_nav.scss";  @import "bootstrap/scss/_navbar.scss";  @import "bootstrap/scss/_grid.scss"; +@import "tree.scss"; + +// overwrite to reduce the ammount of css generated by loading all utilities +$utilities: ( +    "order": ( +      responsive: true, +      property: order, +      values: ( +        first: -1, +        0: 0, +        1: 1, +        2: 2, +        3: 3, +        4: 4, +        5: 5, +        last: 6, +      ), +    ), +); + +@import "bootstrap/scss/utilities/_api.scss";  body { +    // prevents wierd font resizing on overflow +    -webkit-text-size-adjust: 100%;      font-family: $font-family-monospace;      font-size: $base-font-size;      margin: 0; @@ -63,23 +86,27 @@ body {  }  .logs { -  >div:nth-child(odd) { +  >div {      background: #f8f9fa;    }    >div { -    padding: 10px; +    padding: 5px; +    margin: $spacer; +  } + +  @include media-breakpoint-down(md) { +    >div { +      margin: $spacer 0 $spacer 0; +    }    }    pre { -    white-space: break-spaces; +    font-size: $base-font-size;      margin: 0;    }  } -.logs pre::first-line { -  font-weight: bold; -}  .logs>div>div:first-child {    margin-bottom: 15px;  } @@ -87,3 +114,14 @@ body {    margin-top: 15px;  } +#about { +  padding: 0 $spacer $spacer $spacer; +  > p:first-child { +    margin-top: 0 +  } + +  @include media-breakpoint-down(md) {  +    padding: $spacer; +    max-width: calc(100% - calc(2 * #{$spacer})); +  } +} diff --git a/scss/tree.scss b/scss/tree.scss new file mode 100644 index 0000000..bbca162 --- /dev/null +++ b/scss/tree.scss @@ -0,0 +1,59 @@ +// TODO: refer to sourcehut code AGPL +.tree-list { +  display: grid; +  // mode name +  grid-template-columns: auto 1fr fit-content(40em) auto auto; +  font-family: $font-family-monospace; + +  svg { +    color: #777; +  } + +  .size { +    text-align: right; +  } + +  .name.blob a { +    color: $gray-900; +  } + +  .mode, .commit, .commit a, .date, .size { +    color: $gray-700; +  } + +  .name.blob { +    text-overflow: ellipsis; +    white-space: nowrap; +    overflow: hidden; +  } + +  .commit { +    text-overflow: ellipsis; +    white-space: nowrap; +    overflow: hidden; +  } + +  & > div { +    padding: 0.1rem 0.5rem; +    background: transparent; + +    &.id { +      text-align: right; +    } + +    &.comments { +      text-align: center; +    } + +    @for $i from 1 through 5 { +      &:nth-child(5n+#{$i}) { +        grid-column-start: $i; +      } + +      // Striped rows +      &:nth-child(10n+#{$i}) { +        background: rgba(0,0,0,.05); +      } +    } +  } +} diff --git a/templates/base.qtpl b/templates/base.qtpl index 497aa6d..9b0c4f5 100644 --- a/templates/base.qtpl +++ b/templates/base.qtpl @@ -26,7 +26,7 @@ Page {  %}  {% code func TimeFormat(t time.Time) string { -        return t.Format("2006-01-02") +        return t.Format("02.01.2006")      }  %} diff --git a/templates/base.qtpl.go b/templates/base.qtpl.go index 5f39e8d..d2bcc73 100644 --- a/templates/base.qtpl.go +++ b/templates/base.qtpl.go @@ -68,7 +68,7 @@ func FromUInttoString(u *uint) string {  //line base.qtpl:28  func TimeFormat(t time.Time) string { -	return t.Format("2006-01-02") +	return t.Format("02.01.2006")  }  //line base.qtpl:33 diff --git a/templates/gititemlog.qtpl b/templates/gititemlog.qtpl index e037c52..ef473b7 100644 --- a/templates/gititemlog.qtpl +++ b/templates/gititemlog.qtpl @@ -15,11 +15,11 @@ type GitItemLogPage struct {        <div class="col-xxl-2">         {%s TimeFormat(c.Committer.When) %}        </div> -      <div class="col-xxl-7"> +      <div class="col-xxl-7 code-view">         <pre>{%s c.Message %}</pre>        </div>        <div class="col-xxl-3"> -       <small>{%s c.Committer.Name %}</small> +       <small>{%s c.Committer.Name %} <{%s c.Committer.Email %}></small>        </div>    </div>    {% endfor %} diff --git a/templates/gititemlog.qtpl.go b/templates/gititemlog.qtpl.go index 47e700d..e3bac41 100644 --- a/templates/gititemlog.qtpl.go +++ b/templates/gititemlog.qtpl.go @@ -76,7 +76,7 @@ func (g *GitItemLogPage) StreamGitContent(qw422016 *qt422016.Writer) {  //line gititemlog.qtpl:16  		qw422016.N().S(`        </div> -      <div class="col-xxl-7"> +      <div class="col-xxl-7 code-view">         <pre>`)  //line gititemlog.qtpl:19  		qw422016.E().S(c.Message) @@ -88,7 +88,11 @@ func (g *GitItemLogPage) StreamGitContent(qw422016 *qt422016.Writer) {  //line gititemlog.qtpl:22  		qw422016.E().S(c.Committer.Name)  //line gititemlog.qtpl:22 -		qw422016.N().S(`</small> +		qw422016.N().S(` <`) +//line gititemlog.qtpl:22 +		qw422016.E().S(c.Committer.Email) +//line gititemlog.qtpl:22 +		qw422016.N().S(`></small>        </div>    </div>    `) diff --git a/templates/gititemtree.qtpl b/templates/gititemtree.qtpl index be7a27d..68b9856 100644 --- a/templates/gititemtree.qtpl +++ b/templates/gititemtree.qtpl @@ -14,15 +14,21 @@ type GitItemTreePage struct {  {% func (g *GitItemTreePage) Nav(name, ref string) %}{%= GitItemNav(name, ref, Tree) %}{% endfunc %}  {% func (g *GitItemTreePage) GitContent() %} -{% for _, e := range g.Tree.Entries %}  <div class="row"> -  <div class="col">{%s Ignore(e.Mode.ToOSFileMode()).String() %}</div> -  {% if e.Mode.IsFile() %} -  <div class="col-md"><a href="/{%s g.Name %}/blob/{%s g.Ref%}/{%s g.CurrentPath %}/{%s e.Name %}">{%s e.Name %}</a></div> -  {% else %} -  <div class="col-md"><a href="./{%s g.CurrentPath %}/{%s e.Name %}">{%s e.Name %}</a></div> -  {% endif %} -  <div class="col-md">{%dl Ignore(g.Tree.Size(e.Name))%} KiB</div> +  <div class="col-md-12"> +    <div class="tree-list"> +      {% for _, e := range g.Tree.Entries %} +          <div class="mode">{%s Ignore(e.Mode.ToOSFileMode()).String() %}</div> +          {% if e.Mode.IsFile() %} +          <div class="name blob"><a href="/{%s g.Name %}/blob/{%s g.Ref%}/{%s g.CurrentPath %}/{%s e.Name %}">{%s e.Name %}</a></div> +          {% else %} +          <div class="name tree"><a href="./{%s g.CurrentPath %}/{%s e.Name %}">{%s e.Name %}</a></div> +          {% endif %} +          <div class="commit"></div> +          <div class="date"></div> +          <div class="size">{%dl Ignore(g.Tree.Size(e.Name))%} KiB</div> +      {% endfor %} +    </div> +  </div>  </div> -{% endfor %}  {% endfunc %} diff --git a/templates/gititemtree.qtpl.go b/templates/gititemtree.qtpl.go index cdc374f..546cb13 100644 --- a/templates/gititemtree.qtpl.go +++ b/templates/gititemtree.qtpl.go @@ -67,103 +67,109 @@ func (g *GitItemTreePage) Nav(name, ref string) string {  func (g *GitItemTreePage) StreamGitContent(qw422016 *qt422016.Writer) {  //line gititemtree.qtpl:16  	qw422016.N().S(` -`) -//line gititemtree.qtpl:17 +<div class="row"> +  <div class="col-md-12"> +    <div class="tree-list"> +      `) +//line gititemtree.qtpl:20  	for _, e := range g.Tree.Entries { -//line gititemtree.qtpl:17 +//line gititemtree.qtpl:20  		qw422016.N().S(` -<div class="row"> -  <div class="col">`) -//line gititemtree.qtpl:19 +          <div class="mode">`) +//line gititemtree.qtpl:21  		qw422016.E().S(Ignore(e.Mode.ToOSFileMode()).String()) -//line gititemtree.qtpl:19 +//line gititemtree.qtpl:21  		qw422016.N().S(`</div> -  `) -//line gititemtree.qtpl:20 +          `) +//line gititemtree.qtpl:22  		if e.Mode.IsFile() { -//line gititemtree.qtpl:20 +//line gititemtree.qtpl:22  			qw422016.N().S(` -  <div class="col-md"><a href="/`) -//line gititemtree.qtpl:21 +          <div class="name blob"><a href="/`) +//line gititemtree.qtpl:23  			qw422016.E().S(g.Name) -//line gititemtree.qtpl:21 +//line gititemtree.qtpl:23  			qw422016.N().S(`/blob/`) -//line gititemtree.qtpl:21 +//line gititemtree.qtpl:23  			qw422016.E().S(g.Ref) -//line gititemtree.qtpl:21 +//line gititemtree.qtpl:23  			qw422016.N().S(`/`) -//line gititemtree.qtpl:21 +//line gititemtree.qtpl:23  			qw422016.E().S(g.CurrentPath) -//line gititemtree.qtpl:21 +//line gititemtree.qtpl:23  			qw422016.N().S(`/`) -//line gititemtree.qtpl:21 +//line gititemtree.qtpl:23  			qw422016.E().S(e.Name) -//line gititemtree.qtpl:21 +//line gititemtree.qtpl:23  			qw422016.N().S(`">`) -//line gititemtree.qtpl:21 +//line gititemtree.qtpl:23  			qw422016.E().S(e.Name) -//line gititemtree.qtpl:21 +//line gititemtree.qtpl:23  			qw422016.N().S(`</a></div> -  `) -//line gititemtree.qtpl:22 +          `) +//line gititemtree.qtpl:24  		} else { -//line gititemtree.qtpl:22 +//line gititemtree.qtpl:24  			qw422016.N().S(` -  <div class="col-md"><a href="./`) -//line gititemtree.qtpl:23 +          <div class="name tree"><a href="./`) +//line gititemtree.qtpl:25  			qw422016.E().S(g.CurrentPath) -//line gititemtree.qtpl:23 +//line gititemtree.qtpl:25  			qw422016.N().S(`/`) -//line gititemtree.qtpl:23 +//line gititemtree.qtpl:25  			qw422016.E().S(e.Name) -//line gititemtree.qtpl:23 +//line gititemtree.qtpl:25  			qw422016.N().S(`">`) -//line gititemtree.qtpl:23 +//line gititemtree.qtpl:25  			qw422016.E().S(e.Name) -//line gititemtree.qtpl:23 +//line gititemtree.qtpl:25  			qw422016.N().S(`</a></div> -  `) -//line gititemtree.qtpl:24 +          `) +//line gititemtree.qtpl:26  		} -//line gititemtree.qtpl:24 +//line gititemtree.qtpl:26  		qw422016.N().S(` -  <div class="col-md">`) -//line gititemtree.qtpl:25 +          <div class="commit"></div> +          <div class="date"></div> +          <div class="size">`) +//line gititemtree.qtpl:29  		qw422016.N().DL(Ignore(g.Tree.Size(e.Name))) -//line gititemtree.qtpl:25 +//line gititemtree.qtpl:29  		qw422016.N().S(` KiB</div> -</div> -`) -//line gititemtree.qtpl:27 +      `) +//line gititemtree.qtpl:30  	} -//line gititemtree.qtpl:27 +//line gititemtree.qtpl:30  	qw422016.N().S(` +    </div> +  </div> +</div>  `) -//line gititemtree.qtpl:28 +//line gititemtree.qtpl:34  } -//line gititemtree.qtpl:28 +//line gititemtree.qtpl:34  func (g *GitItemTreePage) WriteGitContent(qq422016 qtio422016.Writer) { -//line gititemtree.qtpl:28 +//line gititemtree.qtpl:34  	qw422016 := qt422016.AcquireWriter(qq422016) -//line gititemtree.qtpl:28 +//line gititemtree.qtpl:34  	g.StreamGitContent(qw422016) -//line gititemtree.qtpl:28 +//line gititemtree.qtpl:34  	qt422016.ReleaseWriter(qw422016) -//line gititemtree.qtpl:28 +//line gititemtree.qtpl:34  } -//line gititemtree.qtpl:28 +//line gititemtree.qtpl:34  func (g *GitItemTreePage) GitContent() string { -//line gititemtree.qtpl:28 +//line gititemtree.qtpl:34  	qb422016 := qt422016.AcquireByteBuffer() -//line gititemtree.qtpl:28 +//line gititemtree.qtpl:34  	g.WriteGitContent(qb422016) -//line gititemtree.qtpl:28 +//line gititemtree.qtpl:34  	qs422016 := string(qb422016.B) -//line gititemtree.qtpl:28 +//line gititemtree.qtpl:34  	qt422016.ReleaseByteBuffer(qb422016) -//line gititemtree.qtpl:28 +//line gititemtree.qtpl:34  	return qs422016 -//line gititemtree.qtpl:28 +//line gititemtree.qtpl:34  } diff --git a/templates/gitlist.qtpl b/templates/gitlist.qtpl index 3d7ef82..937ba22 100644 --- a/templates/gitlist.qtpl +++ b/templates/gitlist.qtpl @@ -3,6 +3,7 @@  {% code  type GitListPage struct {      Respositories []*service.Repository +    About []byte  }  %} @@ -12,7 +13,7 @@ type GitListPage struct {  {% func (p *GitListPage) Content() %}  <div class="row"> -  <div class="col-md-8 offset-md-2"> +  <div class="col-md-6 order-last order-md-first">      <div class="event-list">        {% for _, r := range p.Respositories %}        <div class="event"> @@ -20,8 +21,7 @@ type GitListPage struct {            <a href="/{%s r.Name %}">{%s r.Name %}</a>          </h4>          </hr> -        <p>{%s r.LastCommitMessage %}</p> -        <p><small>{%s r.LastCommitDate %}</small></p> +        <p>{%s r.Description %}</p>          <p>            <a href="/{%s r.Name %}/log/{%s r.Ref %}">log</a>            <a href="/{%s r.Name %}/tree/{%s r.Ref %}">tree</a> @@ -30,9 +30,12 @@ type GitListPage struct {        </div>        {% endfor %}      </div> -  {% endfunc %} +  </div> +  <div id="about" class="col-md-4 order-first order-md-last"> +    {%z= p.About %}    </div>  </div> +{% endfunc %}  {% func (p *GitListPage) Script() %}  {% endfunc %} diff --git a/templates/gitlist.qtpl.go b/templates/gitlist.qtpl.go index d9f7ec1..435626e 100644 --- a/templates/gitlist.qtpl.go +++ b/templates/gitlist.qtpl.go @@ -23,109 +23,105 @@ var (  //line gitlist.qtpl:4  type GitListPage struct {  	Respositories []*service.Repository +	About         []byte  } -//line gitlist.qtpl:9 +//line gitlist.qtpl:10  func (p *GitListPage) StreamTitle(qw422016 *qt422016.Writer) { -//line gitlist.qtpl:9 +//line gitlist.qtpl:10  	qw422016.N().S(`Git | List`) -//line gitlist.qtpl:9 +//line gitlist.qtpl:10  } -//line gitlist.qtpl:9 +//line gitlist.qtpl:10  func (p *GitListPage) WriteTitle(qq422016 qtio422016.Writer) { -//line gitlist.qtpl:9 +//line gitlist.qtpl:10  	qw422016 := qt422016.AcquireWriter(qq422016) -//line gitlist.qtpl:9 +//line gitlist.qtpl:10  	p.StreamTitle(qw422016) -//line gitlist.qtpl:9 +//line gitlist.qtpl:10  	qt422016.ReleaseWriter(qw422016) -//line gitlist.qtpl:9 +//line gitlist.qtpl:10  } -//line gitlist.qtpl:9 +//line gitlist.qtpl:10  func (p *GitListPage) Title() string { -//line gitlist.qtpl:9 +//line gitlist.qtpl:10  	qb422016 := qt422016.AcquireByteBuffer() -//line gitlist.qtpl:9 +//line gitlist.qtpl:10  	p.WriteTitle(qb422016) -//line gitlist.qtpl:9 +//line gitlist.qtpl:10  	qs422016 := string(qb422016.B) -//line gitlist.qtpl:9 +//line gitlist.qtpl:10  	qt422016.ReleaseByteBuffer(qb422016) -//line gitlist.qtpl:9 +//line gitlist.qtpl:10  	return qs422016 -//line gitlist.qtpl:9 +//line gitlist.qtpl:10  } -//line gitlist.qtpl:11 +//line gitlist.qtpl:12  func (p *GitListPage) StreamNavbar(qw422016 *qt422016.Writer) { -//line gitlist.qtpl:11 +//line gitlist.qtpl:12  	StreamNavbar(qw422016, Git) -//line gitlist.qtpl:11 +//line gitlist.qtpl:12  } -//line gitlist.qtpl:11 +//line gitlist.qtpl:12  func (p *GitListPage) WriteNavbar(qq422016 qtio422016.Writer) { -//line gitlist.qtpl:11 +//line gitlist.qtpl:12  	qw422016 := qt422016.AcquireWriter(qq422016) -//line gitlist.qtpl:11 +//line gitlist.qtpl:12  	p.StreamNavbar(qw422016) -//line gitlist.qtpl:11 +//line gitlist.qtpl:12  	qt422016.ReleaseWriter(qw422016) -//line gitlist.qtpl:11 +//line gitlist.qtpl:12  } -//line gitlist.qtpl:11 +//line gitlist.qtpl:12  func (p *GitListPage) Navbar() string { -//line gitlist.qtpl:11 +//line gitlist.qtpl:12  	qb422016 := qt422016.AcquireByteBuffer() -//line gitlist.qtpl:11 +//line gitlist.qtpl:12  	p.WriteNavbar(qb422016) -//line gitlist.qtpl:11 +//line gitlist.qtpl:12  	qs422016 := string(qb422016.B) -//line gitlist.qtpl:11 +//line gitlist.qtpl:12  	qt422016.ReleaseByteBuffer(qb422016) -//line gitlist.qtpl:11 +//line gitlist.qtpl:12  	return qs422016 -//line gitlist.qtpl:11 +//line gitlist.qtpl:12  } -//line gitlist.qtpl:13 +//line gitlist.qtpl:14  func (p *GitListPage) StreamContent(qw422016 *qt422016.Writer) { -//line gitlist.qtpl:13 +//line gitlist.qtpl:14  	qw422016.N().S(`  <div class="row"> -  <div class="col-md-8 offset-md-2"> +  <div class="col-md-6 order-last order-md-first">      <div class="event-list">        `) -//line gitlist.qtpl:17 +//line gitlist.qtpl:18  	for _, r := range p.Respositories { -//line gitlist.qtpl:17 +//line gitlist.qtpl:18  		qw422016.N().S(`        <div class="event">          <h4>            <a href="/`) -//line gitlist.qtpl:20 +//line gitlist.qtpl:21  		qw422016.E().S(r.Name) -//line gitlist.qtpl:20 +//line gitlist.qtpl:21  		qw422016.N().S(`">`) -//line gitlist.qtpl:20 +//line gitlist.qtpl:21  		qw422016.E().S(r.Name) -//line gitlist.qtpl:20 +//line gitlist.qtpl:21  		qw422016.N().S(`</a>          </h4>          </hr>          <p>`) -//line gitlist.qtpl:23 -		qw422016.E().S(r.LastCommitMessage) -//line gitlist.qtpl:23 -		qw422016.N().S(`</p> -        <p><small>`)  //line gitlist.qtpl:24 -		qw422016.E().S(r.LastCommitDate) +		qw422016.E().S(r.Description)  //line gitlist.qtpl:24 -		qw422016.N().S(`</small></p> +		qw422016.N().S(`</p>          <p>            <a href="/`)  //line gitlist.qtpl:26 @@ -158,70 +154,75 @@ func (p *GitListPage) StreamContent(qw422016 *qt422016.Writer) {  //line gitlist.qtpl:31  	qw422016.N().S(`      </div> -  `) -//line gitlist.qtpl:33 +  </div> +  <div id="about" class="col-md-4 order-first order-md-last"> +    `) +//line gitlist.qtpl:35 +	qw422016.N().Z(p.About) +//line gitlist.qtpl:35 +	qw422016.N().S(` +  </div> +</div> +`) +//line gitlist.qtpl:38  } -//line gitlist.qtpl:33 +//line gitlist.qtpl:38  func (p *GitListPage) WriteContent(qq422016 qtio422016.Writer) { -//line gitlist.qtpl:33 +//line gitlist.qtpl:38  	qw422016 := qt422016.AcquireWriter(qq422016) -//line gitlist.qtpl:33 +//line gitlist.qtpl:38  	p.StreamContent(qw422016) -//line gitlist.qtpl:33 +//line gitlist.qtpl:38  	qt422016.ReleaseWriter(qw422016) -//line gitlist.qtpl:33 +//line gitlist.qtpl:38  } -//line gitlist.qtpl:33 +//line gitlist.qtpl:38  func (p *GitListPage) Content() string { -//line gitlist.qtpl:33 +//line gitlist.qtpl:38  	qb422016 := qt422016.AcquireByteBuffer() -//line gitlist.qtpl:33 +//line gitlist.qtpl:38  	p.WriteContent(qb422016) -//line gitlist.qtpl:33 +//line gitlist.qtpl:38  	qs422016 := string(qb422016.B) -//line gitlist.qtpl:33 +//line gitlist.qtpl:38  	qt422016.ReleaseByteBuffer(qb422016) -//line gitlist.qtpl:33 +//line gitlist.qtpl:38  	return qs422016 -//line gitlist.qtpl:33 +//line gitlist.qtpl:38  } -//   </div> -// </div> -// - -//line gitlist.qtpl:37 +//line gitlist.qtpl:40  func (p *GitListPage) StreamScript(qw422016 *qt422016.Writer) { -//line gitlist.qtpl:37 +//line gitlist.qtpl:40  	qw422016.N().S(`  `) -//line gitlist.qtpl:38 +//line gitlist.qtpl:41  } -//line gitlist.qtpl:38 +//line gitlist.qtpl:41  func (p *GitListPage) WriteScript(qq422016 qtio422016.Writer) { -//line gitlist.qtpl:38 +//line gitlist.qtpl:41  	qw422016 := qt422016.AcquireWriter(qq422016) -//line gitlist.qtpl:38 +//line gitlist.qtpl:41  	p.StreamScript(qw422016) -//line gitlist.qtpl:38 +//line gitlist.qtpl:41  	qt422016.ReleaseWriter(qw422016) -//line gitlist.qtpl:38 +//line gitlist.qtpl:41  } -//line gitlist.qtpl:38 +//line gitlist.qtpl:41  func (p *GitListPage) Script() string { -//line gitlist.qtpl:38 +//line gitlist.qtpl:41  	qb422016 := qt422016.AcquireByteBuffer() -//line gitlist.qtpl:38 +//line gitlist.qtpl:41  	p.WriteScript(qb422016) -//line gitlist.qtpl:38 +//line gitlist.qtpl:41  	qs422016 := string(qb422016.B) -//line gitlist.qtpl:38 +//line gitlist.qtpl:41  	qt422016.ReleaseByteBuffer(qb422016) -//line gitlist.qtpl:38 +//line gitlist.qtpl:41  	return qs422016 -//line gitlist.qtpl:38 +//line gitlist.qtpl:41  } diff --git a/templates/navbar.qtpl b/templates/navbar.qtpl index 9681fa4..4d2a6a9 100644 --- a/templates/navbar.qtpl +++ b/templates/navbar.qtpl @@ -29,7 +29,10 @@ const (  Add this back once needed              <a class="nav-link{%= insertIfEqual(s, List) %}" href="/list">list</a>  {% endcomment %} +{% comment %} +Add this back if needed              <a class="nav-link{%= insertIfEqual(s, About) %}" href="/about">about</a> +{% endcomment %}              <a class="nav-link{%= insertIfEqual(s, Config) %}" href="/config">config</a>            </div>          </nav> diff --git a/templates/navbar.qtpl.go b/templates/navbar.qtpl.go index a2989db..1eacd6a 100644 --- a/templates/navbar.qtpl.go +++ b/templates/navbar.qtpl.go @@ -89,162 +89,160 @@ func StreamNavbar(qw422016 *qt422016.Writer, s Selection) {  `)  //line navbar.qtpl:31  	qw422016.N().S(` +`) +//line navbar.qtpl:35 +	qw422016.N().S(`              <a class="nav-link`) -//line navbar.qtpl:32 -	streaminsertIfEqual(qw422016, s, About) -//line navbar.qtpl:32 -	qw422016.N().S(`" href="/about">about</a> -            <a class="nav-link`) -//line navbar.qtpl:33 +//line navbar.qtpl:36  	streaminsertIfEqual(qw422016, s, Config) -//line navbar.qtpl:33 +//line navbar.qtpl:36  	qw422016.N().S(`" href="/config">config</a>            </div>          </nav>  `) -//line navbar.qtpl:36 +//line navbar.qtpl:39  } -//line navbar.qtpl:36 +//line navbar.qtpl:39  func WriteNavbar(qq422016 qtio422016.Writer, s Selection) { -//line navbar.qtpl:36 +//line navbar.qtpl:39  	qw422016 := qt422016.AcquireWriter(qq422016) -//line navbar.qtpl:36 +//line navbar.qtpl:39  	StreamNavbar(qw422016, s) -//line navbar.qtpl:36 +//line navbar.qtpl:39  	qt422016.ReleaseWriter(qw422016) -//line navbar.qtpl:36 +//line navbar.qtpl:39  } -//line navbar.qtpl:36 +//line navbar.qtpl:39  func Navbar(s Selection) string { -//line navbar.qtpl:36 +//line navbar.qtpl:39  	qb422016 := qt422016.AcquireByteBuffer() -//line navbar.qtpl:36 +//line navbar.qtpl:39  	WriteNavbar(qb422016, s) -//line navbar.qtpl:36 +//line navbar.qtpl:39  	qs422016 := string(qb422016.B) -//line navbar.qtpl:36 +//line navbar.qtpl:39  	qt422016.ReleaseByteBuffer(qb422016) -//line navbar.qtpl:36 +//line navbar.qtpl:39  	return qs422016 -//line navbar.qtpl:36 +//line navbar.qtpl:39  } -//line navbar.qtpl:38 +//line navbar.qtpl:41  func StreamGitItemNav(qw422016 *qt422016.Writer, name, ref string, s GitSelection) { -//line navbar.qtpl:38 +//line navbar.qtpl:41  	qw422016.N().S(`  <div class="row">      <h3>`) -//line navbar.qtpl:40 +//line navbar.qtpl:43  	qw422016.E().S(name) -//line navbar.qtpl:40 +//line navbar.qtpl:43  	qw422016.N().S(` `) -//line navbar.qtpl:40 +//line navbar.qtpl:43  	if ref != "" && (s == Log || s == Tree) { -//line navbar.qtpl:40 +//line navbar.qtpl:43  		qw422016.N().S(`@ `) -//line navbar.qtpl:40 +//line navbar.qtpl:43  		qw422016.E().S(ref) -//line navbar.qtpl:40 +//line navbar.qtpl:43  	} -//line navbar.qtpl:40 +//line navbar.qtpl:43  	qw422016.N().S(`</h3>  </div>  <div class="row">    <ul class="nav">      <li class="nav-item">        <a class="nav-link`) -//line navbar.qtpl:45 -	streaminsertIfEqual(qw422016, s, Readme) -//line navbar.qtpl:45 -	qw422016.N().S(`" aria-current="page" href="/`) -//line navbar.qtpl:45 -	qw422016.E().S(name) -//line navbar.qtpl:45 -	qw422016.N().S(`/about">about</a> -    </li> -    <li class="nav-item"> -      <a class="nav-link`)  //line navbar.qtpl:48 -	streaminsertIfEqual(qw422016, s, Log) +	streaminsertIfEqual(qw422016, s, Readme)  //line navbar.qtpl:48  	qw422016.N().S(`" aria-current="page" href="/`)  //line navbar.qtpl:48  	qw422016.E().S(name)  //line navbar.qtpl:48 -	qw422016.N().S(`/log/`) -//line navbar.qtpl:48 -	qw422016.E().S(ref) -//line navbar.qtpl:48 -	qw422016.N().S(`">log</a> +	qw422016.N().S(`/about">about</a>      </li>      <li class="nav-item">        <a class="nav-link`)  //line navbar.qtpl:51 -	streaminsertIfEqual(qw422016, s, Summary) +	streaminsertIfEqual(qw422016, s, Log)  //line navbar.qtpl:51  	qw422016.N().S(`" aria-current="page" href="/`)  //line navbar.qtpl:51  	qw422016.E().S(name)  //line navbar.qtpl:51 -	qw422016.N().S(`">summary</a> +	qw422016.N().S(`/log/`) +//line navbar.qtpl:51 +	qw422016.E().S(ref) +//line navbar.qtpl:51 +	qw422016.N().S(`">log</a>      </li>      <li class="nav-item">        <a class="nav-link`)  //line navbar.qtpl:54 -	streaminsertIfEqual(qw422016, s, Refs) +	streaminsertIfEqual(qw422016, s, Summary)  //line navbar.qtpl:54  	qw422016.N().S(`" aria-current="page" href="/`)  //line navbar.qtpl:54  	qw422016.E().S(name)  //line navbar.qtpl:54 -	qw422016.N().S(`/refs">refs</a> +	qw422016.N().S(`">summary</a>      </li>      <li class="nav-item">        <a class="nav-link`)  //line navbar.qtpl:57 -	streaminsertIfEqual(qw422016, s, Tree) +	streaminsertIfEqual(qw422016, s, Refs)  //line navbar.qtpl:57  	qw422016.N().S(`" aria-current="page" href="/`)  //line navbar.qtpl:57  	qw422016.E().S(name)  //line navbar.qtpl:57 +	qw422016.N().S(`/refs">refs</a> +    </li> +    <li class="nav-item"> +      <a class="nav-link`) +//line navbar.qtpl:60 +	streaminsertIfEqual(qw422016, s, Tree) +//line navbar.qtpl:60 +	qw422016.N().S(`" aria-current="page" href="/`) +//line navbar.qtpl:60 +	qw422016.E().S(name) +//line navbar.qtpl:60  	qw422016.N().S(`/tree/`) -//line navbar.qtpl:57 +//line navbar.qtpl:60  	qw422016.E().S(ref) -//line navbar.qtpl:57 +//line navbar.qtpl:60  	qw422016.N().S(`">tree</a>      </li>    </ul>  </div>  `) -//line navbar.qtpl:61 +//line navbar.qtpl:64  } -//line navbar.qtpl:61 +//line navbar.qtpl:64  func WriteGitItemNav(qq422016 qtio422016.Writer, name, ref string, s GitSelection) { -//line navbar.qtpl:61 +//line navbar.qtpl:64  	qw422016 := qt422016.AcquireWriter(qq422016) -//line navbar.qtpl:61 +//line navbar.qtpl:64  	StreamGitItemNav(qw422016, name, ref, s) -//line navbar.qtpl:61 +//line navbar.qtpl:64  	qt422016.ReleaseWriter(qw422016) -//line navbar.qtpl:61 +//line navbar.qtpl:64  } -//line navbar.qtpl:61 +//line navbar.qtpl:64  func GitItemNav(name, ref string, s GitSelection) string { -//line navbar.qtpl:61 +//line navbar.qtpl:64  	qb422016 := qt422016.AcquireByteBuffer() -//line navbar.qtpl:61 +//line navbar.qtpl:64  	WriteGitItemNav(qb422016, name, ref, s) -//line navbar.qtpl:61 +//line navbar.qtpl:64  	qs422016 := string(qb422016.B) -//line navbar.qtpl:61 +//line navbar.qtpl:64  	qt422016.ReleaseByteBuffer(qb422016) -//line navbar.qtpl:61 +//line navbar.qtpl:64  	return qs422016 -//line navbar.qtpl:61 +//line navbar.qtpl:64  } | 
