templates

package
v0.0.0-...-6d03e5b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AddRepo = template.Must(template.Must(base.Clone()).Parse(`
{{define "title"}}View Installed Repositories{{end}}
{{define "content"}}
{{if .Repos}}
<div class="row">
<div class="col-lg-6">
<table class="table">
{{ range .Repos }}
<tr>
	<td>
			{{.GetFullName}}
	</td>
	<td>
		<form action="/add" method="post">
			<input type="hidden" name="repo" value="{{.GetName}}">
			<input type="hidden" name="owner" value="{{.GetOwner.GetLogin}}">
			<button type="submit" class="btn btn-outline-primary btn-sm">
				<i class="fa fa-play-circle" aria-hidden="true"></i>
			</button>
		</form>
	</td>
</tr>
{{ end }}
</table>
</div>
</div>
{{else}}
No installed repositories. Please <a href="/add">add a repository</a>.
{{end}}
{{end}}
`))
View Source
var Badge = template.Must(template.New("svg").Funcs(
	template.FuncMap{
		"statusColor": func(s string) string {
			switch s {
			case "Success":
				return "#2ecc71"
			case "Failed":
				return "#d35400"
			default:
				return "#2e4053"
			}
		},
	}).Parse(`
<svg xmlns="http://www.w3.org/2000/svg" width="115" height="20">
	<linearGradient id="a" x2="0" y2="100%">
		<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
		<stop offset="1" stop-opacity=".1"/>
	</linearGradient>
	<rect rx="3" width="115" height="20" fill="#555"/>
	<rect rx="3" x="63" width="53" height="20" fill="{{statusColor .Status}}"/>
	<rect rx="3" width="115" height="20" fill="url(#a)"/>
	<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
		<text x="32" y="15" fill="#010101" fill-opacity=".3">
			goreadme
		</text>
		<text x="32" y="14">
			goreadme
		</text>
		<text x="87" y="15" fill="#010101" fill-opacity=".3">
			{{.Status}}
		</text>
		<text x="87" y="14">
			{{.Status}}
		</text>
	</g>
</svg>
`))
View Source
var Home = template.Must(template.Must(base.Clone()).Parse(`
{{define "title"}}Login{{end}}
{{define "content"}}
<div class="row">
	<div class="col-lg-7 col-12 mx-auto">
		<h4>Welcome</h4>
		<p>
			Goreadme is a service that automatically creates and updates readme
			files for Go Github projects from the Go doc of the project.
		</p>

		<h5>Usage</h5>
		<ol>
			<li>
				Go to <a target="_blank" href="https://github.com/apps/goreadme">Goreadme Github App page</a>.
			</li>
			<li>Press the "Configure" button.</li>
			<li>Choose your account, or an organization that owns the repository.</li>
			<li>Review the permissions and provide access to goreadme to repositories.</li>
			<li>Click Save.</li>
		</ol>
		<p>
			You should see PRs from goreadme bot in your Github repositories.
		</p>
		<h5>How does it Work?</h5>
		<p>
			Once integrated with a repository, goreadme is registered on a Github hooks,
			that calls goreadme server whenever the repository default branch is
			modified. Goreadme then computes the new readme file and compairs it
			to the exiting one. If a change is needed, Goreadme will create a PR with
			the new content of the README.md file.
			Genrating the readme file can also be triggered manually <a href="/projects">here</a>.
		</p>
		<p>
			Goreadme service uses <a href="https://github.com/posener/goreadme">goreadme</a> - is a tool
			created by the service author, for generating README.md files from Go doc of a given package.
		</p>
		<h5>Customization</h5>
		<p>
			Adding a <code>goreadme.json</code> file to your repository main directory can enable some
			customization to the generated readme file. The configuration is available
			according to <a href="https://godoc.org/github.com/posener/goreadme#Config"><code>goreadme.Config</code></a>
		</p>
	</div>
	<div class="col-lg-5 col-12">

	{{ if not .User }}
		<div class="jumbotron text-center">
			<h4>Login</h4>
			<p>
				In order to use goreadme with your Github repositories, login is required.
			</p>
			<form action="/auth/login">
			<button type="submit" class="btn btn-outline-primary">
				<i class="fa fa-x2 fa-github" aria-hidden="true"></i>
				Login with Github
			</button>
			</form>
		</div>
	{{ end }}

		<div class="card">
			<div class="card-body">
				<h4 class="card-title">
					Stats
				</h4>
				<h5 class="card-subtitle p-2 text-muted">
					<i class="fa fa-x2 fa-balance-scale"></i>
					Total: {{.Stats.TotalProjects}}
				</h5>
				<h5 class="card-subtitle p-2 text-muted">
					<i class="fa fa-x2 fa-trophy"></i>
					Top Open Source Goreadmes
				</h5>
				<ul class="list-group">
				{{ range .Stats.TopProjects }}
					<a href="https://github.com/{{.Owner}}/{{.Repo}}" class="list-group-item d-flex justify-content-between align-items-center">
						{{.Owner}}/{{.Repo}}
						<span class="badge badge-info">{{.Stars}} <i class="fa fa-star"></i></span>
					</a>
				{{ end }}
				</ul>
			</div>
		</div>
	</div>

</div>
{{end}}
`))
View Source
var JobsList = template.Must(template.Must(base.Clone()).Parse(`
{{define "title"}}Jobs List{{end}}
{{define "content"}}

<div class="row m-md-2 justify-content-md-center">
<div class="col-xl-8 col-lg-10 col-12">
{{ if .Jobs }}
		{{ range .Jobs }}

		{{ template "jobRow" . }}

		{{ end }}
{{ else }}
	No readmes. Please <a href="/add">add a repository</a>.
{{ end }}
</div>
</div>
{{ end }}
`))
View Source
var Projects = template.Must(template.Must(base.Clone()).Parse(`
{{define "title"}}Projects{{end}}
{{define "content"}}
<div class="row m-md-2 justify-content-md-center">
<div class="col-xl-8 col-lg-10 col-12">
{{if .Projects}}
		{{ range .Projects }}

		{{ template "projectRow" . }}

		{{ end }}
{{else}}
	No readmes. Please <a href="/add">add a repository</a>.
{{end}}
</div>
</div>
{{end}}
`))

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL