Bug 1184265 - Make last sync date be relative. r=markh

MozReview-Commit-ID: 2hB9F7Elynh
This commit is contained in:
Edouard Oger
2018-03-20 17:08:16 -04:00
parent f9e8a71128
commit 8578b6545b
12 changed files with 40 additions and 71 deletions

View File

@@ -131,11 +131,20 @@ TabListView.prototype = {
});
},
_updateLastSyncTitle(lastModified, itemNode) {
let lastSync = new Date(lastModified);
let lastSyncTitle = getChromeWindow(this._window).gSync.formatLastSyncDate(lastSync);
itemNode.setAttribute("title", lastSyncTitle);
},
_renderClient(client) {
let itemNode = client.tabs.length ?
this._createClient(client) :
this._createEmptyClient(client);
itemNode.addEventListener("mouseover", () =>
this._updateLastSyncTitle(client.lastModified, itemNode));
this._updateClient(client, itemNode);
let tabsList = itemNode.querySelector(".item-tabs-list");
@@ -154,15 +163,15 @@ TabListView.prototype = {
return itemNode;
},
_createClient(item) {
_createClient() {
return this._doc.importNode(this._clientTemplate.content, true).firstElementChild;
},
_createEmptyClient(item) {
_createEmptyClient() {
return this._doc.importNode(this._emptyClientTemplate.content, true).firstElementChild;
},
_createTab(item) {
_createTab() {
return this._doc.importNode(this._tabTemplate.content, true).firstElementChild;
},
@@ -211,9 +220,7 @@ TabListView.prototype = {
*/
_updateClient(item, itemNode) {
itemNode.setAttribute("id", "item-" + item.id);
let lastSync = new Date(item.lastModified);
let lastSyncTitle = getChromeWindow(this._window).gSync.formatLastSyncDate(lastSync);
itemNode.setAttribute("title", lastSyncTitle);
this._updateLastSyncTitle(item.lastModified, itemNode);
if (item.closed) {
itemNode.classList.add("closed");
} else {