Skip to content

Commit b6c9191

Browse files
committed
fix
1 parent 06ebae7 commit b6c9191

File tree

4 files changed

+12
-17
lines changed

4 files changed

+12
-17
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

+10-11
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ import {sleep} from '../utils.js';
2323
import 'chartjs-adapter-dayjs-4/dist/chartjs-adapter-dayjs-4.esm';
2424
import $ from 'jquery';
2525
26-
const {pageData} = window.config;
27-
2826
const customEventListener = {
2927
id: 'customEventListener',
3028
afterEvent: (chart, args, opts) => {
@@ -59,14 +57,17 @@ export default {
5957
type: Object,
6058
required: true,
6159
},
60+
repoLink: {
61+
type: String,
62+
required: true,
63+
},
6264
},
6365
data: () => ({
6466
isLoading: false,
6567
errorText: '',
6668
totalStats: {},
6769
sortedContributors: {},
68-
repoLink: pageData.repoLink || [],
69-
type: pageData.contributionType,
70+
type: 'commits',
7071
contributorsStats: [],
7172
xAxisStart: null,
7273
xAxisEnd: null,
@@ -333,19 +334,17 @@ export default {
333334
<!-- Contribution type -->
334335
<div class="ui dropdown jump" id="repo-contributors">
335336
<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>
337+
<span class="not-mobile">{{ locale.filterLabel }}</span> <strong>{{ locale.contributionType[type] }}</strong>
338+
<svg-icon name="octicon-triangle-down" :size="14"/>
340339
</div>
341340
<div class="menu">
342-
<div :class="['item', {'active': type === 'commits'}]">
341+
<div :class="['item', {'selected': type === 'commits'}]" data-value="commits">
343342
{{ locale.contributionType.commits }}
344343
</div>
345-
<div :class="['item', {'active': type === 'additions'}]">
344+
<div :class="['item', {'selected': type === 'additions'}]" data-value="additions">
346345
{{ locale.contributionType.additions }}
347346
</div>
348-
<div :class="['item', {'active': type === 'deletions'}]">
347+
<div :class="['item', {'selected': type === 'deletions'}]" data-value="deletions">
349348
{{ locale.contributionType.deletions }}
350349
</div>
351350
</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)