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="../bower_components/paper-button/paper-button.html"> | 8 <link rel="import" href="../bower_components/paper-button/paper-button.html"> |
9 | 9 |
10 <polymer-element name="ct-commit-list" attributes="commitList"> | 10 <polymer-element name="ct-commit-list" attributes="commitList"> |
11 <template> | 11 <template> |
12 <style> | 12 <style> |
13 :host { | 13 :host { |
14 display: block; | 14 display: block; |
15 } | 15 } |
16 paper-icon-button { | 16 paper-icon-button { |
17 vertical-align: middle; | 17 vertical-align: middle; |
18 } | 18 } |
19 .repository-info { | 19 .repository-info { |
20 display: block; | 20 display: block; |
21 } | 21 } |
22 </style> | 22 </style> |
23 <template repeat="{{ repository in commitList | _repositories }}"> | 23 <template repeat="{{ repository in commitList.repositories }}"> |
24 <div class="repository-info"> | 24 <div class="repository-info"> |
25 {{ repository.name }} {{ repository.range }} | 25 {{ repository.name }} {{ repository.range }} |
26 <paper-icon-button icon="unfold-more" | 26 <paper-icon-button icon="unfold-more" |
27 on-click="{{ _toggle }}" repository="{{ repository.name }}"></paper-
icon-button> | 27 on-click="{{ _toggle }}" repository="{{ repository.name }}"></paper-
icon-button> |
28 <template if="{{ repository.expanded }}"> | 28 <template if="{{ repository.expanded }}"> |
29 <template repeat="{{ commit in repository.commits }}"> | 29 <template repeat="{{ commit in repository.commits }}"> |
30 <ct-commit data="{{ commit }}"></ct-commit> | 30 <ct-commit data="{{ commit }}"></ct-commit> |
31 </template> | 31 </template> |
32 </template> | 32 </template> |
33 </div> | 33 </div> |
34 </template> | 34 </template> |
35 </template> | 35 </template> |
36 <script> | 36 <script> |
37 Polymer({ | 37 Polymer({ |
38 repositories: undefined, | |
39 | |
40 created: function() { | |
41 this.repositories = []; | |
42 }, | |
43 | |
44 _repositories: function() { | |
45 if (this.commitList) | |
46 this.repositories = this.commitList.repositories(); | |
47 return this.repositories; | |
48 }, | |
49 | |
50 _toggle: function(event, detail, sender, target) { | 38 _toggle: function(event, detail, sender, target) { |
51 var repo = sender.getAttribute('repository'); | 39 var repo = sender.getAttribute('repository'); |
52 var r = this.repositories.find(function(item) { | 40 var r = this.commitList.repositories.find(function(item) { |
53 return item.name === repo; | 41 return item.name === repo; |
54 }); | 42 }); |
55 r.expanded = !r.expanded; | 43 r.expanded = !r.expanded; |
56 } | 44 } |
57 }); | 45 }); |
58 </script> | 46 </script> |
59 </polymer-element> | 47 </polymer-element> |
OLD | NEW |