1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-22 14:49:42 +02:00

Make label board names clickable

This commit is contained in:
Elliott Stoneham 2016-09-12 12:21:34 +01:00
parent 308f117cca
commit 93a11200b4
3 changed files with 10 additions and 4 deletions

View file

@ -25,7 +25,7 @@ const labelsTemplate = `
<span class="trello-label" style="background-color: {{ $l.Color }}">{{ $l.Name }} ({{len $l.Boards}})</span>
</td>
<td>
{{range $idx, $brd := $l.Boards}}{{if gt $idx 0}}, {{end}}<a class="link" href="#">{{ $brd }}</a>{{end}}.
{{range $idx, $brd := $l.Boards}}{{if gt $idx 0}}, {{end}}{{ $brd }}{{end}}.
</td>
</tr>
{{end}}

View file

@ -12,6 +12,7 @@
package trello
import (
"html/template"
"strings"
"time"
)
@ -249,7 +250,7 @@ type trelloRenderBoard struct {
type trelloSharedLabel struct {
Name string
Color string
Boards []string
Boards []template.HTML
}
type trelloBoardAssignCount struct {

View file

@ -543,7 +543,8 @@ func buildPayloadAnalysis(config *trelloConfig, render *trelloRender) {
if _, exists := labels[lab.Name]; !exists {
labels[lab.Name] = labT{color: lab.Color, boards: make(map[string]bool)}
}
labels[lab.Name].boards[brd.Board.Name] = true
labels[lab.Name].boards[fmt.Sprintf(`<a class="link" href="%s">%s</a>`,
brd.Board.URL, brd.Board.Name)] = true
}
// process member stats
@ -588,8 +589,12 @@ func buildPayloadAnalysis(config *trelloConfig, render *trelloRender) {
brds = append(brds, bname)
}
sort.Strings(brds)
htm := []template.HTML{}
for _, h := range brds {
htm = append(htm, template.HTML(h))
}
render.SharedLabels = append(render.SharedLabels, trelloSharedLabel{
Name: lname, Color: labels[lname].color, Boards: brds,
Name: lname, Color: labels[lname].color, Boards: htm,
})
}
}