-
-
-
+
@@ -124,8 +127,16 @@
},
observers: [
+ "widthChanged(calcWidth)"
],
+ widthChanged: function(calcWidth) {
+ var thumbs = this.$.thumbnails.querySelectorAll("photo-thumbnail");
+ Array.prototype.forEach.call(thumbs, function(thumb) {
+ thumb.width = calcWidth;
+ });
+ },
+
behaviors: [
/* @polymerBehavior Polymer.IronResizableBehavior */
Polymer.IronResizableBehavior
@@ -210,10 +221,25 @@
this.base = "";
}
+ results.items.forEach(function(photo) {
+ var thumbnail = document.createElement("photo-thumbnail");
+ thumbnail.item = photo;
+ thumbnail.width = this.calcWidth;
+ thumbnail.addEventListener("click", this._imageTap.bind(this));
+ var datetime = (photo.taken || photo.modified || photo.added).replace(/T.*$/, "");
+ if (this.lastDate != datetime) {
+ var dateLine = document.createElement("div");
+ dateLine.classList.add("date-line");
+ dateLine.textContent = datetime;
+ this.lastDate = datetime;
+ Polymer.dom(this.$.thumbnails).appendChild(dateLine);
+ }
+
+ Polymer.dom(this.$.thumbnails).appendChild(thumbnail);
+ }.bind(this));
+
if (append) {
- results.items.forEach(function(photo) {
- this.push("photos", photo);
- }.bind(this));
+ this.photos = this.photos.concat(results.items);
} else {
this.photos = results.items;
}