abeb4a17
Luigi Serra
Update components...
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<!doctype html>
<html>
<head>
|
eb240478
Luigi Serra
public room cards...
|
15
|
<title>Collapsable items using iron-list</title>
|
abeb4a17
Luigi Serra
Update components...
|
16
17
|
<meta charset="utf-8">
|
a53fbbed
Renato De Donato
select-dataset ne...
|
18
|
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=no">
|
abeb4a17
Luigi Serra
Update components...
|
19
20
21
22
23
24
25
|
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="../../polymer/polymer.html">
<link rel="import" href="../../iron-flex-layout/iron-flex-layout.html">
|
a53fbbed
Renato De Donato
select-dataset ne...
|
26
|
<link rel="import" href="../../app-layout/app-toolbar/app-toolbar.html">
|
eb240478
Luigi Serra
public room cards...
|
27
|
<link rel="import" href="../../paper-icon-button/paper-icon-button.html">
|
a53fbbed
Renato De Donato
select-dataset ne...
|
28
29
|
<link rel="import" href="../../paper-styles/color.html">
<link rel="import" href="../../paper-styles/typography.html">
|
abeb4a17
Luigi Serra
Update components...
|
30
|
<link rel="import" href="../../iron-ajax/iron-ajax.html">
|
abeb4a17
Luigi Serra
Update components...
|
31
|
<link rel="import" href="../../iron-icons/iron-icons.html">
|
a53fbbed
Renato De Donato
select-dataset ne...
|
32
|
<link rel="import" href="../../iron-image/iron-image.html">
|
eb240478
Luigi Serra
public room cards...
|
33
|
<link rel="import" href="../iron-list.html">
|
abeb4a17
Luigi Serra
Update components...
|
34
|
|
a53fbbed
Renato De Donato
select-dataset ne...
|
35
36
37
38
39
40
41
|
<style>
body {
background-color: #eee;
margin: 0;
padding: 0;
}
</style>
|
eb240478
Luigi Serra
public room cards...
|
42
43
|
</head>
<body unresolved>
|
abeb4a17
Luigi Serra
Update components...
|
44
|
|
eb240478
Luigi Serra
public room cards...
|
45
46
|
<dom-module id="x-collapse">
<template>
|
abeb4a17
Luigi Serra
Update components...
|
47
|
<style>
|
abeb4a17
Luigi Serra
Update components...
|
48
|
:host {
|
a53fbbed
Renato De Donato
select-dataset ne...
|
49
|
display: block;
|
eb240478
Luigi Serra
public room cards...
|
50
|
@apply(--paper-font-common-base);
|
abeb4a17
Luigi Serra
Update components...
|
51
52
|
}
|
a53fbbed
Renato De Donato
select-dataset ne...
|
53
54
55
|
app-toolbar {
background-color: var(--google-green-700);
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.3);
|
eb240478
Luigi Serra
public room cards...
|
56
|
font-weight: bold;
|
a53fbbed
Renato De Donato
select-dataset ne...
|
57
|
color: white;
|
eb240478
Luigi Serra
public room cards...
|
58
|
z-index: 1;
|
a53fbbed
Renato De Donato
select-dataset ne...
|
59
60
61
62
|
position: fixed;
top: 0;
left: 0;
right: 0;
|
abeb4a17
Luigi Serra
Update components...
|
63
64
|
}
|
a53fbbed
Renato De Donato
select-dataset ne...
|
65
|
app-toolbar paper-icon-button {
|
eb240478
Luigi Serra
public room cards...
|
66
67
68
69
|
--paper-icon-button-ink-color: white;
}
iron-list {
|
a53fbbed
Renato De Donato
select-dataset ne...
|
70
|
padding-top: 64px;
|
eb240478
Luigi Serra
public room cards...
|
71
72
73
74
75
76
77
|
--iron-list-items-container: {
max-width: 800px;
margin: auto;
margin-top: 60px;
margin-bottom: 60px;
border-bottom: 1px solid #ddd;
};
|
abeb4a17
Luigi Serra
Update components...
|
78
79
80
|
}
.item {
|
abeb4a17
Luigi Serra
Update components...
|
81
|
@apply(--layout-horizontal);
|
eb240478
Luigi Serra
public room cards...
|
82
83
84
|
padding: 20px;
background-color: white;
border: 1px solid #ddd;
|
eb240478
Luigi Serra
public room cards...
|
85
86
87
88
|
cursor: pointer;
margin-bottom: 10px;
}
|
abeb4a17
Luigi Serra
Update components...
|
89
90
91
92
93
|
.avatar {
height: 40px;
width: 40px;
border-radius: 20px;
box-sizing: border-box;
|
abeb4a17
Luigi Serra
Update components...
|
94
95
96
97
98
99
100
101
102
103
104
|
background-color: #DDD;
}
.pad {
padding: 0 16px;
@apply(--layout-flex);
@apply(--layout-vertical);
}
.primary {
font-size: 16px;
|
eb240478
Luigi Serra
public room cards...
|
105
|
font-weight: bold;
|
abeb4a17
Luigi Serra
Update components...
|
106
107
|
}
|
eb240478
Luigi Serra
public room cards...
|
108
|
.shortText, .longText {
|
abeb4a17
Luigi Serra
Update components...
|
109
110
111
|
font-size: 14px;
}
|
eb240478
Luigi Serra
public room cards...
|
112
|
.longText {
|
abeb4a17
Luigi Serra
Update components...
|
113
|
color: gray;
|
eb240478
Luigi Serra
public room cards...
|
114
|
display: none;
|
abeb4a17
Luigi Serra
Update components...
|
115
116
|
}
|
eb240478
Luigi Serra
public room cards...
|
117
118
119
|
.item:hover .shortText::after {
content: ' [+]';
color: gray;
|
abeb4a17
Luigi Serra
Update components...
|
120
121
|
}
|
eb240478
Luigi Serra
public room cards...
|
122
123
|
.item.expanded:hover .shortText::after {
content: '';
|
abeb4a17
Luigi Serra
Update components...
|
124
125
|
}
|
eb240478
Luigi Serra
public room cards...
|
126
127
128
|
.item.expanded .longText {
display: block;
}
|
abeb4a17
Luigi Serra
Update components...
|
129
|
|
eb240478
Luigi Serra
public room cards...
|
130
131
132
|
.item.expanded:hover .longText::after {
content: ' [–]';
}
|
a53fbbed
Renato De Donato
select-dataset ne...
|
133
134
135
136
137
138
139
140
141
142
|
.spacer {
@apply(--layout-flex);
}
@media (max-width: 460px) {
paper-toolbar .bottom.title {
font-size: 14px;
}
}
|
eb240478
Luigi Serra
public room cards...
|
143
|
</style>
|
a53fbbed
Renato De Donato
select-dataset ne...
|
144
|
|
eb240478
Luigi Serra
public room cards...
|
145
|
<iron-ajax url="data/contacts.json" last-response="{{items}}" auto></iron-ajax>
|
a53fbbed
Renato De Donato
select-dataset ne...
|
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
|
<app-toolbar>
<div title>Collapsable items</div>
<paper-icon-button icon="search" alt="Search"></paper-icon-button>
<paper-icon-button icon="more-vert" alt="More options"></paper-icon-button>
</app-toolbar>
<iron-list id="list" items="[[items]]" as="item" selection-enabled multi-selection>
<template>
<div>
<div class$="[[getClassForItem(item, selected)]]" tabindex$="[[tabIndex]]">
<iron-image class="avatar" sizing="contain" src="[[item.image]]"></iron-image>
<div class="pad">
<div class="primary">[[item.name]]</div>
<div class="shortText">[[item.shortText]]</div>
<div class="longText">[[item.longText]]</div>
|
abeb4a17
Luigi Serra
Update components...
|
162
|
</div>
|
a53fbbed
Renato De Donato
select-dataset ne...
|
163
|
<iron-icon icon$="[[iconForItem(item)]]"></iron-icon>
|
abeb4a17
Luigi Serra
Update components...
|
164
|
</div>
|
a53fbbed
Renato De Donato
select-dataset ne...
|
165
166
167
168
|
</div>
</template>
</iron-list>
|
eb240478
Luigi Serra
public room cards...
|
169
|
</template>
|
a53fbbed
Renato De Donato
select-dataset ne...
|
170
|
|
abeb4a17
Luigi Serra
Update components...
|
171
|
<script>
|
a53fbbed
Renato De Donato
select-dataset ne...
|
172
173
174
|
HTMLImports.whenReady(function() {
|
abeb4a17
Luigi Serra
Update components...
|
175
|
Polymer({
|
eb240478
Luigi Serra
public room cards...
|
176
|
is: 'x-collapse',
|
a53fbbed
Renato De Donato
select-dataset ne...
|
177
|
|
eb240478
Luigi Serra
public room cards...
|
178
|
properties: {
|
a53fbbed
Renato De Donato
select-dataset ne...
|
179
|
|
eb240478
Luigi Serra
public room cards...
|
180
181
182
|
items: {
type: Array
}
|
eb240478
Luigi Serra
public room cards...
|
183
|
|
a53fbbed
Renato De Donato
select-dataset ne...
|
184
|
},
|
eb240478
Luigi Serra
public room cards...
|
185
|
|
a53fbbed
Renato De Donato
select-dataset ne...
|
186
187
188
|
attached: function() {
// Use the document element
this.$.list.scrollTarget = this.ownerDocument.documentElement;
|
eb240478
Luigi Serra
public room cards...
|
189
|
},
|
abeb4a17
Luigi Serra
Update components...
|
190
191
192
|
iconForItem: function(item) {
return item ? (item.integer < 50 ? 'star-border' : 'star') : '';
|
eb240478
Luigi Serra
public room cards...
|
193
|
},
|
abeb4a17
Luigi Serra
Update components...
|
194
|
|
a53fbbed
Renato De Donato
select-dataset ne...
|
195
196
|
getClassForItem: function(item, selected) {
return selected ? 'item expanded' : 'item';
|
eb240478
Luigi Serra
public room cards...
|
197
|
}
|
a53fbbed
Renato De Donato
select-dataset ne...
|
198
|
|
abeb4a17
Luigi Serra
Update components...
|
199
|
});
|
a53fbbed
Renato De Donato
select-dataset ne...
|
200
|
|
eb240478
Luigi Serra
public room cards...
|
201
|
});
|
a53fbbed
Renato De Donato
select-dataset ne...
|
202
|
|
abeb4a17
Luigi Serra
Update components...
|
203
|
</script>
|
eb240478
Luigi Serra
public room cards...
|
204
|
</dom-module>
|
abeb4a17
Luigi Serra
Update components...
|
205
|
|
eb240478
Luigi Serra
public room cards...
|
206
|
<x-collapse></x-collapse>
|
abeb4a17
Luigi Serra
Update components...
|
207
208
209
|
</body>
</html>
|