Feature #35: Livestamp implemented

Humanized dates now update automatically when a page is left open for
some time.
This commit is contained in:
Gary Sharp
2014-02-11 16:50:03 +11:00
parent c4cc54d316
commit 7bdbeb6a82
40 changed files with 1395 additions and 1022 deletions
@@ -143,7 +143,13 @@
alert('Unable to retrieve latest network logon date:\n' + response);
$('<span>').addClass('smallMessage').text('[may not be current]').appendTo(span);
} else {
span.attr('title', response.Formatted).text(response.Friendly);
var spanClasses = '',
diff = moment().valueOf() - response.UnixEpoc;
if (diff > 2592000000) // 30 Days
spanClasses = 'error';
else if (diff > 604800000) // 7 Days
spanClasses = 'alert';
span.removeClass('alert error').addClass(spanClasses).attr('title', response.Formatted).text(response.Formatted).livestamp(response.UnixEpoc);
}
});
window.setTimeout(function () {
@@ -372,7 +378,7 @@
@foreach (var db in Model.DeviceBatches.OrderBy(i => i.Name))
{
<li>
<input type="radio" data-devicebatchid="@db.Id" name="DeviceBatch" id="DeviceBatch_@(db.Id)" /><label for="DeviceBatch_@(db.Id)" title="Purchased: @(db.PurchaseDate.FromNow())">@db.Name</label></li>
<input type="radio" data-devicebatchid="@db.Id" name="DeviceBatch" id="DeviceBatch_@(db.Id)" /><label for="DeviceBatch_@(db.Id)" title="Purchased: @(db.PurchaseDate.ToLongDateString())">@db.Name</label></li>
}
</ul>
</div>