forked from tangled.org/core
this repo has no description

add repoBase layout

Changed files
+77 -51
appview
+9 -4
appview/pages/pages.go
···
return p.t[name].ExecuteTemplate(w, "layouts/base", params)
}
func (p *Pages) Login(w io.Writer, params LoginParams) error {
return p.execute("user/login", w, params)
}
···
Name string
OwnerDid string
OwnerHandle string
}
func (r RepoInfo) OwnerWithAt() string {
···
func (p *Pages) RepoIndexPage(w io.Writer, params RepoIndexParams) error {
-
return p.execute("repo/index", w, params)
}
type RepoLogParams struct {
···
}
func (p *Pages) RepoCommit(w io.Writer, params RepoCommitParams) error {
-
return p.execute("repo/commit", w, params)
}
type RepoTreeParams struct {
···
}
func (p *Pages) RepoBranches(w io.Writer, params RepoBranchesParams) error {
-
return p.execute("repo/branches", w, params)
}
type RepoTagsParams struct {
···
}
func (p *Pages) RepoTags(w io.Writer, params RepoTagsParams) error {
-
return p.execute("repo/tags", w, params)
}
···
return p.t[name].ExecuteTemplate(w, "layouts/base", params)
}
+
func (p *Pages) executeRepo(name string, w io.Writer, params any) error {
+
return p.t[name].ExecuteTemplate(w, "layouts/repoBase", params)
+
}
+
func (p *Pages) Login(w io.Writer, params LoginParams) error {
return p.execute("user/login", w, params)
}
···
Name string
OwnerDid string
OwnerHandle string
+
Description string
}
func (r RepoInfo) OwnerWithAt() string {
···
func (p *Pages) RepoIndexPage(w io.Writer, params RepoIndexParams) error {
+
return p.executeRepo("repo/index", w, params)
}
type RepoLogParams struct {
···
}
func (p *Pages) RepoCommit(w io.Writer, params RepoCommitParams) error {
+
return p.executeRepo("repo/commit", w, params)
}
type RepoTreeParams struct {
···
}
func (p *Pages) RepoBranches(w io.Writer, params RepoBranchesParams) error {
+
return p.executeRepo("repo/branches", w, params)
}
type RepoTagsParams struct {
···
}
func (p *Pages) RepoTags(w io.Writer, params RepoTagsParams) error {
+
return p.executeRepo("repo/tags", w, params)
}
+32
appview/pages/templates/layouts/repoBase.html
···
···
+
{{define "title"}} {{ .RepoInfo.FullName }} {{ end}}
+
+
{{ define "content" }}
+
+
<div id="repo-header">
+
<h1>{{ .RepoInfo.FullName }}</h1>
+
{{ if .RepoInfo.Description }}
+
<h3 class="desc">{{ .RepoInfo.Description }}</h3>
+
{{ else }}
+
<em>this repo has no description</em>
+
</div>
+
+
<div id="repo-links">
+
<nav>
+
<a href="/{{ .RepoInfo.FullName }}">summary</a>&nbsp;·
+
<a href="/{{ .RepoInfo.FullName }}/branches">branches</a>&nbsp;·
+
<a href="/{{ .RepoInfo.FullName }}/tags">tags</a>
+
</nav>
+
<div>
+
+
{{ end }}
+
+
{{ block "repoContent" . }} {{ end }}
+
+
{{ end }}
+
+
{{ define "layouts/repoBase" }}
+
+
{{ template "layouts/base" . }}
+
+
{{ end }}
+
+1 -5
appview/pages/templates/repo/branches.html
···
-
{{ define "title" }}
-
branches | {{ .RepoInfo.FullName }}
-
{{ end }}
-
-
{{ define "content" }}
{{ $name := .RepoInfo.Name }}
<h3>branches</h3>
<div class="refs">
···
+
{{ define "repoContent" }}
{{ $name := .RepoInfo.Name }}
<h3>branches</h3>
<div class="refs">
+1 -1
appview/pages/templates/repo/commit.html
···
{{ define "title" }} commit {{ .Diff.Commit.This }} {{ end }}
-
{{ define "content" }}
{{ $repo := .RepoInfo.FullName }}
{{ $commit := .Diff.Commit }}
···
{{ define "title" }} commit {{ .Diff.Commit.This }} {{ end }}
+
{{ define "repoContent" }}
{{ $repo := .RepoInfo.FullName }}
{{ $commit := .Diff.Commit }}
+30 -35
appview/pages/templates/repo/index.html
···
-
{{define "title"}} {{ .RepoInfo.FullName }} {{ end}}
-
{{define "content"}}
-
<h1>
-
{{ .RepoInfo.FullName }}
-
</h1>
-
<main>
-
{{- if .IsEmpty }}
-
this repo is empty
-
{{ else }}
-
<div class="log">
-
{{ range .Commits }}
-
<div>
-
<div><a href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash.String }}" class="commit-hash">{{ slice .Hash.String 0 8 }}</a></div>
-
<pre>{{ .Message }}</pre>
-
</div>
-
<div class="commit-info">
-
{{ .Author.Name }} <a href="mailto:{{ .Author.Email }}" class="commit-email">{{ .Author.Email }}</a>
-
<div>{{ .Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</div>
-
</div>
-
<hr />
-
{{ end }}
-
</div>
-
{{- if .Readme }}
-
<article class="readme">
-
{{- .Readme -}}
-
</article>
-
{{- end -}}
-
{{- end -}}
-
-
<div class="clone-url">
-
<strong>clone</strong>
-
<pre>
git clone https://tangled.sh/{{ .RepoInfo.OwnerWithAt }}/{{ .RepoInfo.Name }}
-
</pre>
-
</div>
-
</main>
{{end}}
···
+
{{define "repoContent"}}
+
<main>
+
{{- if .IsEmpty }}
+
this repo is empty
+
{{ else }}
+
<div class="log">
+
{{ range .Commits }}
+
<div>
+
<div><a href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash.String }}" class="commit-hash">{{ slice .Hash.String 0 8 }}</a></div>
+
<pre>{{ .Message }}</pre>
+
</div>
+
<div class="commit-info">
+
{{ .Author.Name }} <a href="mailto:{{ .Author.Email }}" class="commit-email">{{ .Author.Email }}</a>
+
<div>{{ .Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</div>
+
</div>
+
<hr />
+
{{ end }}
+
</div>
+
{{- if .Readme }}
+
<article class="readme">
+
{{- .Readme -}}
+
</article>
+
{{- end -}}
+
{{- end -}}
+
<div class="clone-url">
+
<strong>clone</strong>
+
<pre>
git clone https://tangled.sh/{{ .RepoInfo.OwnerWithAt }}/{{ .RepoInfo.Name }}
+
</pre>
+
</div>
+
</main>
{{end}}
+1 -6
appview/pages/templates/repo/tags.html
···
-
{{ define "title" }}
-
tags | {{ .RepoInfo.OwnerWithAt }} /
-
{{ .RepoInfo.Name }}
-
{{ end }}
-
-
{{ define "content" }}
{{ $name := .RepoInfo.Name }}
<h3>tags</h3>
<div class="refs">
···
+
{{ define "repoContent" }}
{{ $name := .RepoInfo.Name }}
<h3>tags</h3>
<div class="refs">
+3
appview/state/repo.go
···
OwnerDid: id.DID.String(),
OwnerHandle: id.Handle.String(),
Name: repoName,
},
RepoIndexResponse: result,
})
···
OwnerDid: id.DID.String(),
OwnerHandle: id.Handle.String(),
Name: repoName,
},
RepoLogResponse: result,
})
···
OwnerDid: id.DID.String(),
OwnerHandle: id.Handle.String(),
Name: repoName,
},
RepoTreeResponse: result,
})
···
OwnerDid: id.DID.String(),
OwnerHandle: id.Handle.String(),
Name: repoName,
+
Description: result.Description,
},
RepoIndexResponse: result,
})
···
OwnerDid: id.DID.String(),
OwnerHandle: id.Handle.String(),
Name: repoName,
+
Description: result.Description,
},
RepoLogResponse: result,
})
···
OwnerDid: id.DID.String(),
OwnerHandle: id.Handle.String(),
Name: repoName,
+
Description: result.Description,
},
RepoTreeResponse: result,
})