-
Notifications
You must be signed in to change notification settings - Fork 4
/
contact-list.html
61 lines (52 loc) · 1.55 KB
/
contact-list.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
<link rel="import" href="components/polymer/polymer.html">
<link rel="import" href="post-service/post-service.html">
<link rel="import" href="contact-card.html">
<polymer-element name="contact-list" attributes="show">
<template>
<style>
:host {
display: block;
width: 100%;
}
contact-card {
margin-bottom: 20px;
}
contact-card .name {
margin: 0;
}
contact-card .phone {
margin-top: 0.5em;
font-size: .9rem;
}
contact-card .detail {
padding-left: 1rem;
}
</style>
<post-service id="service" contacts="{{contacts}}">
</post-service>
<div layout vertical center>
<template repeat="{{contact in contacts}}">
<contact-card layout horizontal
favorite="{{contact.favorite}}"
on-favorite-tap="{{handleFavorite}}"
hidden?="{{show == 'favorites' && !contact.favorite}}">
<div flex>
<img src="{{contact.avatar}}" width="70" height="70">
</div>
<div flex three class="detail">
<h4 class="name">{{ contact.firstname + " " + contact.lastname }}</h4>
<p class="phone"><a href="{{ 'tel:' + contact.phone }}">{{ contact.phone }}</a></p>
</div>
</contact-card>
</template>
</div>
</template>
<script>
Polymer({
handleFavorite: function(event, detail, sender) {
var contact = sender.templateInstance.model.contact;
this.$.service.setFavorite(contact.uid, contact.favorite);
}
});
</script>
</polymer-element>