Commit 723ea707 authored by Fatih Acet's avatar Fatih Acet

Merge branch 'fix-contributions-label-truncation' into 'master'

Fix contributions calendar month label truncation

## What does this MR do?
Expands the width of the contributions calendar by 3px when the last column is a new month to prevent the month label from being truncated

## Are there points in the code the reviewer needs to double check?
Shouldn't be

## Why was this MR needed?
Fixes an existing UI issue

## What are the relevant issue numbers?
Closes #20844 

## Screenshots (if relevant)
Before:
![Screen_Shot_2016-08-11_at_1.24.47_PM](/uploads/682a616a335fffd610342037c41ab9ad/Screen_Shot_2016-08-11_at_1.24.47_PM.png)

After:
![Screen_Shot_2016-08-11_at_1.24.13_PM](/uploads/6e7aa12dd9e3a2c570f1327aaef09fc7/Screen_Shot_2016-08-11_at_1.24.13_PM.png)

## Does this MR meet the acceptance criteria?

- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- Tests
  - [x] All builds are passing
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

See merge request !5779
parents 6690fc70 a958a046
......@@ -58,6 +58,7 @@ v 8.12.0 (unreleased)
- Ability to manage project issues, snippets, wiki, merge requests and builds access level
- Remove inconsistent font weight for sidebar's labels (ClemMakesApps)
- Align add button on repository view (ClemMakesApps)
- Fix contributions calendar month label truncation (ClemMakesApps)
- Added tests for diff notes
- Add a button to download latest successful artifacts for branches and tags !5142
- Remove redundant pipeline tooltips (ClemMakesApps)
......
......@@ -52,8 +52,22 @@
this.initTooltips();
}
// Add extra padding for the last month label if it is also the last column
Calendar.prototype.getExtraWidthPadding = function(group) {
var extraWidthPadding = 0;
var lastColMonth = this.timestampsTmp[group - 1][0].date.getMonth();
var secondLastColMonth = this.timestampsTmp[group - 2][0].date.getMonth();
if (lastColMonth != secondLastColMonth) {
extraWidthPadding = 3;
}
return extraWidthPadding;
}
Calendar.prototype.renderSvg = function(group) {
return this.svg = d3.select('.js-contrib-calendar').append('svg').attr('width', (group + 1) * this.daySizeWithSpace).attr('height', 167).attr('class', 'contrib-calendar');
var width = (group + 1) * this.daySizeWithSpace + this.getExtraWidthPadding(group);
return this.svg = d3.select('.js-contrib-calendar').append('svg').attr('width', width).attr('height', 167).attr('class', 'contrib-calendar');
};
Calendar.prototype.renderDays = function() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment