Chromium Code Reviews| 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 | 8 |
| 9 <polymer-element name="ct-commit-list" attributes="first last commits" noscript> | 9 <polymer-element name="ct-commit-list" attributes="first last commits" noscript> |
| 10 <template> | 10 <template> |
| 11 <style> | 11 <style> |
| 12 :host { | 12 :host { |
| 13 display: block; | 13 display: block; |
| 14 } | 14 } |
| 15 </style> | 15 </style> |
| 16 <template repeat="{{revision in _revisions}}"> | 16 <template repeat="{{ repository in commits.commits | _repositories }}"> |
| 17 <template if="{{commits[revision]}}"> | 17 <template repeat="{{ commit in repository | _commits }}"> |
|
abarth-chromium
2014/07/29 16:22:26
Do we want any sort of visual separation between c
ojan
2014/07/30 04:14:33
Probably. I was punting on making the UI nice for
| |
| 18 <ct-commit data="{{commits[revision]}}"></ct-commit> | 18 <ct-commit data="{{ commit }}"></ct-commit> |
| 19 </template> | 19 </template> |
| 20 </template> | 20 </template> |
| 21 </template> | 21 </template> |
| 22 <script> | 22 <script> |
| 23 Polymer({ | 23 Polymer({ |
| 24 commits: {}, | 24 commits: null, |
| 25 first: 0, | 25 first: null, |
| 26 last: 0, | 26 last: null, |
| 27 _revisions: [], | |
| 28 | 27 |
| 29 observe: { | 28 _repositories: function(commits) { |
| 30 first: '_update', | 29 if (!commits) |
| 31 last: '_update', | 30 return []; |
| 31 return Object.keys(commits).sort(); | |
| 32 }, | 32 }, |
| 33 | 33 |
| 34 _update: function() { | 34 _commits: function(repository) { |
| 35 var commits = []; | |
| 35 if (!this.first || !this.last) | 36 if (!this.first || !this.last) |
| 36 return; | 37 return commits; |
| 37 this._revisions = Number.range(this.first, this.last).every(); | 38 |
| 39 var first = Number(this.first[repository]); | |
| 40 var last = Number(this.last[repository]); | |
| 41 if (first == last) | |
| 42 return commits; | |
| 43 | |
| 44 if (first > last) { | |
| 45 console.warn('Revision range is backwards, which is invalid:', first, last); | |
| 46 return commits; | |
| 47 } | |
| 48 | |
| 49 return this.commits.range(repository, first + 1, last); | |
| 38 }, | 50 }, |
| 39 }); | 51 }); |
| 40 </script> | 52 </script> |
| 41 </polymer-element> | 53 </polymer-element> |
| OLD | NEW |