OLD | NEW |
---|---|
1 <!-- | 1 <!-- |
2 Copyright 2014 The Chromium Authors. All rights reserved. | 2 Copyright 2014 The Chromium Authors. All rights reserved. |
3 Use of this source code is governed by a BSD-style license that can be | 3 Use of this source code is governed by a BSD-style license that can be |
4 found in the LICENSE file. | 4 found in the LICENSE file. |
5 --> | 5 --> |
6 | 6 |
7 <link rel="import" href="ct-commit.html"> | 7 <link rel="import" href="ct-commit.html"> |
8 <link rel="import" href="ct-commit-data.html"> | |
9 | 8 |
10 <polymer-element name="ct-commit-list" attributes="first last" noscript> | 9 <polymer-element name="ct-commit-list" attributes="first last commits" noscript> |
11 <template> | 10 <template> |
12 <style> | 11 <style> |
13 :host { | 12 :host { |
14 display: block; | 13 display: block; |
15 } | 14 } |
16 </style> | 15 </style> |
17 <ct-commit-data first="{{first}}" last="{{last}}" data="{{commitData}}"></ct -commit-data> | 16 <template repeat="{{revision in _revisions}}"> |
18 <template repeat="{{commit in commitData}}"> | 17 <template if="{{commits[revision]}}"> |
19 <ct-commit data="{{commit}}"></ct-commit> | 18 <ct-commit data="{{commits[revision]}}"></ct-commit> |
19 </template> | |
20 </template> | 20 </template> |
21 </template> | 21 </template> |
22 <script> | |
23 Polymer({ | |
24 commits: {}, | |
25 first: 0, | |
26 last: 0, | |
27 _revisions: [], | |
28 | |
29 observe: { | |
30 first: '_update', | |
31 last: '_update', | |
32 }, | |
33 | |
34 _update: function() { | |
35 if (!this.first || !this.last) | |
36 return; | |
37 | |
38 this._revisions = []; | |
39 for (var i = this.first; i <= this.last; i++) | |
40 this._revisions.push(i); | |
abarth-chromium
2014/07/21 06:36:27
There's no better way in sugar to do this? Looks
ojan
2014/07/21 19:58:04
Heh. I felt silly writing this code. I'm not sure
esprehn
2014/07/21 20:11:07
every returns an array, ex Number.range(2, 8).ever
| |
41 }, | |
42 }); | |
43 </script> | |
22 </polymer-element> | 44 </polymer-element> |
OLD | NEW |