Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement contributors graph #27882

Merged
merged 190 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
190 commits
Select commit Hold shift + click to select a range
9fd24bc
Create new page
sahinakkaya Jun 16, 2023
3975abd
Implement simple api
sahinakkaya Jun 18, 2023
19deef6
Implement basic graph render
sahinakkaya Jun 19, 2023
715fc15
Handle dates by grouping them into weeks
sahinakkaya Jun 19, 2023
136d8be
Split vue file into meaningful pieces
sahinakkaya Jun 19, 2023
be50ead
Remove non-needed code
sahinakkaya Jun 19, 2023
3211417
Implement contributors graph
sahinakkaya Jun 20, 2023
88247fd
Switch to unix timestamp
sahinakkaya Jun 20, 2023
a393093
Show contributor rank
sahinakkaya Jun 20, 2023
e8e0e34
Multiply x with 1000 to make it milliseconds
sahinakkaya Jun 20, 2023
ff17e01
Remove legend, format numbers
sahinakkaya Jun 20, 2023
664747a
Implement contribution type selection
sahinakkaya Jun 20, 2023
2c567ea
Draw charts basaed on selected contribution type
sahinakkaya Jun 20, 2023
8ef0c35
Show all sundays until today instead of latest commit
sahinakkaya Jun 20, 2023
bc396c0
Show date range in title
sahinakkaya Jun 20, 2023
630c2dd
Add zoom/pan support to charts
sahinakkaya Jun 21, 2023
d293f24
Sync charts on zoom/pan events
sahinakkaya Jun 21, 2023
2304a5d
Format everything with gofmt
sahinakkaya Jun 21, 2023
a047e07
Disable animations for performance
sahinakkaya Jun 21, 2023
34f9d92
Reset zoom when clicking on chart
sahinakkaya Jun 21, 2023
f210a51
Disable grid for x axis
sahinakkaya Jun 22, 2023
9af88ec
Refactor
sahinakkaya Jun 22, 2023
4399890
Remove unused api endpoint
sahinakkaya Jun 22, 2023
e94b9c7
Merge branch 'main' into main
sahinakkaya Jun 22, 2023
a4b6666
Use a better name for variable
sahinakkaya Jun 22, 2023
c75b7a5
Implement new endpoint for fetching contributors data
sahinakkaya Jun 22, 2023
e29efb2
Use new endpoint for fetching contributors data
sahinakkaya Jun 22, 2023
b516a67
Introduce a new endpoint for fetching data in frontend
sahinakkaya Jun 22, 2023
4ee972c
Apply suggestions from code review
sahinakkaya Jun 23, 2023
90e3d50
Do not use hard-coded colors
sahinakkaya Jun 23, 2023
0dfd908
Make object key snake_case
sahinakkaya Jun 24, 2023
2c174d6
Add copyright header
sahinakkaya Jun 24, 2023
730368e
Fix linting errors
sahinakkaya Jun 24, 2023
32fe51e
Use actual commit ID instead of empty string
sahinakkaya Jun 24, 2023
5e16adf
Merge branch 'main' into main
6543 Jun 24, 2023
0dd9095
Generate swagger
sahinakkaya Jun 24, 2023
ffab20b
Merge branch 'main' into main
sahinakkaya Jun 24, 2023
3196641
Lower height of graph
sahinakkaya Jun 24, 2023
5e66e27
Merge branch 'main' into main
sahinakkaya Jun 25, 2023
a886f57
Remove translation to other languages
sahinakkaya Jun 26, 2023
f278598
Add newline at end of swagger file
sahinakkaya Jun 26, 2023
beb7382
Move header from Go template to Vue
sahinakkaya Jun 26, 2023
e169731
Merge branch 'main' into main
sahinakkaya Jun 26, 2023
4c5170b
Merge branch 'main' into main
sahinakkaya Jun 28, 2023
8dce947
Fix package-lock.json
sahinakkaya Jun 28, 2023
4f74932
Adjust the location of the contributors page
hiifong Jun 28, 2023
677ac20
Merge branch 'go-gitea:main' into contributors
hiifong Jun 28, 2023
1cbeabf
fix lint
hiifong Jun 28, 2023
e047458
make generate-swagger
hiifong Jun 28, 2023
49eaf6d
fix typo
hiifong Jun 28, 2023
3dcbba3
Merge pull request #1 from hiifong/contributors
sahinakkaya Jun 28, 2023
a8d2a9c
Merge branch 'main' into main
sahinakkaya Jun 30, 2023
3e156ab
Cherry-pick 64f2d7026 and resolve conflicts
silverwind Jun 29, 2023
7947bf9
Try updating date range when zoom or pan occurs
sahinakkaya Jun 30, 2023
3d62edc
Use v-memo to avoid unnecessary re-render
sahinakkaya Jun 30, 2023
e27ea6c
Merge branch 'update-date'
sahinakkaya Jun 30, 2023
e5537cc
Preparation step for sorting contributor graphs
sahinakkaya Jun 30, 2023
7a69f2e
Update contributor graphs based on selected date range
sahinakkaya Jun 30, 2023
5d2b764
Calculate total stats while looping to avoid unnecessary computation …
sahinakkaya Jun 30, 2023
d0714e7
Sort contributors based on selected contribution type
sahinakkaya Jun 30, 2023
b273ba7
Do not show contributor graph if total contribution is 0 on selected …
sahinakkaya Jun 30, 2023
1e163bb
Set highest value for contributor graphs dynamically
sahinakkaya Jun 30, 2023
e4ccffd
Fix a bug while parsing the commits
sahinakkaya Jun 30, 2023
1ba2157
Merge branch 'main' into main
sahinakkaya Jun 30, 2023
6ffe1f1
Fix linting errors
sahinakkaya Jun 30, 2023
43bf7ec
Merge branch 'main' into main
sahinakkaya Jul 1, 2023
497ce76
Fix linting errors
sahinakkaya Jul 1, 2023
145d3ca
Fix linting errors
sahinakkaya Jul 1, 2023
d550ba7
Merge branch 'main' into main
sahinakkaya Jul 2, 2023
991e3c0
Show loading animation while fetching data
sahinakkaya Jul 6, 2023
8ba3674
Eliminate unnecessary fetch when contribution type changes
sahinakkaya Jul 6, 2023
b148d1a
Reset all charts when main chart is clicked
sahinakkaya Jul 6, 2023
5de9fbf
Handle errors which can occure while fetching data
sahinakkaya Jul 6, 2023
79dfb84
Apply suggestions from code review
sahinakkaya Jul 7, 2023
ec30e3b
Apply suggestions from code review
sahinakkaya Jul 7, 2023
51f8118
Use translated strings
sahinakkaya Jul 9, 2023
7e68c7c
Do code splitting on contributors page
sahinakkaya Jul 9, 2023
056745b
Use author information instead of committer
sahinakkaya Jul 9, 2023
d6887e4
Move contributor related code under service
sahinakkaya Jul 9, 2023
8ed40fe
Apply suggestions from code review
sahinakkaya Jul 14, 2023
3fc79af
Apply suggestions from code review
sahinakkaya Jul 14, 2023
d51417d
Merge branch 'main' into main
6543 Jul 14, 2023
75b92e3
Merge remote-tracking branch 'upstream/main' into main
sahinakkaya Oct 17, 2023
09d249d
Apply suggestions from code review
sahinakkaya Oct 17, 2023
023bbbb
Use GET instead of fetch
sahinakkaya Oct 17, 2023
e83b562
Re-order tags to script - template - style in vue file
sahinakkaya Oct 17, 2023
f2d3394
Remove useless error checking
sahinakkaya Oct 18, 2023
ca59188
Merge branch 'main' into main
6543 Oct 20, 2023
7f1f49f
Merge remote-tracking branch 'upstream/main'
sahinakkaya Oct 26, 2023
e953057
Merge remote-tracking branch 'upstream/main'
sahinakkaya Oct 30, 2023
88ffba5
Apply suggestions from code review
sahinakkaya Oct 31, 2023
12cc6d6
Merge remote-tracking branch 'upstream/main'
sahinakkaya Oct 31, 2023
ce1306b
Merge branch 'main' into main
6543 Nov 1, 2023
80e6614
Fix linting errors
sahinakkaya Nov 1, 2023
8d07fdd
Merge branch 'main' into main
6543 Nov 1, 2023
248065f
dayjs
6543 Nov 1, 2023
ba4e738
generate
6543 Nov 1, 2023
b6b4881
fmt
6543 Nov 2, 2023
9e50232
Merge branch 'main' into sahinakkaya/main
6543 Nov 2, 2023
2bf4ce0
Fix locale usage
sahinakkaya Nov 2, 2023
0d08f06
layout fixes
silverwind Nov 2, 2023
f47560c
Merge branch 'main' into contributors-graph
silverwind Nov 5, 2023
325fc9b
Combine email addresses linked to same gitea user together
sahinakkaya Nov 6, 2023
4135808
Merge remote-tracking branch 'upstream/main' into contributors-graph
sahinakkaya Nov 7, 2023
2b2d0ef
reduce main graph to 280px height
silverwind Nov 7, 2023
36d8e81
color and chart rendering enhancements
silverwind Nov 7, 2023
4d2905b
make fmt
silverwind Nov 7, 2023
a151d51
js formatting
silverwind Nov 7, 2023
6ebc6ce
Use constant from time package instead of manually defining it
sahinakkaya Nov 8, 2023
86e0204
Merge remote-tracking branch 'upstream/main' into contributors-graph
sahinakkaya Nov 8, 2023
b50929b
Remove useless data from page context
sahinakkaya Nov 8, 2023
043f2a2
Update templates/repo/navbar.tmpl
silverwind Nov 9, 2023
dd2664d
Update templates/repo/navbar.tmpl
silverwind Nov 9, 2023
1c9b0f5
Apply suggestions from code review
sahinakkaya Nov 9, 2023
efd6ace
Merge branch 'main' into contributors-graph
6543 Nov 10, 2023
ebf5af2
Backend Asnyc
6543 Nov 10, 2023
6dc6438
Merge branch 'main' into contributors-graph
6543 Nov 10, 2023
8c35b11
use status 216
6543 Nov 11, 2023
de1b537
Handle http 216 on client side
sahinakkaya Nov 11, 2023
bf35e58
Merge branch 'main' into contributors-graph
6543 Nov 13, 2023
cc4f996
body
6543 Nov 13, 2023
1660802
fix
6543 Nov 13, 2023
af7463a
Merge branch 'main' into contributors-graph
6543 Nov 13, 2023
ed1506e
Fix frontend
sahinakkaya Nov 13, 2023
6b1593f
Fix a small error
sahinakkaya Nov 13, 2023
f31d0a3
Fix frontend
sahinakkaya Nov 13, 2023
112897d
Use status 202
sahinakkaya Nov 13, 2023
130f3f4
Fix linting errors
sahinakkaya Nov 13, 2023
2c2d376
sync x axis in all graph
yp05327 Nov 16, 2023
3777a9e
fix lint
yp05327 Nov 16, 2023
f3bf5a4
display the whole graph
yp05327 Nov 16, 2023
f0ef0f3
improve avatar
yp05327 Nov 16, 2023
8552c9e
convert click into double click
yp05327 Nov 16, 2023
1f3b9f8
Apply suggestions from code review
sahinakkaya Nov 16, 2023
ade291c
Merge pull request #3 from yp05327/pr27882
sahinakkaya Nov 16, 2023
dec493b
Fix max chart value
sahinakkaya Nov 19, 2023
34be281
Merge remote-tracking branch 'upstream/main' into contributors-graph
sahinakkaya Nov 19, 2023
2665147
Use drag to zoom
sahinakkaya Nov 19, 2023
bc04a82
Add instructions on how to zoom pan etc.
sahinakkaya Nov 19, 2023
8de2f7d
Fix title
sahinakkaya Nov 19, 2023
cbd51b3
Merge branch 'main' into contributors-graph
silverwind Nov 20, 2023
44311a0
Merge remote-tracking branch 'upstream/main' into contributors-graph
sahinakkaya Nov 21, 2023
e43e6b9
generate swagger
sahinakkaya Nov 21, 2023
20b6bb7
fmt
sahinakkaya Nov 21, 2023
fab3f83
Merge remote-tracking branch 'upstream/main' into contributors-graph
sahinakkaya Nov 24, 2023
07794ca
Merge branch 'main' into contributors-graph
6543 Dec 2, 2023
4834f97
Merge remote-tracking branch 'upstream/main' into contributors-graph
sahinakkaya Dec 12, 2023
d0bca3f
Merge branch 'main' into contributors-graph
6543 Dec 21, 2023
51ea778
Merge remote-tracking branch 'upstream/main' into contributors-graph
sahinakkaya Jan 8, 2024
31f459e
Merge remote-tracking branch 'upstream/main' into contributors-graph
sahinakkaya Jan 22, 2024
c860b02
Fix linting error in swagger file
sahinakkaya Jan 23, 2024
e8a5c57
Target correct dropdown
sahinakkaya Jan 24, 2024
51a9e8d
Move ExtendedCommitStats to service layer
sahinakkaya Jan 24, 2024
7a134de
Merge remote-tracking branch 'upstream/main' into contributors-graph
sahinakkaya Jan 25, 2024
3740877
Remove exposed endpoint as it is not needed by this PR
sahinakkaya Jan 25, 2024
ae47624
Merge remote-tracking branch 'upstream/main' into contributors-graph
sahinakkaya Jan 25, 2024
0f61e59
Move types out from "modules/structs" to not pollute api
sahinakkaya Jan 25, 2024
07eb1d1
Apply suggestions from code review
sahinakkaya Jan 26, 2024
e52db02
Do not render 'a' tag if user is not present on the server
sahinakkaya Jan 26, 2024
cd23a86
Fix linting error
sahinakkaya Jan 26, 2024
7c91b21
Merge branch 'main' into contributors-graph
silverwind Jan 27, 2024
3216a74
Merge remote-tracking branch 'upstream/main' into contributors-graph
sahinakkaya Feb 1, 2024
9b337dc
Adopt changes in upstream
sahinakkaya Feb 1, 2024
63cf7f2
Merge remote-tracking branch 'upstream/main' into contributors-graph
sahinakkaya Feb 1, 2024
48f175c
Merge remote-tracking branch 'upstream/main' into contributors-graph
sahinakkaya Feb 4, 2024
ae97fbd
Merge remote-tracking branch 'upstream/main' into contributors-graph
sahinakkaya Feb 4, 2024
6094559
Merge remote-tracking branch 'upstream/main' into contributors-graph
sahinakkaya Feb 7, 2024
93987ca
Merge branch 'main' into contributors-graph
6543 Feb 10, 2024
6e87cd8
unexport internal used func
6543 Feb 10, 2024
09a9c62
fix nil pointer issue found by test
6543 Feb 10, 2024
e968a8f
unexport another internal used func
6543 Feb 10, 2024
93f9b2b
add test and expected outcome + add some codecoments to be solved
6543 Feb 10, 2024
2b06e09
expand test with total "summary user"
6543 Feb 10, 2024
3ba73e3
Fix linting error
sahinakkaya Feb 11, 2024
1d0eca1
Merge remote-tracking branch 'upstream/main' into contributors-graph
sahinakkaya Feb 11, 2024
ecb412b
Fix implementation to satisfy unit test
sahinakkaya Feb 13, 2024
88c57f9
Merge remote-tracking branch 'upstream/main' into contributors-graph
sahinakkaya Feb 13, 2024
344ed41
Fix linting error
sahinakkaya Feb 13, 2024
09d5d27
fix lint error and use dayjs to get sundays
silverwind Feb 14, 2024
c05d215
refactor property access, remove empty line
silverwind Feb 14, 2024
1c203d1
fix eslint parser error
silverwind Feb 14, 2024
9fb946b
rename 'sundays' to 'startDays' in js, add trailing commas
silverwind Feb 14, 2024
5e51092
Add raw hours to generate timestamps correctly
sahinakkaya Feb 15, 2024
0c53d38
Use current time as end date instead of last commit's time
sahinakkaya Feb 15, 2024
c3f8e93
Fix linting error
sahinakkaya Feb 15, 2024
20520c9
Merge remote-tracking branch 'upstream/main' into contributors-graph
sahinakkaya Feb 15, 2024
ee1de50
extract time-related functions to file and add test for startDaysBetween
silverwind Feb 15, 2024
3b7b636
use better end date
silverwind Feb 15, 2024
eb3c797
Explain issue in comment instead of writing external link
sahinakkaya Feb 15, 2024
316e871
Merge branch 'main' into contributors-graph
6543 Feb 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Create new page
  • Loading branch information
