From 1059bc71871c14b813b0bb27b4601e2c2ac65acd Mon Sep 17 00:00:00 2001 From: "Gabriel A. Giovanini" Date: Thu, 12 Dec 2024 14:26:02 +0100 Subject: feat: Add private label to the UI Now private repository will have a private label on the list. --- pkg/service/git.go | 2 + templates/gitlist.qtpl | 11 +++-- templates/gitlist.qtpl.go | 115 ++++++++++++++++++++++++++-------------------- 3 files changed, 74 insertions(+), 54 deletions(-) diff --git a/pkg/service/git.go b/pkg/service/git.go index 6c3912f..afe6103 100644 --- a/pkg/service/git.go +++ b/pkg/service/git.go @@ -16,6 +16,7 @@ type ( Repository struct { Name string Description string + Public bool LastCommitDate string Ref string } @@ -66,6 +67,7 @@ func (g *GitService) ListRepositories() ([]*Repository, error) { repos = append(repos, &Repository{ Name: r.Name, Description: r.Description, + Public: r.Public, LastCommitDate: obj.Author.When.Format(timeFormat), Ref: head.Name().Short(), }) diff --git a/templates/gitlist.qtpl b/templates/gitlist.qtpl index fa47008..fc047eb 100644 --- a/templates/gitlist.qtpl +++ b/templates/gitlist.qtpl @@ -18,9 +18,14 @@ type GitListPage struct {
{% for _, r := range p.Respositories %}
-

- {%s r.Name %} -

+
+ +
+ {% if !r.Public %}private{% endif %} +
+

{%s r.Description %}

diff --git a/templates/gitlist.qtpl.go b/templates/gitlist.qtpl.go index 601dbb2..07e5567 100644 --- a/templates/gitlist.qtpl.go +++ b/templates/gitlist.qtpl.go @@ -108,61 +108,74 @@ func (p *GitListPage) StreamContent(qw422016 *qt422016.Writer, ctx context.Conte //line templates/gitlist.qtpl:19 qw422016.N().S(`

+
+ `) +//line templates/gitlist.qtpl:26 + if !r.Public { +//line templates/gitlist.qtpl:26 + qw422016.N().S(`private`) +//line templates/gitlist.qtpl:26 + } +//line templates/gitlist.qtpl:26 + qw422016.N().S(` +
+

`) -//line templates/gitlist.qtpl:25 +//line templates/gitlist.qtpl:30 qw422016.E().S(r.Description) -//line templates/gitlist.qtpl:25 +//line templates/gitlist.qtpl:30 qw422016.N().S(`

log tree refs

`) -//line templates/gitlist.qtpl:32 +//line templates/gitlist.qtpl:37 } -//line templates/gitlist.qtpl:32 +//line templates/gitlist.qtpl:37 qw422016.N().S(`
`) -//line templates/gitlist.qtpl:36 +//line templates/gitlist.qtpl:41 qw422016.N().Z(p.About) -//line templates/gitlist.qtpl:36 +//line templates/gitlist.qtpl:41 qw422016.N().S(`
`) -//line templates/gitlist.qtpl:42 +//line templates/gitlist.qtpl:47 } -//line templates/gitlist.qtpl:42 +//line templates/gitlist.qtpl:47 func (p *GitListPage) WriteContent(qq422016 qtio422016.Writer, ctx context.Context) { -//line templates/gitlist.qtpl:42 +//line templates/gitlist.qtpl:47 qw422016 := qt422016.AcquireWriter(qq422016) -//line templates/gitlist.qtpl:42 +//line templates/gitlist.qtpl:47 p.StreamContent(qw422016, ctx) -//line templates/gitlist.qtpl:42 +//line templates/gitlist.qtpl:47 qt422016.ReleaseWriter(qw422016) -//line templates/gitlist.qtpl:42 +//line templates/gitlist.qtpl:47 } -//line templates/gitlist.qtpl:42 +//line templates/gitlist.qtpl:47 func (p *GitListPage) Content(ctx context.Context) string { -//line templates/gitlist.qtpl:42 +//line templates/gitlist.qtpl:47 qb422016 := qt422016.AcquireByteBuffer() -//line templates/gitlist.qtpl:42 +//line templates/gitlist.qtpl:47 p.WriteContent(qb422016, ctx) -//line templates/gitlist.qtpl:42 +//line templates/gitlist.qtpl:47 qs422016 := string(qb422016.B) -//line templates/gitlist.qtpl:42 +//line templates/gitlist.qtpl:47 qt422016.ReleaseByteBuffer(qb422016) -//line templates/gitlist.qtpl:42 +//line templates/gitlist.qtpl:47 return qs422016 -//line templates/gitlist.qtpl:42 +//line templates/gitlist.qtpl:47 } -//line templates/gitlist.qtpl:44 +//line templates/gitlist.qtpl:49 func (p *GitListPage) StreamScript(qw422016 *qt422016.Writer, ctx context.Context) { -//line templates/gitlist.qtpl:44 +//line templates/gitlist.qtpl:49 qw422016.N().S(` `) -//line templates/gitlist.qtpl:45 +//line templates/gitlist.qtpl:50 } -//line templates/gitlist.qtpl:45 +//line templates/gitlist.qtpl:50 func (p *GitListPage) WriteScript(qq422016 qtio422016.Writer, ctx context.Context) { -//line templates/gitlist.qtpl:45 +//line templates/gitlist.qtpl:50 qw422016 := qt422016.AcquireWriter(qq422016) -//line templates/gitlist.qtpl:45 +//line templates/gitlist.qtpl:50 p.StreamScript(qw422016, ctx) -//line templates/gitlist.qtpl:45 +//line templates/gitlist.qtpl:50 qt422016.ReleaseWriter(qw422016) -//line templates/gitlist.qtpl:45 +//line templates/gitlist.qtpl:50 } -//line templates/gitlist.qtpl:45 +//line templates/gitlist.qtpl:50 func (p *GitListPage) Script(ctx context.Context) string { -//line templates/gitlist.qtpl:45 +//line templates/gitlist.qtpl:50 qb422016 := qt422016.AcquireByteBuffer() -//line templates/gitlist.qtpl:45 +//line templates/gitlist.qtpl:50 p.WriteScript(qb422016, ctx) -//line templates/gitlist.qtpl:45 +//line templates/gitlist.qtpl:50 qs422016 := string(qb422016.B) -//line templates/gitlist.qtpl:45 +//line templates/gitlist.qtpl:50 qt422016.ReleaseByteBuffer(qb422016) -//line templates/gitlist.qtpl:45 +//line templates/gitlist.qtpl:50 return qs422016 -//line templates/gitlist.qtpl:45 +//line templates/gitlist.qtpl:50 } -- cgit v1.2.3