blob: 07d438f9d37d1e8f95da46245dba5865ffd6ba07 [file] [log] [blame]
<!--
Copyright 2020 The Go Authors. All rights reserved.
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file.
-->
{{define "unit_meta"}}
{{template "unit_meta_details" .}}
<div class="UnitMeta">
<div class="UnitMeta-header">Repository</div>
{{if .Details.RepositoryURL}}
<a href="{{.Details.RepositoryURL}}" title="{{.Details.RepositoryURL}}" target="_blank" rel="noopener">
{{.Details.RepositoryURL}}
</a>
{{else}}
Repository URL not available.
{{end}}
{{if or .Details.ReadmeLinks .Details.DocLinks .Details.ModuleReadmeLinks}}
<div class="UnitMeta-header">Links</div>
{{end}}
{{template "unit_meta_links" .Details.ReadmeLinks}}
{{template "unit_meta_links" .Details.DocLinks}}
{{template "unit_meta_links" .Details.ModuleReadmeLinks}}
</div>
{{end}}
{{define "unit_meta_links"}}
{{range .}}
<div class="UnitMeta-repo">
<a href="{{.Href}}" title="{{.Href}}" target="_blank" rel="noopener">{{.Body}}</a>
</div>
{{end}}
{{end}}
{{define "unit_meta_details_toggletip"}}
<span class="UnitMetaDetails-toggletip">
<button type="button" aria-label="more info" data-toggletip-content="{{.}}">
<img class="UnitMetaDetails-icon" src="/static/img/pkg-icon-help_24x24.svg" alt="" height="24" width="24">
</button>
<span role="status"></span>
</span>
{{end}}
{{define "unit_meta_details_check"}}
<img class="UnitMetaDetails-icon"
{{- if . -}}
src="/static/img/pkg-icon-checkCircleOutline_24x24.svg" alt="checked"
{{- else -}}
src="/static/img/pkg-icon-cancel_24x24.svg" alt="unchecked"
{{- end -}}
height="24" width="24">
{{end}}
{{define "unit_meta_details"}}
<div class="UnitMetaDetails">
<div class="UnitMetaDetails-header">Details<a href="/about#best-practices-h2">Learn more</a></div>
<ul>
<li>
{{template "unit_meta_details_check" .Unit.HasGoMod}}
Valid <a href="{{.Details.ModFileURL}}" target="_blank">go.mod</a> file
{{template "unit_meta_details_toggletip" "The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go."}}
</li>
<li>
{{template "unit_meta_details_check" .Unit.IsRedistributable}}
Permissive license
{{template "unit_meta_details_toggletip" "Permissive licenses place minimal restrictions on how software can be used, modified, and redistributed."}}
</li>
<li>
{{template "unit_meta_details_check" .Details.IsTaggedVersion}}
Tagged version
{{template "unit_meta_details_toggletip" "Modules with tagged versions give importers more predictable builds."}}
</li>
<li>
{{template "unit_meta_details_check" .Details.IsStableVersion}}
Stable version
{{template "unit_meta_details_toggletip" "When a project reaches major version v1 it is considered stable."}}
</li>
</ul>
</div>
{{end}}