Commit 8ef930c4 authored by Jacob Schatz's avatar Jacob Schatz

Merge branch 'contrib-calendar-tooltip-name' into 'master'

Added day name to contributions calendar

## What does this MR do?

Adds the day name text into the contributions calendar tooltip.

## What are the relevant issue numbers?

Closes #19367 

## Screenshots (if relevant)

![Screen_Shot_2016-07-04_at_12.38.52](/uploads/edf6ac3454d479a345aee638875b7713/Screen_Shot_2016-07-04_at_12.38.52.png)

See merge request !5065
parents 0452e0a5 a445630f
......@@ -14,6 +14,7 @@ v 8.10.0 (unreleased)
- Add Sidekiq queue duration to transaction metrics.
- Add a new column `artifacts_size` to table `ci_builds` !4964
- Let Workhorse serve format-patch diffs
- Added day name to contribution calendar tooltips
- Make images fit to the size of the viewport !4810
- Fix check for New Branch button on Issue page !4630 (winniehell)
- Fix MR-auto-close text added to description. !4836
......
......@@ -2,10 +2,14 @@
w.gl ?= {}
w.gl.utils ?= {}
w.gl.utils.days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
w.gl.utils.formatDate = (datetime) ->
dateFormat(datetime, 'mmm d, yyyy h:MMtt Z')
w.gl.utils.getDayName = (date) ->
this.days[date.getDay()]
w.gl.utils.localTimeAgo = ($timeagoEls, setTimeago = true) ->
$timeagoEls.each( ->
$el = $(@)
......
......@@ -87,14 +87,15 @@ class @Calendar
.attr 'width', @daySize
.attr 'height', @daySize
.attr 'title', (stamp) =>
date = new Date(stamp.date)
contribText = 'No contributions'
if stamp.count > 0
contribText = "#{stamp.count} contribution#{if stamp.count > 1 then 's' else ''}"
date = dateFormat(stamp.date, 'mmm d, yyyy')
dateText = dateFormat(date, 'mmm d, yyyy')
"#{contribText}<br />#{date}"
"#{contribText}<br />#{gl.utils.getDayName(date)} #{dateText}"
.attr 'class', 'user-contrib-cell js-tooltip'
.attr 'fill', (stamp) =>
if stamp.count isnt 0
......
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