Add timeago js library to show in the start_time of recordings

This commit is contained in:
Leonardo Crauss Daronco
2016-12-09 11:50:09 -02:00
parent 04ae45e4f4
commit 6726504ec3
5 changed files with 20 additions and 13 deletions

View File

@ -18,6 +18,7 @@
//= require jquery-ui
//= require dataTables/jquery.dataTables
//= require dataTables/bootstrap/3/jquery.dataTables.bootstrap
//= require rails-timeago-all
//= require bootstrap-sprockets
//= require turbolinks
//= require_self

View File

@ -45,10 +45,13 @@ class @Recordings
targets: 0,
render: (data, type, row) ->
if type == 'display'
return new Date(data)
date = new Date(data)
title = date
.toLocaleString($('html').attr('lang'),
{month: 'long', day: 'numeric', year: 'numeric',
hour12: 'true', hour: '2-digit', minute: '2-digit'})
timeago = '<time datetime="'+date.toISOString()+'" data-time-ago="'+date.toISOString()+'">'+date.toISOString()+'</time>'
return title+'<span class="timeago">('+timeago+')</span>'
return data
},
{
@ -194,7 +197,7 @@ class @Recordings
btn.prop('disabled', false)
)
this.table.on 'click', '.recording-delete', (event) ->
@getTable().on 'click', '.recording-delete', (event) ->
btn = $(this)
row = table_api.row($(this).closest('tr')).data()
url = $('.meeting-url').val()
@ -209,6 +212,9 @@ class @Recordings
btn.prop('disabled', false)
)
@getTable().on 'draw.dt', (event) ->
$('time[data-time-ago]').timeago();
getTable: ->
@table