-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGathr-Photos.html
66 lines (58 loc) · 1.61 KB
/
Gathr-Photos.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<link rel="import" href="../polymer/polymer-element.html">
<link rel="import" href="../iron-ajax/iron-ajax.html">
<!-- Import the styles from the style module my-styles -->
<link rel="import" href="my-styles.html">
<dom-module id="gathr-photos">
<template>
<style include="my-styles"></style>
<style is="custom-style">
</style>
<div class="container-fluid" style="overflow:hidden;">
<table style="overflow:hidden;">
<tr style="overflow:hidden;">
<template is="dom-repeat" items="[[photos]]">
<td style="overflow:hidden;">
<img src="{{item.url}}" class="img img-responsive"/>
</td>
</template>
</tr>
</table>
</div>
<iron-ajax
id="requestPhotos"
url="https://api.gathr.me/v4/photo/photos/token/{{pm}}/?X-API-KEY={{gt}}"
handle-as="json"
on-response="handleResponse">
</iron-ajax>
</template>
<script>
/**
* `Gathr-Photos`
* Gathr Web Component for displaying photos from Gathr.
*
* @customElement
* @polymer
* @demo demo/index.html
*/
Polymer({
is: 'gathr-photos',
properties: {
pm: String,
gt: String,
occassion: {
type: Array
}
},
ready: function () {
this.$.requestPhotos.generateRequest();
},
handleResponse: function (data) {
this.occassion = data.detail.response;
this.photos = []
this.occassion.photos.forEach(function(element) {
this.photos.push(element)
}, this);
}
});
</script>
</dom-module>