Skip to content
Snippets Groups Projects
Commit 38a4f5ce authored by Alfredo Sumaran's avatar Alfredo Sumaran
Browse files

Rename method and initialize .timeago inside

parent 3440c0e6
Branches
Tags
1 merge request!3497Fix datetimes on tooltips
Pipeline #
Loading
Loading
@@ -164,9 +164,7 @@ $ ->
$('.trigger-submit').on 'change', ->
$(@).parents('form').submit()
 
$timeago = $('abbr.timeago, .js-timeago')
gl.utils.updateFormatDate($timeago)
$timeago.timeago()
gl.utils.localTimeAgo($('abbr.timeago, .js-timeago'), false)
 
# Flash
if (flash = $(".flash-container")).length > 0
Loading
Loading
Loading
Loading
@@ -6,10 +6,12 @@
w.gl.utils.formatDate = (datetime) ->
dateFormat(datetime, 'mmm d, yyyy h:MMtt Z')
 
w.gl.utils.updateFormatDate = ($timeagoEls) ->
w.gl.utils.localTimeAgo = ($timeagoEls, setTimeago = true) ->
$timeagoEls.each( ->
$el = $(@)
$el.attr('title', gl.utils.formatDate($el.attr('datetime')))
)
 
$timeagoEls.timeago() if setTimeago
) window
Loading
Loading
@@ -141,9 +141,7 @@ class @MergeRequestTabs
url: "#{source}.json"
success: (data) =>
document.querySelector("div#commits").innerHTML = data.html
$timeago = $('.js-timeago', 'div#commits')
gl.utils.updateFormatDate($timeago)
$timeago.timeago()
gl.utils.localTimeAgo($('.js-timeago', 'div#commits'))
@commitsLoaded = true
@scrollToElement("#commits")
 
Loading
Loading
@@ -154,9 +152,7 @@ class @MergeRequestTabs
url: "#{source}.json" + @_location.search
success: (data) =>
document.querySelector("div#diffs").innerHTML = data.html
$timeago = $('.js-timeago', 'div#diffs')
gl.utils.updateFormatDate($timeago)
$timeago.timeago()
gl.utils.localTimeAgo($('.js-timeago', 'div#diffs'))
$('div#diffs .js-syntax-highlight').syntaxHighlight()
@expandViewContainer() if @diffViewType() is 'parallel'
@diffsLoaded = true
Loading
Loading
@@ -169,9 +165,7 @@ class @MergeRequestTabs
url: "#{source}.json"
success: (data) =>
document.querySelector("div#builds").innerHTML = data.html
$timeago = $('.js-timeago', 'div#builds')
gl.utils.updateFormatDate($timeago)
$timeago.timeago()
gl.utils.localTimeAgo($('.js-timeago', 'div#builds'))
@buildsLoaded = true
@scrollToElement("#builds")
 
Loading
Loading
Loading
Loading
@@ -170,8 +170,7 @@ class @Notes
.syntaxHighlight()
 
# Update datetime format on the recent note
$timeago = $notesList.find("#note_#{note.id} .js-timeago")
gl.utils.updateFormatDate($timeago)
gl.utils.localTimeAgo($notesList.find("#note_#{note.id} .js-timeago"), false)
 
@initTaskList()
@updateNotesCount(1)
Loading
Loading
@@ -224,7 +223,7 @@ class @Notes
# append new note to all matching discussions
discussionContainer.append note_html
 
gl.utils.updateFormatDate($('.js-timeago', note_html))
gl.utils.localTimeAgo($('.js-timeago', note_html), false)
 
@updateNotesCount(1)
 
Loading
Loading
@@ -355,9 +354,7 @@ class @Notes
# Convert returned HTML to a jQuery object so we can modify it further
$html = $(note.html)
 
$timeago = $('.js-timeago', $html)
gl.utils.updateFormatDate($timeago)
$timeago.timeago()
gl.utils.localTimeAgo($('.js-timeago', $html))
 
$html.syntaxHighlight()
$html.find('.js-task-list-container').taskList('enable')
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment