1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

add ability to linkify provider matrix

This commit is contained in:
Craig Peterson
2017-09-14 16:25:39 -04:00
parent 3a90435357
commit a342aa7e90
4 changed files with 25 additions and 14 deletions

View File

@ -125,8 +125,8 @@ var tmpl = template.Must(template.New("").Funcs(template.FuncMap{
{{range $pname, $features := $providers}}{{$f := index $features $name}}{{if $f -}}
<td class="{{if $f.HasFeature}}success{{else}}danger{{end}}"
{{- if $f.Comment}} data-toggle="tooltip" data-container="body" data-placement="top" title="{{$f.Comment}}"{{end}}>
<i class="fa {{if $f.Comment}}has-tooltip {{end}}
{{- if $f.HasFeature}}fa-check text-success{{else}}fa-times text-danger{{end}}" aria-hidden="true"></i>
{{if $f.Link}}<a href="{{$f.Link}}">{{end}}<i class="fa {{if $f.Comment}}has-tooltip {{end}}
{{- if $f.HasFeature}}fa-check text-success{{else}}fa-times text-danger{{end}}" aria-hidden="true"></i>{{if $f.Link}}</a>{{end}}
</td>
{{- else}}<td><i class="fa fa-minus dim"></i></td>{{end}}
{{end -}}

View File

@ -21,7 +21,7 @@
</thead>
<tbody>
<tr>
<th class="row-header" style="text-decoration: underline;" data-toggle="tooltip" data-container="body" data-placement="top" title="This means the provider is actively used at stack exchange, and we offer a stronger guarantee it will work">Official Support</th>
<th class="row-header" style="text-decoration: underline;" data-toggle="tooltip" data-container="body" data-placement="top" title="This means the provider is actively used at Stack Exchange, bugs are more likely to be fixed, and failing integration tests will block a release. See below for details">Official Support</th>
<td class="success">
<i class="fa fa-check text-success" aria-hidden="true"></i>
</td>
@ -129,7 +129,7 @@
</td>
</tr>
<tr>
<th class="row-header" style="text-decoration: underline;" data-toggle="tooltip" data-container="body" data-placement="top" title="Provider supports some kind of ALIAS,ANAME or flattened CNAME record type">ALIAS</th>
<th class="row-header" style="text-decoration: underline;" data-toggle="tooltip" data-container="body" data-placement="top" title="Provider supports some kind of ALIAS, ANAME or flattened CNAME record type">ALIAS</th>
<td class="danger">
<i class="fa fa-times text-danger" aria-hidden="true"></i>
</td>
@ -198,8 +198,8 @@
<i class="fa fa-check text-success" aria-hidden="true"></i>
</td>
<td><i class="fa fa-minus dim"></i></td>
<td class="danger" data-toggle="tooltip" data-container="body" data-placement="top" title="PTR records are not supported https://www.name.com/support/articles/205188508-Reverse-DNS-records (2017-05-08)">
<i class="fa has-tooltip fa-times text-danger" aria-hidden="true"></i>
<td class="danger" data-toggle="tooltip" data-container="body" data-placement="top" title="PTR records are not supported (See Link)">
<a href="https://www.name.com/support/articles/205188508-Reverse-DNS-records"><i class="fa has-tooltip fa-times text-danger" aria-hidden="true"></i></a>
</td>
<td><i class="fa fa-minus dim"></i></td>
<td class="success">

View File

@ -2,7 +2,6 @@ package providers
import (
"log"
"strings"
)
//Capability is a bitmasked set of "features" that a provider supports. Only use constants from this package.
@ -45,6 +44,7 @@ func ProviderHasCabability(pType string, cap Capability) bool {
type DocumentationNote struct {
HasFeature bool
Comment string
Link string
}
// DocumentationNotes is a full list of notes for a single provider
@ -79,19 +79,30 @@ func unwrapProviderCapabilities(pName string, meta []ProviderMetadata) {
}
// Can is a small helper for concisely creating Documentation Notes
// comments are variadic for easy ommission, so you generally should pass 0 or 1 only.
// comments are variadic for easy ommission. First is comment, second is link, the rest are ignored.
func Can(comments ...string) *DocumentationNote {
return &DocumentationNote{
n := &DocumentationNote{
HasFeature: true,
Comment: strings.Join(comments, " "),
}
n.addStrings(comments)
return n
}
// Cannot is a small helper for concisely creating Documentation Notes
// comments are variadic for easy ommission, so you generally should pass 0 or 1 only.
// comments are variadic for easy ommission. First is comment, second is link, the rest are ignored.
func Cannot(comments ...string) *DocumentationNote {
return &DocumentationNote{
n := &DocumentationNote{
HasFeature: false,
Comment: strings.Join(comments, " "),
}
n.addStrings(comments)
return n
}
func (n *DocumentationNote) addStrings(comments []string) {
if len(comments) > 0 {
n.Comment = comments[0]
}
if len(comments) > 1 {
n.Link = comments[1]
}
}

View File

@ -23,7 +23,7 @@ var docNotes = providers.DocumentationNotes{
providers.DocDualHost: providers.Cannot("Apex NS records not editable"),
providers.DocCreateDomains: providers.Cannot("New domains require registration"),
providers.DocOfficiallySupported: providers.Can(),
providers.CanUsePTR: providers.Cannot("PTR records are not supported https://www.name.com/support/articles/205188508-Reverse-DNS-records (2017-05-08)"),
providers.CanUsePTR: providers.Cannot("PTR records are not supported (See Link)", "https://www.name.com/support/articles/205188508-Reverse-DNS-records"),
}
func newReg(conf map[string]string) (providers.Registrar, error) {