sahinakkaya committed Jun 21, 2023
commit 9fd24bc37df306f5a0ada6dd4ba32c2a225d55e5
2 changes: 2 additions & 0 deletions options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1903,6 +1903,8 @@ activity.git_stats_and_deletions = and
activity.git_stats_deletion_1 = %d deletion
activity.git_stats_deletion_n = %d deletions

contributors = Contributors

search = Search
search.search_repo = Search repository
search.type.tooltip = Search type
Expand Down
3 changes: 3 additions & 0 deletions options/locale/locale_tr-TR.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1850,6 +1850,9 @@ activity.git_stats_and_deletions=ve
activity.git_stats_deletion_1=%d silme oldu
activity.git_stats_deletion_n=%d silme oldu


contributors = Katkıda Bulunanlar

search=Ara
search.search_repo=Depo ara
search.type.tooltip=Arama türü
Expand Down
66 changes: 66 additions & 0 deletions routers/web/repo/contributors.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package repo

import (
"net/http"
"time"

activities_model "code.gitea.io/gitea/models/activities"
"code.gitea.io/gitea/models/unit"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/context"
)

const (
tplContributors base.TplName = "repo/contributors"
)

// Contributors render the page to show repository contributors graph
func Contributors(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.activity")
ctx.Data["PageIsContributors"] = true

ctx.Data["Period"] = ctx.Params("period")

timeUntil := time.Now()
var timeFrom time.Time

switch ctx.Data["Period"] {
case "daily":
timeFrom = timeUntil.Add(-time.Hour * 24)
case "halfweekly":
timeFrom = timeUntil.Add(-time.Hour * 72)
case "weekly":
timeFrom = timeUntil.Add(-time.Hour * 168)
case "monthly":
timeFrom = timeUntil.AddDate(0, -1, 0)
case "quarterly":
timeFrom = timeUntil.AddDate(0, -3, 0)
case "semiyearly":
timeFrom = timeUntil.AddDate(0, -6, 0)
case "yearly":
timeFrom = timeUntil.AddDate(-1, 0, 0)
default:
ctx.Data["Period"] = "weekly"
timeFrom = timeUntil.Add(-time.Hour * 168)
}
ctx.Data["DateFrom"] = timeFrom.UTC().Format(time.RFC3339)
ctx.Data["DateUntil"] = timeUntil.UTC().Format(time.RFC3339)
ctx.Data["PeriodText"] = ctx.Tr("repo.activity.period." + ctx.Data["Period"].(string))

var err error
if ctx.Data["Activity"], err = activities_model.GetActivityStats(ctx, ctx.Repo.Repository, timeFrom,
ctx.Repo.CanRead(unit.TypeReleases),
ctx.Repo.CanRead(unit.TypeIssues),
ctx.Repo.CanRead(unit.TypePullRequests),
ctx.Repo.CanRead(unit.TypeCode)); err != nil {
ctx.ServerError("GetActivityStats", err)
return
}

if ctx.PageData["repoActivityTopAuthors"], err = activities_model.GetActivityStatsTopAuthors(ctx, ctx.Repo.Repository, timeFrom, 10); err != nil {
ctx.ServerError("GetActivityStatsTopAuthors", err)
return
}

ctx.HTML(http.StatusOK, tplContributors)
}
5 changes: 5 additions & 0 deletions routers/web/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -1244,6 +1244,11 @@ func registerRoutes(m *web.Route) {
m.Get("/{period}", repo.ActivityAuthors)
}, context.RepoRef(), repo.MustBeNotEmpty, context.RequireRepoReaderOr(unit.TypeCode))

