mirror of
https://github.com/documize/community.git
synced 2025-07-28 17:49:41 +02:00
Tidy HTML, separate detailed single-board data
This commit is contained in:
parent
2d7647e790
commit
0345c93560
8 changed files with 155 additions and 134 deletions
|
@ -12,7 +12,8 @@
|
||||||
package trello
|
package trello
|
||||||
|
|
||||||
const archiveTemplate = `
|
const archiveTemplate = `
|
||||||
<h3>Deleted and Archived Cards</h3>
|
{{if gt (len .Boards) 0}}
|
||||||
|
<div class="heading">Deleted and Archived Cards</div>
|
||||||
<p>Changes since {{.Since}}.</p>
|
<p>Changes since {{.Since}}.</p>
|
||||||
<div class="section-trello-render">
|
<div class="section-trello-render">
|
||||||
<table class="trello-table" class="width-100">
|
<table class="trello-table" class="width-100">
|
||||||
|
@ -28,12 +29,22 @@ const archiveTemplate = `
|
||||||
{{range $act := $b.Actions}}
|
{{range $act := $b.Actions}}
|
||||||
{{if eq $act.Type "deleteCard" }}
|
{{if eq $act.Type "deleteCard" }}
|
||||||
Deleted:
|
Deleted:
|
||||||
{{$act.Data.List.Name}} : {{$act.Data.Card.Name}} - {{$act.Data.Text}}
|
{{$act.Data.List.Name}}
|
||||||
|
{{if ne $act.Data.Card.Name ""}}
|
||||||
|
: {{$act.Data.Card.Name}}
|
||||||
|
{{if ne $act.Data.Text ""}}
|
||||||
|
- {{$act.Data.Text}}
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
<br>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
{{range $arch := $b.Archived}}
|
{{range $arch := $b.Archived}}
|
||||||
Archived:
|
Archived:
|
||||||
{{$arch.Name}} - {{$arch.Desc}}
|
{{$arch.Name}}
|
||||||
|
{{if ne $arch.Desc ""}}
|
||||||
|
- {{$arch.Desc}}
|
||||||
|
{{end}}
|
||||||
<br>
|
<br>
|
||||||
{{end}}
|
{{end}}
|
||||||
</td>
|
</td>
|
||||||
|
@ -42,4 +53,5 @@ const archiveTemplate = `
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
{{end}}
|
||||||
`
|
`
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
package trello
|
package trello
|
||||||
|
|
||||||
const boardsTemplate = `
|
const boardsTemplate = `
|
||||||
|
{{if gt (len .Boards) 0}}
|
||||||
<h3>Boards</h3>
|
<div class="heading">Boards</div>
|
||||||
<p>Changes since {{.Since}}.</p>
|
<p>Changes since {{.Since}}.</p>
|
||||||
<div class="section-trello-render">
|
<div class="section-trello-render">
|
||||||
<table class="trello-table" class="width-100">
|
<table class="trello-table" class="width-100">
|
||||||
|
@ -51,8 +51,10 @@ const boardsTemplate = `
|
||||||
{{end}}
|
{{end}}
|
||||||
{{if gt (len $b.Archived) 0}}
|
{{if gt (len $b.Archived) 0}}
|
||||||
archive card ({{len $b.Archived}}).
|
archive card ({{len $b.Archived}}).
|
||||||
<br>
|
{{else}}
|
||||||
|
no cards archived.
|
||||||
{{end}}
|
{{end}}
|
||||||
|
<br>
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -60,4 +62,5 @@ const boardsTemplate = `
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
{{end}}
|
||||||
`
|
`
|
||||||
|
|
|
@ -14,7 +14,7 @@ package trello
|
||||||
const graphsTemplate = `
|
const graphsTemplate = `
|
||||||
{{if false}}
|
{{if false}}
|
||||||
|
|
||||||
<b>Single Boards (graphs)</b><br>
|
<div class="heading">Single Boards (graphs)</div>
|
||||||
{{range $b := .Boards}}
|
{{range $b := .Boards}}
|
||||||
<div>
|
<div>
|
||||||
<p>There are {{ $b.CardCount }} cards across {{ $b.ListCount }} lists for board <a href="{{ $b.Board.URL }}">{{$b.Board.Name}}.</a></p>
|
<p>There are {{ $b.CardCount }} cards across {{ $b.ListCount }} lists for board <a href="{{ $b.Board.URL }}">{{$b.Board.Name}}.</a></p>
|
||||||
|
|
|
@ -13,7 +13,7 @@ package trello
|
||||||
|
|
||||||
const labelsTemplate = `
|
const labelsTemplate = `
|
||||||
{{if gt (len .SharedLabels) 0}}
|
{{if gt (len .SharedLabels) 0}}
|
||||||
<h3>Labels</h3>
|
<div class="heading">Labels</div>
|
||||||
<p>There are {{len .SharedLabels}} common labels across the boards.</p>
|
<p>There are {{len .SharedLabels}} common labels across the boards.</p>
|
||||||
<div class="section-trello-render">
|
<div class="section-trello-render">
|
||||||
<table class="trello-table" class="width-100">
|
<table class="trello-table" class="width-100">
|
||||||
|
@ -24,9 +24,7 @@ const labelsTemplate = `
|
||||||
<span class="trello-label" style="background-color: {{ $l.Color }}">{{ $l.Name }} ({{len $l.Boards}})</span>
|
<span class="trello-label" style="background-color: {{ $l.Color }}">{{ $l.Name }} ({{len $l.Boards}})</span>
|
||||||
</td>
|
</td>
|
||||||
<td class="width-75">
|
<td class="width-75">
|
||||||
{{range $brd := $l.Boards}}
|
{{range $idx, $brd := $l.Boards}}{{if gt $idx 0}}, {{end}}{{ $brd }}{{end}}.
|
||||||
{{ $brd }},
|
|
||||||
{{end}}
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
|
@ -12,7 +12,8 @@
|
||||||
package trello
|
package trello
|
||||||
|
|
||||||
const membersTemplate = `
|
const membersTemplate = `
|
||||||
<h3>Member Stats</h3>
|
{{if gt (len .Boards) 0}}
|
||||||
|
<div class="heading">Member Stats</div>
|
||||||
<p>
|
<p>
|
||||||
There are {{len .MemberBoardAssign}} members assigned to {{.CardAssignTotal}} cards of the total {{.CardTotal}} cards across {{len .Boards}} boards.
|
There are {{len .MemberBoardAssign}} members assigned to {{.CardAssignTotal}} cards of the total {{.CardTotal}} cards across {{len .Boards}} boards.
|
||||||
</p>
|
</p>
|
||||||
|
@ -29,9 +30,7 @@ const membersTemplate = `
|
||||||
<td>
|
<td>
|
||||||
<h6>{{$m.MemberName}}</h6>
|
<h6>{{$m.MemberName}}</h6>
|
||||||
<p>
|
<p>
|
||||||
{{range $ac := $m.AssignCounts}}
|
{{range $idx, $ac := $m.AssignCounts}}{{if gt $idx 0}}, {{end}}{{$ac.BoardName}} ({{$ac.Count}}){{end}}.
|
||||||
{{$ac.BoardName}} ({{$ac.Count}}),
|
|
||||||
{{end}}
|
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -39,5 +38,5 @@ const membersTemplate = `
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
{{end}}
|
||||||
`
|
`
|
||||||
|
|
|
@ -264,11 +264,9 @@ type trelloBoardAssign struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type trelloRender struct {
|
type trelloRender struct {
|
||||||
Config trelloConfig
|
|
||||||
|
|
||||||
Boards []trelloRenderBoard
|
Boards []trelloRenderBoard
|
||||||
|
|
||||||
Since string
|
Since string
|
||||||
|
Detail trelloRenderBoard
|
||||||
|
|
||||||
// items below are generated during the render phase
|
// items below are generated during the render phase
|
||||||
SharedLabels []trelloSharedLabel
|
SharedLabels []trelloSharedLabel
|
||||||
|
|
|
@ -12,14 +12,15 @@
|
||||||
package trello
|
package trello
|
||||||
|
|
||||||
const tradTemplate = `
|
const tradTemplate = `
|
||||||
{{if false}}
|
{{if ne .Detail.Board.ID ""}}
|
||||||
{{range $b := .Boards}}
|
<div class="heading">Board: {{.Detail.Board.Name}}</div>
|
||||||
<p class="non-printable-message">Non-printable</p>
|
<p class="non-printable-message">Non-printable</p>
|
||||||
<div class="section-trello-render non-printable">
|
<div class="section-trello-render non-printable">
|
||||||
<p>There are {{ $b.CardCount }} cards across {{ $b.ListCount }} lists for board <a href="{{ $b.Board.URL }}">{{$b.Board.Name}}.</a></p>
|
<p>There are {{ .Detail.CardCount }} cards across {{ .Detail.ListCount }} lists
|
||||||
<div class="trello-board" style="background-color: {{$b.Board.Prefs.BackgroundColor}}">
|
for board <a href="{{ .Detail.Board.URL }}">{{.Detail.Board.Name}}.</a></p>
|
||||||
<a href="{{ $b.Board.URL }}"><div class="trello-board-title">{{$b.Board.Name}}</div></a>
|
<div class="trello-board" style="background-color: {{.Detail.Board.Prefs.BackgroundColor}}">
|
||||||
{{range $data := $b.Data}}
|
<a href="{{ .Detail.Board.URL }}"><div class="trello-board-title">{{.Detail.Board.Name}}</div></a>
|
||||||
|
{{range $data := .Detail.Data}}
|
||||||
<div class="trello-list">
|
<div class="trello-list">
|
||||||
<div class="trello-list-title">{{ $data.List.Name }}</div>
|
<div class="trello-list-title">{{ $data.List.Name }}</div>
|
||||||
{{range $card := $data.Cards}}
|
{{range $card := $data.Cards}}
|
||||||
|
@ -34,5 +35,4 @@ const tradTemplate = `
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{end}}
|
|
||||||
`
|
`
|
||||||
|
|
|
@ -186,7 +186,6 @@ func (*Provider) Refresh(ctx *provider.Context, config, data string) string {
|
||||||
log.IfErr(json.Unmarshal([]byte(config), &c))
|
log.IfErr(json.Unmarshal([]byte(config), &c))
|
||||||
|
|
||||||
save := trelloRender{}
|
save := trelloRender{}
|
||||||
save.Config = c
|
|
||||||
save.Boards = make([]trelloRenderBoard, 0, len(c.Boards))
|
save.Boards = make([]trelloRenderBoard, 0, len(c.Boards))
|
||||||
|
|
||||||
if len(c.Since) >= len("yyyy/mm/dd hh:ss") {
|
if len(c.Since) >= len("yyyy/mm/dd hh:ss") {
|
||||||
|
@ -211,12 +210,24 @@ func (*Provider) Refresh(ctx *provider.Context, config, data string) string {
|
||||||
}
|
}
|
||||||
save.Since = (*c.SincePtr).Format("January 2, 2006") + dateMessage
|
save.Since = (*c.SincePtr).Format("January 2, 2006") + dateMessage
|
||||||
|
|
||||||
|
c.AppKey = request.ConfigString(meta.ConfigHandle(), "appKey")
|
||||||
|
|
||||||
|
if c.Board.ID != "" { // set up detail board
|
||||||
|
var err error
|
||||||
|
save.Detail.Board = c.Board
|
||||||
|
save.Detail.Data, err = getCards(c)
|
||||||
|
log.IfErr(err)
|
||||||
|
save.Detail.ListCount = len(save.Detail.Data)
|
||||||
|
for _, list := range save.Detail.Data {
|
||||||
|
save.Detail.CardCount += len(list.Cards)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for _, board := range c.Boards {
|
for _, board := range c.Boards {
|
||||||
if board.Included {
|
if board.Included {
|
||||||
var payload = trelloRenderBoard{}
|
var payload = trelloRenderBoard{}
|
||||||
|
|
||||||
c.Board = board
|
c.Board = board
|
||||||
c.AppKey = request.ConfigString(meta.ConfigHandle(), "appKey")
|
|
||||||
|
|
||||||
lsts, err := getLists(c)
|
lsts, err := getLists(c)
|
||||||
log.IfErr(err)
|
log.IfErr(err)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue