Skip to content

Commit aac9ce7

Browse files
committed
fix
1 parent 06ebae7 commit aac9ce7

File tree

4 files changed

+11
-15
lines changed

4 files changed

+11
-15
lines changed

routers/web/repo/contributors.go

-6
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,8 @@ const (
1919
// Contributors render the page to show repository contributors graph
2020
func Contributors(ctx *context.Context) {
2121
ctx.Data["Title"] = ctx.Tr("repo.activity.navbar.contributors")
22-
2322
ctx.Data["PageIsActivity"] = true
2423
ctx.Data["PageIsContributors"] = true
25-
26-
ctx.PageData["contributionType"] = "commits"
27-
28-
ctx.PageData["repoLink"] = ctx.Repo.RepoLink
29-
3024
ctx.HTML(http.StatusOK, tplContributors)
3125
}
3226

templates/repo/contributors.tmpl

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{{if .Permission.CanRead ctx.Consts.RepoUnitTypeCode}}
22
<div id="repo-contributors-chart"
3+
data-repo-link="{{.RepoLink}}"
34
data-locale-filter-label="{{ctx.Locale.Tr "repo.contributors.contribution_type.filter_label"}}"
45
data-locale-contribution-type-commits="{{ctx.Locale.Tr "repo.contributors.contribution_type.commits"}}"
56
data-locale-contribution-type-additions="{{ctx.Locale.Tr "repo.contributors.contribution_type.additions"}}"

web_src/js/components/RepoContributors.vue

+9-9
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,16 @@ export default {
5959
type: Object,
6060
required: true,
6161
},
62+
repoLink: {
63+
type: String,
64+
}
6265
},
6366
data: () => ({
6467
isLoading: false,
6568
errorText: '',
6669
totalStats: {},
6770
sortedContributors: {},
68-
repoLink: pageData.repoLink || [],
69-
type: pageData.contributionType,
71+
type: 'commits',
7072
contributorsStats: [],
7173
xAxisStart: null,
7274
xAxisEnd: null,
@@ -333,19 +335,17 @@ export default {
333335
<!-- Contribution type -->
334336
<div class="ui dropdown jump" id="repo-contributors">
335337
<div class="ui basic compact button">
336-
<span class="text">
337-
<span class="not-mobile">{{ locale.filterLabel }}&nbsp;</span><strong>{{ locale.contributionType[type] }}</strong>
338-
<svg-icon name="octicon-triangle-down" :size="14"/>
339-
</span>
338+
<span class="not-mobile">{{ locale.filterLabel }}</span> <strong>{{ locale.contributionType[type] }}</strong>
339+
<svg-icon name="octicon-triangle-down" :size="14"/>
340340
</div>
341341
<div class="menu">
342-
<div :class="['item', {'active': type === 'commits'}]">
342+
<div :class="['item', {'selected': type === 'commits'}]" data-value="commits">
343343
{{ locale.contributionType.commits }}
344344
</div>
345-
<div :class="['item', {'active': type === 'additions'}]">
345+
<div :class="['item', {'selected': type === 'additions'}]" data-value="additions">
346346
{{ locale.contributionType.additions }}
347347
</div>
348-
<div :class="['item', {'active': type === 'deletions'}]">
348+
<div :class="['item', {'selected': type === 'deletions'}]" data-value="deletions">
349349
{{ locale.contributionType.deletions }}
350350
</div>
351351
</div>

web_src/js/features/contributors.js

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export async function initRepoContributors() {
77
const {default: RepoContributors} = await import(/* webpackChunkName: "contributors-graph" */'../components/RepoContributors.vue');
88
try {
99
const View = createApp(RepoContributors, {
10+
repoLink: el.getAttribute('data-repo-link'),
1011
locale: {
1112
filterLabel: el.getAttribute('data-locale-filter-label'),
1213
contributionType: {

0 commit comments

Comments
 (0)