1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-23 15:19:42 +02:00

Add team to dropdown, activity translation map, use team not organization in name

This commit is contained in:
Elliott Stoneham 2016-09-12 18:39:27 +01:00
parent ca2611c50b
commit 4178b2946f
5 changed files with 30 additions and 4 deletions

View file

@ -207,7 +207,7 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
self.get('sectionService').fetch(page, "boards", self.get('config')) self.get('sectionService').fetch(page, "boards", self.get('config'))
.then(function (boards) { .then(function (boards) {
self.set('busy', false); self.set('busy', false);
boards.unshift({ id: null, name: "--None--", backgroundColor: "white" }); // add the non-selection to the front boards.unshift({ id: null, namePath: "< do not show >", backgroundColor: "white" }); // add the non-selection to the front
self.set('config.boards', boards); // save the boards in the config too self.set('config.boards', boards); // save the boards in the config too
self.set('boards', boards); self.set('boards', boards);
self.getBoardLists(); self.getBoardLists();

View file

@ -51,7 +51,7 @@
<div class="input-control"> <div class="input-control">
<label>Individual Board</label> <label>Individual Board</label>
<div class="tip">Select board</div> <div class="tip">Select board</div>
{{ui-select id="boards-dropdown" content=boards action=(action 'onBoardChange') optionValuePath="id" optionLabelPath="name" selection=config.board}} {{ui-select id="boards-dropdown" content=boards action=(action 'onBoardChange') optionValuePath="id" optionLabelPath="namePath" selection=config.board}}
</div> </div>
{{#if config.board.id}} {{#if config.board.id}}
<div class="input-control"> <div class="input-control">

View file

@ -0,0 +1,17 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
package trello
var activityTranslation = map[string]string{
"comment card": "comment on card", // TODO, this just to prove the method
"update board": "", // TODO, this just to test the delete functionality
}

View file

@ -184,6 +184,7 @@ type trelloBoard struct {
Purple string `json:"purple"` Purple string `json:"purple"`
} `json:"labelNames"` } `json:"labelNames"`
Included bool `json:"included"` // indicates whether we display this board Included bool `json:"included"` // indicates whether we display this board
NamePath string `json:"namePath"` // the "team / board" form
} }
type trelloBoardBackground struct { type trelloBoardBackground struct {

View file

@ -19,6 +19,7 @@ import (
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"sort" "sort"
"strings"
"time" "time"
"unicode" "unicode"
@ -335,6 +336,7 @@ func getBoards(config *trelloConfig) (boards []trelloBoard, err error) {
if !b.Closed && len(b.OrganizationID) > 0 { if !b.Closed && len(b.OrganizationID) > 0 {
if o, e := getOrg(config, b.OrganizationID); e == nil { if o, e := getOrg(config, b.OrganizationID); e == nil {
b.OrgName = o.Name b.OrgName = o.Name
b.NamePath = o.Name + " / " + b.Name
} else { } else {
log.Error("failed to get organisation infomation", e) log.Error("failed to get organisation infomation", e)
} }
@ -585,7 +587,7 @@ func buildPayloadAnalysis(config *trelloConfig, render *trelloRender) {
if _, exists := labels[lab.Name]; !exists { if _, exists := labels[lab.Name]; !exists {
labels[lab.Name] = labT{color: lab.Color, boards: make(map[string]trelloBoard)} labels[lab.Name] = labT{color: lab.Color, boards: make(map[string]trelloBoard)}
} }
labels[lab.Name].boards[brd.Board.URL+"::"+brd.Board.Name] = brd.Board labels[lab.Name].boards[brd.Board.URL+" / "+brd.Board.Name] = brd.Board
} }
// process member stats // process member stats
@ -612,9 +614,15 @@ func buildPayloadAnalysis(config *trelloConfig, render *trelloRender) {
englishType += string(c) englishType += string(c)
} }
} }
englishType = strings.Replace(englishType, "organization", "team", -1)
if newTxt, found := activityTranslation[englishType]; found {
englishType = newTxt
}
if len(englishType) > 0 {
render.Boards[brdIdx].ActionSummary[englishType]++ render.Boards[brdIdx].ActionSummary[englishType]++
} }
} }
}
//post-process labels //post-process labels
labs := make([]string, 0, len(labels)) labs := make([]string, 0, len(labels))