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