Display create date and last activity in admin area

master
Daniel Berteaud 10 years ago
parent 79814f9ce5
commit 244bafe336
  1. 15
      public/js/vroom.js
  2. 6
      templates/default/admin.html.ep

@ -157,6 +157,15 @@ function timeStamp2Date(sec){
return d.toLocaleString(); return d.toLocaleString();
} }
// Convert dates from UTC to local TZ
function utc2Local(date) {
var newDate = new Date(date.getTime()+date.getTimezoneOffset()*60*1000);
var offset = date.getTimezoneOffset() / 60;
var hours = date.getHours();
newDate.setHours(hours - offset);
return newDate;
}
// Temporarily suspend a button, prevent abuse // Temporarily suspend a button, prevent abuse
function suspendButton(el){ function suspendButton(el){
$(el).attr('disabled', true); $(el).attr('disabled', true);
@ -395,8 +404,14 @@ function initAdmin(){
if (filter === '' || obj.name.match(filterRe)){ if (filter === '' || obj.name.match(filterRe)){
matches++; matches++;
if (i >= min && i < max){ if (i >= min && i < max){
var t = obj.create_date.split(/[- :]/);
var create = utc2Local(new Date(t[0], t[1]-1, t[2], t[3], t[4], t[5])).toLocaleString();
t = obj.last_activity.split(/[- :]/);
var activity = utc2Local(new Date(t[0], t[1]-1, t[2], t[3], t[4], t[5])).toLocaleString();
$('#roomList').append($('<tr>') $('#roomList').append($('<tr>')
.append($('<td>').html(stringEscape(obj.name))) .append($('<td>').html(stringEscape(obj.name)))
.append($('<td>').html(stringEscape(create)).addClass('hidden-xs'))
.append($('<td>').html(stringEscape(activity)).addClass('hidden-xs'))
.append($('<td>') .append($('<td>')
.append($('<div>').addClass('btn-group') .append($('<div>').addClass('btn-group')
.append($('<a>').addClass('btn btn-default').attr('href',rootUrl + obj.name) .append($('<a>').addClass('btn btn-default').attr('href',rootUrl + obj.name)

@ -28,6 +28,12 @@
<th> <th>
<%=l 'ROOM_NAME' %> <%=l 'ROOM_NAME' %>
</th> </th>
<th class="hidden-xs">
<%=l 'CREATION_DATE' %>
</th>
<th class="hidden-xs">
<%=l 'LAST_ACTIVITY' %>
</th>
<th> <th>
<%=l 'MANAGE' %> <%=l 'MANAGE' %>
</th> </th>

Loading…
Cancel
Save