Browse files

Bug 809974: Display "Last Updated" date and time in Device Info. r=kaze

  • Loading branch information...
1 parent ae5bb15 commit 2827bff7b8328ba43802ba570aa2df4e700e6beb @marshall marshall committed Nov 21, 2012
Showing with 30 additions and 2 deletions.
  1. +2 −2 apps/settings/index.html
  2. +21 −0 apps/settings/js/settings.js
  3. +7 −0 apps/settings/style/settings.css
View
4 apps/settings/index.html
@@ -1750,8 +1750,8 @@ <h1 data-l10n-id="deviceInfo"> Device Information </h1>
</a>
</li>
<li>
- <a id="last-update-date" data-l10n-id="last-updated"> Last Updated
- <span data-name="deviceinfo.last_updated"></span>
+ <a data-l10n-id="last-updated"> Last Updated
+ <span id="last-update-date"><span>
</a>
</li>
<li>
View
21 apps/settings/js/settings.js
@@ -290,6 +290,26 @@ var Settings = {
req.send();
},
+ loadLastUpdated: function settings_loadLastUpdated() {
+ var settings = this.mozSettings;
+ if (!settings) {
+ return;
+ }
+
+ var lastUpdateDate = document.getElementById('last-update-date');
+ var lock = settings.createLock();
+ var key = 'deviceinfo.last_updated';
+ var request = lock.get(key);
+ request.onsuccess = function() {
+ var lastUpdated = request.result[key];
+ var f = new navigator.mozL10n.DateTimeFormat();
+ var _ = navigator.mozL10n.get;
+
+ lastUpdateDate.textContent = f.localeFormat(new Date(lastUpdated),
+ _('shortDateTimeFormat'));
+ };
+ },
+
openDialog: function settings_openDialog(dialogID) {
var settings = this.mozSettings;
var dialog = document.getElementById(dialogID);
@@ -484,6 +504,7 @@ window.addEventListener('load', function loadSettings() {
document.getElementById('ftuLauncher').onclick =
Settings.launchFTU.bind(Settings);
Settings.loadGaiaCommit();
+ Settings.loadLastUpdated();
break;
case 'help': // handle specific link
document.querySelector('[data-l10n-id="user-guide"]').onclick =
View
7 apps/settings/style/settings.css
@@ -227,6 +227,12 @@ ul li > label .range-icons.brightness {
pointer-events: none;
}
+/******************************************************************************
+ * Device Information
+ */
+#last-update-date {
+ font-size: 1.4rem;
+}
/******************************************************************************
* Improve Firefox OS
@@ -259,3 +265,4 @@ html[dir="rtl"] label[for^="pwd"] {
padding-right: 3rem;
}
+

0 comments on commit 2827bff

Please sign in to comment.