From 93a11200b469415e4cf8cf2255ab835b39f0b58d Mon Sep 17 00:00:00 2001 From: Elliott Stoneham Date: Mon, 12 Sep 2016 12:21:34 +0100 Subject: [PATCH] Make label board names clickable --- core/section/trello/labels_template.go | 2 +- core/section/trello/model.go | 3 ++- core/section/trello/trello.go | 9 +++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/core/section/trello/labels_template.go b/core/section/trello/labels_template.go index ddf63d2f..ea592eb2 100644 --- a/core/section/trello/labels_template.go +++ b/core/section/trello/labels_template.go @@ -25,7 +25,7 @@ const labelsTemplate = ` {{ $l.Name }} ({{len $l.Boards}}) - {{range $idx, $brd := $l.Boards}}{{if gt $idx 0}}, {{end}}{{ $brd }}{{end}}. + {{range $idx, $brd := $l.Boards}}{{if gt $idx 0}}, {{end}}{{ $brd }}{{end}}. {{end}} diff --git a/core/section/trello/model.go b/core/section/trello/model.go index 6b83f5e9..d49c6d92 100644 --- a/core/section/trello/model.go +++ b/core/section/trello/model.go @@ -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 { diff --git a/core/section/trello/trello.go b/core/section/trello/trello.go index 2569eafa..163d6432 100644 --- a/core/section/trello/trello.go +++ b/core/section/trello/trello.go @@ -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(`%s`, + 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, }) } }