Skip to content

Commit c84169e

Browse files
committed
Introduce template 'if' and 'repeat'
1 parent 9be8dae commit c84169e

File tree

4 files changed

+37
-0
lines changed

4 files changed

+37
-0
lines changed

auto-history.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
:host {
2+
display: block;
3+
overflow: hidden;
4+
white-space: nowrap;
5+
}

auto-history.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<link rel="import" href="bower_components/polymer/polymer.html">
2+
3+
<polymer-element name="auto-history">
4+
<template>
5+
6+
<link rel="stylesheet" href="auto-history.css">
7+
8+
<template repeat="{{ item, i in history }}">
9+
<span>{{ (i === 0) ? '' : '&bull; ' }}{{ item.innerText }}</span>
10+
</template>
11+
12+
</template>
13+
<script src="auto-history.js"></script>
14+
</polymer-element>

auto-history.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Polymer('auto-history', {
2+
3+
publish: {
4+
track: null
5+
},
6+
7+
created: function() {
8+
this.history = [];
9+
},
10+
11+
trackChanged: function(oldValue, newValue) {
12+
this.history.unshift(newValue);
13+
}
14+
15+
});

filter-by-text-styled.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<link rel="import" href="bower_components/polymer/polymer.html">
22
<link rel="import" href="filter-by-text.html">
3+
<link rel="import" href="auto-history.html">
34

45
<polymer-element name="filter-by-text-styled" extends="filter-by-text" noscript>
56
<template>
@@ -10,5 +11,7 @@
1011

1112
<shadow></shadow>
1213

14+
<auto-history track="{{ selectedItem }}"></auto-history>
15+
1316
</template>
1417
</polymer-element>

0 commit comments

Comments
 (0)