Index: Tools/GardeningServer/ui/ct-last-updated.html |
diff --git a/Tools/GardeningServer/ui/ct-last-updated.html b/Tools/GardeningServer/ui/ct-last-updated.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..25cfab2db18f6dc26d402ea510339b92d80f2174 |
--- /dev/null |
+++ b/Tools/GardeningServer/ui/ct-last-updated.html |
@@ -0,0 +1,46 @@ |
+<!-- |
+Copyright 2014 The Chromium Authors. All rights reserved. |
+Use of this source code is governed by a BSD-style license that can be |
+found in the LICENSE file. |
+--> |
+ |
+<polymer-element name="ct-last-updated" attributes="date"> |
ojan
2014/08/08 06:05:13
Please add a test for this. It's confusing because
teravest
2014/08/08 22:21:28
Done.
|
+ <template> |
+ <style> |
+ :host { |
+ display: flex; |
ojan
2014/08/08 06:05:13
I don't think you need this element to be a flexbo
teravest
2014/08/08 22:21:28
Removed.
|
+ } |
+ |
+ .message { |
+ flex: 1; |
+ overflow: hidden; |
+ text-overflow: ellipsis; |
+ white-space: nowrap; |
ojan
2014/08/08 06:05:12
It's tricky deciding where to put which CSS stylin
teravest
2014/08/08 22:21:28
I've removed the styling here.
|
+ } |
+ |
+ </style> |
+ <div class="message">Updated {{ delta_min }} min ago @ {{ date_hours }}:{{ date_minutes }}.</div> |
ojan
2014/08/08 06:05:12
I don't think this wrapper div is needed.
teravest
2014/08/08 22:21:28
Removed.
|
+ </template> |
+ <script> |
+ (function() { |
+ Polymer({ |
+ date: 0, // seconds from epoch |
+ delta_min: 0, |
+ date_hours: 0, |
+ date_minutes: 0, |
+ |
+ dateChanged: function() { |
+ this.update(); |
+ }, |
+ |
+ update: function() { |
ojan
2014/08/08 06:05:13
You don't need the update function. Better is to l
teravest
2014/08/08 22:21:28
That's much better, thanks!
|
+ this.delta_min = Math.floor(((Date.now() / 1000) - this.date) / 60); |
+ this.date_hours = new Date(this.date * 1000).getHours(); |
+ this.date_minutes = new Date(this.date * 1000).getMinutes(); |
ojan
2014/08/08 06:05:12
sugarjs, which we include, has nice methods to get
teravest
2014/08/08 22:21:27
Excellent. Done.
|
+ }, |
+ |
+ }); |
+ })(); |
+ |
+ </script> |
+</polymer-element> |