| @@ -453,8 +453,9 @@ func GetContributors(repoPath string) ([]Contributor, error){ | |||||
| contributorsInfo := make([]Contributor, len(contributorRows)) | contributorsInfo := make([]Contributor, len(contributorRows)) | ||||
| for i := 0; i < len(contributorRows); i++ { | for i := 0; i < len(contributorRows); i++ { | ||||
| var oneCount string = strings.Trim(contributorRows[i], " ") | var oneCount string = strings.Trim(contributorRows[i], " ") | ||||
| fmt.Println("-------",oneCount,"---------") | |||||
| fmt.Printf("indexOf tab:%d",strings.Index(oneCount, "\t")) | |||||
| if strings.Index(oneCount, "\t") < 0 { | |||||
| continue | |||||
| } | |||||
| number := oneCount[0:strings.Index(oneCount, "\t")] | number := oneCount[0:strings.Index(oneCount, "\t")] | ||||
| commitCnt, _ := strconv.Atoi(number) | commitCnt, _ := strconv.Atoi(number) | ||||
| committer := oneCount[strings.Index(oneCount, "\t")+1:strings.LastIndex(oneCount, " ")] | committer := oneCount[strings.Index(oneCount, "\t")+1:strings.LastIndex(oneCount, " ")] | ||||
| @@ -569,19 +569,18 @@ func safeURL(address string) string { | |||||
| type ContributorInfo struct { | type ContributorInfo struct { | ||||
| UserInfo *models.User | UserInfo *models.User | ||||
| Email string | |||||
| Email string // for contributor who is not a registered user | |||||
| } | } | ||||
| // Home render repository home page | // Home render repository home page | ||||
| func Home(ctx *context.Context) { | func Home(ctx *context.Context) { | ||||
| if len(ctx.Repo.Units) > 0 { | if len(ctx.Repo.Units) > 0 { | ||||
| //get repo contributors info | //get repo contributors info | ||||
| contributors, err := git.GetContributors(ctx.Repo.Repository.RepoPath()) | contributors, err := git.GetContributors(ctx.Repo.Repository.RepoPath()) | ||||
| if err != nil && contributors != nil { | |||||
| fmt.Printf("contributors:%v",contributors) | |||||
| contributorInfos := make([]*ContributorInfo, len(contributors)) | |||||
| if err == nil && contributors != nil { | |||||
| var contributorInfos []*ContributorInfo | |||||
| for _, c := range contributors { | for _, c := range contributors { | ||||
| user,err := models.GetUserByEmail(c.Email) | user,err := models.GetUserByEmail(c.Email) | ||||
| if err != nil { | |||||
| if err == nil { | |||||
| contributorInfos = append(contributorInfos, &ContributorInfo{ | contributorInfos = append(contributorInfos, &ContributorInfo{ | ||||
| user, c.Email, | user, c.Email, | ||||
| }) | }) | ||||
| @@ -176,7 +176,14 @@ | |||||
| <a class="text grey" href="">全部 {{svg "octicon-chevron-right" 16}}</a> | <a class="text grey" href="">全部 {{svg "octicon-chevron-right" 16}}</a> | ||||
| </div> | </div> | ||||
| </h4> | </h4> | ||||
| <div class="ui members"> | <div class="ui members"> | ||||
| {{range .ContributorInfo}} | |||||
| {{/*<img class="ui avatar image" src="{{.UserInfo.RelAvatarLink}}" alt=""/> <a href="{{AppSubUrl}}/{{.UserInfo.Name}}">{{.UserInfo.Name}}</a>*/}} | |||||
| {{if .Email}} | |||||
| <img class="ui avatar image" src="{{AvatarLink .Email}}" alt=""/> {{.Email}} | |||||
| {{end}} | |||||
| {{end}} | |||||
| <a href="{{.HomeLink}}" title="{{.Name}}{{if .FullName}} ({{.FullName}}){{end}}"><img class="ui avatar image" src="https://git.openi.org.cn/user/avatar/coral/-1"></a> | <a href="{{.HomeLink}}" title="{{.Name}}{{if .FullName}} ({{.FullName}}){{end}}"><img class="ui avatar image" src="https://git.openi.org.cn/user/avatar/coral/-1"></a> | ||||
| <a href="{{.HomeLink}}" title="{{.Name}}{{if .FullName}} ({{.FullName}}){{end}}"><img class="ui avatar image" src="https://git.openi.org.cn/user/avatar/dlvc/-1"></a> | <a href="{{.HomeLink}}" title="{{.Name}}{{if .FullName}} ({{.FullName}}){{end}}"><img class="ui avatar image" src="https://git.openi.org.cn/user/avatar/dlvc/-1"></a> | ||||
| <a href="{{.HomeLink}}" title="{{.Name}}{{if .FullName}} ({{.FullName}}){{end}}"><img class="ui avatar image" src="https://git.openi.org.cn/user/avatar/fangwei123456/-1"></a> | <a href="{{.HomeLink}}" title="{{.Name}}{{if .FullName}} ({{.FullName}}){{end}}"><img class="ui avatar image" src="https://git.openi.org.cn/user/avatar/fangwei123456/-1"></a> | ||||