m.Group("/contributors", func() {
m.Get("", repo.Contributors)
m.Get("/{period}", repo.Contributors)
}, context.RepoRef(), repo.MustBeNotEmpty, context.RequireRepoReaderOr(unit.TypePullRequests, unit.TypeIssues, unit.TypeReleases))

m.Group("/archive", func() {
m.Get("/*", repo.Download)
m.Post("/*", repo.InitiateDownload)
Expand Down
242 changes: 242 additions & 0 deletions templates/repo/contributors.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,242 @@
{{template "base/head" .}}
<div role="main" aria-label="{{.Title}}" class="page-content repository commits">
{{template "repo/header" .}}
<p>Contributors</p>
<div class="ui container">
<h2 class="ui header">{{DateTime "long" .DateFrom}} - {{DateTime "long" .DateUntil}}
<div class="ui right">
<!-- Period -->
<div class="ui floating dropdown jump filter">
<div class="ui basic compact button">
<span class="text">
{{.locale.Tr "repo.activity.period.filter_label"}} <strong>{{.PeriodText}}</strong>
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
</span>
</div>
<div class="menu">
<a class="{{if eq .Period "daily"}}active {{end}}item" href="{{$.RepoLink}}/activity/daily">{{.locale.Tr "repo.activity.period.daily"}}</a>
<a class="{{if eq .Period "halfweekly"}}active {{end}}item" href="{{$.RepoLink}}/activity/halfweekly">{{.locale.Tr "repo.activity.period.halfweekly"}}</a>
<a class="{{if eq .Period "weekly"}}active {{end}}item" href="{{$.RepoLink}}/activity/weekly">{{.locale.Tr "repo.activity.period.weekly"}}</a>
<a class="{{if eq .Period "monthly"}}active {{end}}item" href="{{$.RepoLink}}/activity/monthly">{{.locale.Tr "repo.activity.period.monthly"}}</a>
<a class="{{if eq .Period "quarterly"}}active {{end}}item" href="{{$.RepoLink}}/activity/quarterly">{{.locale.Tr "repo.activity.period.quarterly"}}</a>
<a class="{{if eq .Period "semiyearly"}}active {{end}}item" href="{{$.RepoLink}}/activity/semiyearly">{{.locale.Tr "repo.activity.period.semiyearly"}}</a>
<a class="{{if eq .Period "yearly"}}active {{end}}item" href="{{$.RepoLink}}/activity/yearly">{{.locale.Tr "repo.activity.period.yearly"}}</a>
</div>
</div>
</div>
</h2>
<div class="ui divider"></div>

{{if (or (.Permission.CanRead $.UnitTypeIssues) (.Permission.CanRead $.UnitTypePullRequests))}}
<h4 class="ui top attached header">{{.locale.Tr "repo.activity.overview"}}</h4>
<div class="ui attached segment two column grid">
{{if .Permission.CanRead $.UnitTypePullRequests}}
<div class="column">
{{if gt .Activity.ActivePRCount 0}}
<div class="stats-table">
<a href="#merged-pull-requests" class="table-cell tiny background purple" style="width: {{.Activity.MergedPRPerc}}{{if ne .Activity.MergedPRPerc 0}}%{{end}}"></a>
<a href="#proposed-pull-requests" class="table-cell tiny background green"></a>
</div>
{{else}}
<div class="stats-table">
<a class="table-cell tiny background light grey"></a>
</div>
{{end}}
{{.locale.TrN .Activity.ActivePRCount "repo.activity.active_prs_count_1" "repo.activity.active_prs_count_n" .Activity.ActivePRCount | Safe}}
</div>
{{end}}
{{if .Permission.CanRead $.UnitTypeIssues}}
<div class="column">
{{if gt .Activity.ActiveIssueCount 0}}
<div class="stats-table">
<a href="#closed-issues" class="table-cell tiny background red" style="width: {{.Activity.ClosedIssuePerc}}{{if ne .Activity.ClosedIssuePerc 0}}%{{end}}"></a>
<a href="#new-issues" class="table-cell tiny background green"></a>
</div>
{{else}}
<div class="stats-table">
<a class="table-cell tiny background light grey"></a>
</div>
{{end}}
{{.locale.TrN .Activity.ActiveIssueCount "repo.activity.active_issues_count_1" "repo.activity.active_issues_count_n" .Activity.ActiveIssueCount | Safe}}
</div>
{{end}}
</div>
<div class="ui attached segment horizontal segments">
{{if .Permission.CanRead $.UnitTypePullRequests}}
<a href="#merged-pull-requests" class="ui attached segment text center">
<span class="text purple">{{svg "octicon-git-pull-request"}}</span> <strong>{{.Activity.MergedPRCount}}</strong><br>
{{.locale.TrN .Activity.MergedPRCount "repo.activity.merged_prs_count_1" "repo.activity.merged_prs_count_n"}}
</a>
<a href="#proposed-pull-requests" class="ui attached segment text center">
<span class="text green">{{svg "octicon-git-branch"}}</span> <strong>{{.Activity.OpenedPRCount}}</strong><br>
{{.locale.TrN .Activity.OpenedPRCount "repo.activity.opened_prs_count_1" "repo.activity.opened_prs_count_n"}}
</a>
{{end}}
{{if .Permission.CanRead $.UnitTypeIssues}}
<a href="#closed-issues" class="ui attached segment text center">
<span class="text red">{{svg "octicon-issue-closed"}}</span> <strong>{{.Activity.ClosedIssueCount}}</strong><br>
{{.locale.TrN .Activity.ClosedIssueCount "repo.activity.closed_issues_count_1" "repo.activity.closed_issues_count_n"}}
</a>
<a href="#new-issues" class="ui attached segment text center">
<span class="text green">{{svg "octicon-issue-opened"}}</span> <strong>{{.Activity.OpenedIssueCount}}</strong><br>
{{.locale.TrN .Activity.OpenedIssueCount "repo.activity.new_issues_count_1" "repo.activity.new_issues_count_n"}}
</a>
{{end}}
</div>
{{end}}

{{if .Permission.CanRead $.UnitTypeCode}}
{{if eq .Activity.Code.CommitCountInAllBranches 0}}
<div class="ui center aligned segment">
<h4 class="ui header">{{.locale.Tr "repo.activity.no_git_activity"}}</h4>
</div>
{{end}}
{{if gt .Activity.Code.CommitCountInAllBranches 0}}
<div class="ui attached segment horizontal segments">
<div class="ui attached segment text">
{{.locale.Tr "repo.activity.git_stats_exclude_merges"}}
<strong>{{.locale.TrN .Activity.Code.AuthorCount "repo.activity.git_stats_author_1" "repo.activity.git_stats_author_n" .Activity.Code.AuthorCount}}</strong>
{{.locale.TrN .Activity.Code.AuthorCount "repo.activity.git_stats_pushed_1" "repo.activity.git_stats_pushed_n"}}
<strong>{{.locale.TrN .Activity.Code.CommitCount "repo.activity.git_stats_commit_1" "repo.activity.git_stats_commit_n" .Activity.Code.CommitCount}}</strong>
{{.locale.Tr "repo.activity.git_stats_push_to_branch" .Repository.DefaultBranch}}
<strong>{{.locale.TrN .Activity.Code.CommitCountInAllBranches "repo.activity.git_stats_commit_1" "repo.activity.git_stats_commit_n" .Activity.Code.CommitCountInAllBranches}}</strong>
{{.locale.Tr "repo.activity.git_stats_push_to_all_branches"}}
{{.locale.Tr "repo.activity.git_stats_on_default_branch" .Repository.DefaultBranch}}
<strong>{{.locale.TrN .Activity.Code.ChangedFiles "repo.activity.git_stats_file_1" "repo.activity.git_stats_file_n" .Activity.Code.ChangedFiles}}</strong>
{{.locale.TrN .Activity.Code.ChangedFiles "repo.activity.git_stats_files_changed_1" "repo.activity.git_stats_files_changed_n"}}
{{.locale.Tr "repo.activity.git_stats_additions"}}
<strong class="text green">{{.locale.TrN .Activity.Code.Additions "repo.activity.git_stats_addition_1" "repo.activity.git_stats_addition_n" .Activity.Code.Additions}}</strong>
{{.locale.Tr "repo.activity.git_stats_and_deletions"}}
<strong class="text red">{{.locale.TrN .Activity.Code.Deletions "repo.activity.git_stats_deletion_1" "repo.activity.git_stats_deletion_n" .Activity.Code.Deletions}}</strong>.
</div>
<div class="ui attached segment">
<div id="repo-activity-top-authors-chart"></div>
</div>
</div>
{{end}}
{{end}}

{{if gt .Activity.PublishedReleaseCount 0}}
<h4 class="ui horizontal divider header" id="published-releases">
<span class="text">{{svg "octicon-tag"}}</span>
{{.locale.Tr "repo.activity.title.releases_published_by"
(.locale.TrN .Activity.PublishedReleaseCount "repo.activity.title.releases_1" "repo.activity.title.releases_n" .Activity.PublishedReleaseCount)
(.locale.TrN .Activity.PublishedReleaseAuthorCount "repo.activity.title.user_1" "repo.activity.title.user_n" .Activity.PublishedReleaseAuthorCount)
}}
</h4>
<div class="list">
{{range .Activity.PublishedReleases}}
<p class="desc">
<span class="ui green label">{{$.locale.Tr "repo.activity.published_release_label"}}</span>
{{.TagName}}
{{if not .IsTag}}
<a class="title" href="{{$.RepoLink}}/src/{{.TagName | PathEscapeSegments}}">{{.Title | RenderEmoji $.Context}}</a>
{{end}}
{{TimeSinceUnix .CreatedUnix $.locale}}
</p>
{{end}}
</div>
{{end}}

{{if gt .Activity.MergedPRCount 0}}
<h4 class="ui horizontal divider header" id="merged-pull-requests">
<span class="text">{{svg "octicon-git-pull-request"}}</span>
{{.locale.Tr "repo.activity.title.prs_merged_by"
(.locale.TrN .Activity.MergedPRCount "repo.activity.title.prs_1" "repo.activity.title.prs_n" .Activity.MergedPRCount)
(.locale.TrN .Activity.MergedPRAuthorCount "repo.activity.title.user_1" "repo.activity.title.user_n" .Activity.MergedPRAuthorCount)
}}
</h4>
<div class="list">
{{range .Activity.MergedPRs}}
<p class="desc">
<span class="ui purple label">{{$.locale.Tr "repo.activity.merged_prs_label"}}</span>
#{{.Index}} <a class="title" href="{{$.RepoLink}}/pulls/{{.Index}}">{{.Issue.Title | RenderEmoji $.Context}}</a>
{{TimeSinceUnix .MergedUnix $.locale}}
</p>
{{end}}
</div>
{{end}}

{{if gt .Activity.OpenedPRCount 0}}
<h4 class="ui horizontal divider header" id="proposed-pull-requests">
<span class="text">{{svg "octicon-git-branch"}}</span>
{{.locale.Tr "repo.activity.title.prs_opened_by"
(.locale.TrN .Activity.OpenedPRCount "repo.activity.title.prs_1" "repo.activity.title.prs_n" .Activity.OpenedPRCount)
(.locale.TrN .Activity.OpenedPRAuthorCount "repo.activity.title.user_1" "repo.activity.title.user_n" .Activity.OpenedPRAuthorCount)
}}
</h4>
<div class="list">
{{range .Activity.OpenedPRs}}
<p class="desc">
<span class="ui green label">{{$.locale.Tr "repo.activity.opened_prs_label"}}</span>
#{{.Index}} <a class="title" href="{{$.RepoLink}}/pulls/{{.Index}}">{{.Issue.Title | RenderEmoji $.Context}}</a>
{{TimeSinceUnix .Issue.CreatedUnix $.locale}}
</p>
{{end}}
</div>
{{end}}

{{if gt .Activity.ClosedIssueCount 0}}
<h4 class="ui horizontal divider header" id="closed-issues">
<span class="text">{{svg "octicon-issue-closed"}}</span>
{{.locale.Tr "repo.activity.title.issues_closed_from"
(.locale.TrN .Activity.ClosedIssueCount "repo.activity.title.issues_1" "repo.activity.title.issues_n" .Activity.ClosedIssueCount)
(.locale.TrN .Activity.ClosedIssueAuthorCount "repo.activity.title.user_1" "repo.activity.title.user_n" .Activity.ClosedIssueAuthorCount)
}}
</h4>
<div class="list">
{{range .Activity.ClosedIssues}}
<p class="desc">
<span class="ui red label">{{$.locale.Tr "repo.activity.closed_issue_label"}}</span>
#{{.Index}} <a class="title" href="{{$.RepoLink}}/issues/{{.Index}}">{{.Title | RenderEmoji $.Context}}</a>
{{TimeSinceUnix .ClosedUnix $.locale}}
</p>
{{end}}
</div>
{{end}}

{{if gt .Activity.OpenedIssueCount 0}}
<h4 class="ui horizontal divider header" id="new-issues">
<span class="text">{{svg "octicon-issue-opened"}}</span>
{{.locale.Tr "repo.activity.title.issues_created_by"
(.locale.TrN .Activity.OpenedIssueCount "repo.activity.title.issues_1" "repo.activity.title.issues_n" .Activity.OpenedIssueCount)
(.locale.TrN .Activity.OpenedIssueAuthorCount "repo.activity.title.user_1" "repo.activity.title.user_n" .Activity.OpenedIssueAuthorCount)
}}
</h4>
<div class="list">
{{range .Activity.OpenedIssues}}
<p class="desc">
<span class="ui green label">{{$.locale.Tr "repo.activity.new_issue_label"}}</span>
#{{.Index}} <a class="title" href="{{$.RepoLink}}/issues/{{.Index}}">{{.Title | RenderEmoji $.Context}}</a>
{{TimeSinceUnix .CreatedUnix $.locale}}
</p>
{{end}}
</div>
{{end}}

{{if gt .Activity.UnresolvedIssueCount 0}}
<h4 class="ui horizontal divider header" id="unresolved-conversations">
<span class="text">{{svg "octicon-comment-discussion"}}</span>
{{.locale.TrN .Activity.UnresolvedIssueCount "repo.activity.title.unresolved_conv_1" "repo.activity.title.unresolved_conv_n" .Activity.UnresolvedIssueCount}}
</h4>
<div class="text center desc">
{{.locale.Tr "repo.activity.unresolved_conv_desc"}}
</div>
<div class="list">
{{range .Activity.UnresolvedIssues}}
<p class="desc">
<span class="ui green label">{{$.locale.Tr "repo.activity.unresolved_conv_label"}}</span>
#{{.Index}}
{{if .IsPull}}
<a class="title" href="{{$.RepoLink}}/pulls/{{.Index}}">{{.Title | RenderEmoji $.Context}}</a>
{{else}}
<a class="title" href="{{$.RepoLink}}/issues/{{.Index}}">{{.Title | RenderEmoji $.Context}}</a>
{{end}}
{{TimeSinceUnix .UpdatedUnix $.locale}}
</p>
{{end}}
</div>
{{end}}
</div>
</div>
{{template "base/footer" .}}
6 changes: 6 additions & 0 deletions templates/repo/header.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,12 @@
</a>
{{end}}

{{if and (.Permission.CanReadAny $.UnitTypePullRequests $.UnitTypeIssues $.UnitTypeReleases) (not .IsEmptyRepo)}}
<a class="{{if .PageIsContributors}}active {{end}}item" href="{{.RepoLink}}/contributors">
{{svg "octicon-graph"}} {{.locale.Tr "repo.contributors"}}
</a>
{{end}}

{{template "custom/extra_tabs" .}}

{{if .Permission.IsAdmin}}
Expand Down