mirror of
https://github.com/go-gitea/gitea.git
synced 2024-12-28 16:36:53 +00:00
Added total count of contributions to heatmap (#7517)
* Added total count of contributions to heatmap Signed-off-by: kolaente <k@knt.li> * make css Signed-off-by: kolaente <k@knt.li>
This commit is contained in:
parent
3cba42c43d
commit
be9d67f887
@ -200,6 +200,7 @@ footer .ui.left,footer .ui.right{line-height:40px}
|
|||||||
#user-heatmap svg:not(:root){overflow:inherit;padding:0!important}
|
#user-heatmap svg:not(:root){overflow:inherit;padding:0!important}
|
||||||
@media only screen and (max-width:1200px){#user-heatmap{display:none}
|
@media only screen and (max-width:1200px){#user-heatmap{display:none}
|
||||||
}
|
}
|
||||||
|
#user-heatmap .total-contributions{text-align:left;font-weight:500;margin-top:0}
|
||||||
.heatmap-color-0{background-color:#f4f4f4}
|
.heatmap-color-0{background-color:#f4f4f4}
|
||||||
.heatmap-color-1{background-color:#d7e5db}
|
.heatmap-color-1{background-color:#d7e5db}
|
||||||
.heatmap-color-2{background-color:#adc7ab}
|
.heatmap-color-2{background-color:#adc7ab}
|
||||||
|
@ -2564,7 +2564,8 @@ function initHeatmap(appElementId, heatmapUser, locale) {
|
|||||||
isLoading: true,
|
isLoading: true,
|
||||||
colorRange: [],
|
colorRange: [],
|
||||||
endDate: null,
|
endDate: null,
|
||||||
values: []
|
values: [],
|
||||||
|
totalContributions: 0,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -2587,6 +2588,7 @@ function initHeatmap(appElementId, heatmapUser, locale) {
|
|||||||
$.get(this.suburl + '/api/v1/users/' + userName + '/heatmap', function(chartRawData) {
|
$.get(this.suburl + '/api/v1/users/' + userName + '/heatmap', function(chartRawData) {
|
||||||
const chartData = [];
|
const chartData = [];
|
||||||
for (let i = 0; i < chartRawData.length; i++) {
|
for (let i = 0; i < chartRawData.length; i++) {
|
||||||
|
self.totalContributions += chartRawData[i].contributions;
|
||||||
chartData[i] = { date: new Date(chartRawData[i].timestamp * 1000), count: chartRawData[i].contributions };
|
chartData[i] = { date: new Date(chartRawData[i].timestamp * 1000), count: chartRawData[i].contributions };
|
||||||
}
|
}
|
||||||
self.values = chartData;
|
self.values = chartData;
|
||||||
@ -2607,7 +2609,7 @@ function initHeatmap(appElementId, heatmapUser, locale) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
template: '<div><div v-show="isLoading"><slot name="loading"></slot></div><calendar-heatmap v-show="!isLoading" :locale="locale" :no-data-text="locale.no_contributions" :tooltip-unit="locale.contributions" :end-date="endDate" :values="values" :range-color="colorRange" />'
|
template: '<div><div v-show="isLoading"><slot name="loading"></slot></div><h4 class="total-contributions" v-if="!isLoading"><span v-html="totalContributions"></span> total contributions in the last 12 months</h4><calendar-heatmap v-show="!isLoading" :locale="locale" :no-data-text="locale.no_contributions" :tooltip-unit="locale.contributions" :end-date="endDate" :values="values" :range-color="colorRange" />'
|
||||||
});
|
});
|
||||||
|
|
||||||
new Vue({
|
new Vue({
|
||||||
|
@ -842,6 +842,12 @@ footer {
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.total-contributions {
|
||||||
|
text-align: left;
|
||||||
|
font-weight: 500;
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.heatmap-color-0 {
|
.heatmap-color-0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user