forked from External/greenlight
Add timeago js library to show in the start_time of recordings
This commit is contained in:
parent
04ae45e4f4
commit
6726504ec3
1
Gemfile
1
Gemfile
|
@ -61,5 +61,6 @@ gem 'bootstrap-social-rails', '~> 4.12'
|
||||||
gem 'font-awesome-rails'
|
gem 'font-awesome-rails'
|
||||||
gem 'jquery-ui-rails'
|
gem 'jquery-ui-rails'
|
||||||
gem 'jquery-datatables-rails', '~> 3.4.0'
|
gem 'jquery-datatables-rails', '~> 3.4.0'
|
||||||
|
gem 'rails-timeago', '~> 2.0'
|
||||||
|
|
||||||
gem 'http_accept_language'
|
gem 'http_accept_language'
|
||||||
|
|
|
@ -152,6 +152,9 @@ GEM
|
||||||
nokogiri (~> 1.6.0)
|
nokogiri (~> 1.6.0)
|
||||||
rails-html-sanitizer (1.0.3)
|
rails-html-sanitizer (1.0.3)
|
||||||
loofah (~> 2.0)
|
loofah (~> 2.0)
|
||||||
|
rails-timeago (2.15.0)
|
||||||
|
actionpack (>= 3.1)
|
||||||
|
activesupport (>= 3.1)
|
||||||
railties (5.0.0.1)
|
railties (5.0.0.1)
|
||||||
actionpack (= 5.0.0.1)
|
actionpack (= 5.0.0.1)
|
||||||
activesupport (= 5.0.0.1)
|
activesupport (= 5.0.0.1)
|
||||||
|
@ -224,6 +227,7 @@ DEPENDENCIES
|
||||||
omniauth-twitter (= 1.2.1)
|
omniauth-twitter (= 1.2.1)
|
||||||
puma (~> 3.0)
|
puma (~> 3.0)
|
||||||
rails (~> 5.0.0, >= 5.0.0.1)
|
rails (~> 5.0.0, >= 5.0.0.1)
|
||||||
|
rails-timeago (~> 2.0)
|
||||||
sass-rails (~> 5.0)
|
sass-rails (~> 5.0)
|
||||||
spring
|
spring
|
||||||
spring-watcher-listen (~> 2.0.0)
|
spring-watcher-listen (~> 2.0.0)
|
||||||
|
@ -237,4 +241,4 @@ RUBY VERSION
|
||||||
ruby 2.3.1p112
|
ruby 2.3.1p112
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
1.13.5
|
1.13.6
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
//= require jquery-ui
|
//= require jquery-ui
|
||||||
//= require dataTables/jquery.dataTables
|
//= require dataTables/jquery.dataTables
|
||||||
//= require dataTables/bootstrap/3/jquery.dataTables.bootstrap
|
//= require dataTables/bootstrap/3/jquery.dataTables.bootstrap
|
||||||
|
//= require rails-timeago-all
|
||||||
//= require bootstrap-sprockets
|
//= require bootstrap-sprockets
|
||||||
//= require turbolinks
|
//= require turbolinks
|
||||||
//= require_self
|
//= require_self
|
||||||
|
|
|
@ -45,10 +45,13 @@ class @Recordings
|
||||||
targets: 0,
|
targets: 0,
|
||||||
render: (data, type, row) ->
|
render: (data, type, row) ->
|
||||||
if type == 'display'
|
if type == 'display'
|
||||||
return new Date(data)
|
date = new Date(data)
|
||||||
|
title = date
|
||||||
.toLocaleString($('html').attr('lang'),
|
.toLocaleString($('html').attr('lang'),
|
||||||
{month: 'long', day: 'numeric', year: 'numeric',
|
{month: 'long', day: 'numeric', year: 'numeric',
|
||||||
hour12: 'true', hour: '2-digit', minute: '2-digit'})
|
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
|
return data
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -194,7 +197,7 @@ class @Recordings
|
||||||
btn.prop('disabled', false)
|
btn.prop('disabled', false)
|
||||||
)
|
)
|
||||||
|
|
||||||
this.table.on 'click', '.recording-delete', (event) ->
|
@getTable().on 'click', '.recording-delete', (event) ->
|
||||||
btn = $(this)
|
btn = $(this)
|
||||||
row = table_api.row($(this).closest('tr')).data()
|
row = table_api.row($(this).closest('tr')).data()
|
||||||
url = $('.meeting-url').val()
|
url = $('.meeting-url').val()
|
||||||
|
@ -209,6 +212,9 @@ class @Recordings
|
||||||
btn.prop('disabled', false)
|
btn.prop('disabled', false)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@getTable().on 'draw.dt', (event) ->
|
||||||
|
$('time[data-time-ago]').timeago();
|
||||||
|
|
||||||
getTable: ->
|
getTable: ->
|
||||||
@table
|
@table
|
||||||
|
|
||||||
|
|
|
@ -37,16 +37,11 @@
|
||||||
.dataTables_empty {
|
.dataTables_empty {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
.recording-update:hover > {
|
.timeago {
|
||||||
.default {
|
margin-left: 5px;
|
||||||
display: none;
|
font-size: 13px;
|
||||||
}
|
cursor: pointer;
|
||||||
.hover {
|
color: #999;
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.fa.hover {
|
|
||||||
display: none;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue