Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfredo Sumaran <alfredo@gitlab.com>2016-04-07 20:02:43 +0300
committerAlfredo Sumaran <alfredo@gitlab.com>2016-04-07 20:02:43 +0300
commit3440c0e61f570e9f42a81fb125a021b138b5bebc (patch)
tree7e07d05798a7831cce6f93ac6dd9232ec0d597b9 /app/assets/javascripts/notes.js.coffee
parentb19ccdeed45605a7bb79509092b297087d6c6e8c (diff)
Update datetime in .timeago elements
This should be done before .timeago() is called on the element
Diffstat (limited to 'app/assets/javascripts/notes.js.coffee')
-rw-r--r--app/assets/javascripts/notes.js.coffee17
1 files changed, 15 insertions, 2 deletions
diff --git a/app/assets/javascripts/notes.js.coffee b/app/assets/javascripts/notes.js.coffee
index 86e3b860fcb..02e52040e3c 100644
--- a/app/assets/javascripts/notes.js.coffee
+++ b/app/assets/javascripts/notes.js.coffee
@@ -163,9 +163,16 @@ class @Notes
else if @isNewNote(note)
@note_ids.push(note.id)
- $('ul.main-notes-list')
+ $notesList = $('ul.main-notes-list')
+
+ $notesList
.append(note.html)
.syntaxHighlight()
+
+ # Update datetime format on the recent note
+ $timeago = $notesList.find("#note_#{note.id} .js-timeago")
+ gl.utils.updateFormatDate($timeago)
+
@initTaskList()
@updateNotesCount(1)
@@ -217,6 +224,8 @@ class @Notes
# append new note to all matching discussions
discussionContainer.append note_html
+ gl.utils.updateFormatDate($('.js-timeago', note_html))
+
@updateNotesCount(1)
###
@@ -345,7 +354,11 @@ class @Notes
updateNote: (_xhr, note, _status) =>
# Convert returned HTML to a jQuery object so we can modify it further
$html = $(note.html)
- $('.js-timeago', $html).timeago()
+
+ $timeago = $('.js-timeago', $html)
+ gl.utils.updateFormatDate($timeago)
+ $timeago.timeago()
+
$html.syntaxHighlight()
$html.find('.js-task-list-container').taskList('enable')