Index: Tools/GardeningServer/ui/ct-commit-list.html |
diff --git a/Tools/GardeningServer/ui/ct-commit-list.html b/Tools/GardeningServer/ui/ct-commit-list.html |
index 6ff19411001d97a75351606affa88d8304cde383..2552d509d9d3341245240f5eabad7fd4df0be3c7 100644 |
--- a/Tools/GardeningServer/ui/ct-commit-list.html |
+++ b/Tools/GardeningServer/ui/ct-commit-list.html |
@@ -5,49 +5,60 @@ found in the LICENSE file. |
--> |
<link rel="import" href="ct-commit.html"> |
+<link rel="import" href="../bower_components/paper-button/paper-button.html"> |
-<polymer-element name="ct-commit-list" attributes="first last commits" noscript> |
+<polymer-element name="ct-commit-list" attributes="commits" noscript> |
<template> |
<style> |
:host { |
display: block; |
} |
+ paper-icon-button { |
+ vertical-align: middle; |
+ } |
+ .repository-info { |
+ display: block; |
+ } |
</style> |
- <template repeat="{{ repository in commits.commits | _repositories }}"> |
- <template repeat="{{ commit in repository | _commits }}"> |
- <ct-commit data="{{ commit }}"></ct-commit> |
- </template> |
+ <template repeat="{{ repository in commitList | _repositories }}"> |
+ <div class="repository-info"> |
+ {{ repository.name }} {{ repository.range }} |
+ <paper-icon-button icon="more-vert" |
ojan
2014/08/15 17:51:49
Nit: use unfold-more instead of more-vert to be co
dsinclair
2014/08/15 18:58:34
Done.
|
+ on-click="{{ _expand }}" repositoryName="{{ repository.name }}" repositoryRange="{{ repository.range }}"></paper-icon-button> |
+ <template if="{{ repository.expanded }}"> |
+ <template repeat="{{ commit in repository.commits }}"> |
+ <ct-commit data="{{ commit }}"></ct-commit> |
+ </template> |
+ </template> |
+ </div> |
</template> |
</template> |
<script> |
- Polymer({ |
- commits: null, |
- first: null, |
- last: null, |
+ Polymer({ |
+ repositories: undefined, |
- _repositories: function(commits) { |
- if (!commits) |
- return []; |
- return Object.keys(commits).sort(); |
- }, |
+ created: function() { |
+ this.repositories = []; |
+ }, |
- _commits: function(repository) { |
- var commits = []; |
- if (!this.first || !this.last) |
- return commits; |
+ _repositories: function() { |
+ if (this.commitList) |
+ this.repositories = this.commitList.repositories(); |
+ return this.repositories; |
+ }, |
- var first = Number(this.first[repository]); |
- var last = Number(this.last[repository]); |
- if (first == last) |
- return commits; |
+ _expand: function(event, detail, sender, target) { |
ojan
2014/08/15 17:51:50
Maybe call this _toggle?
dsinclair
2014/08/15 18:58:34
Done.
|
+ var repo = sender.getAttribute('repositoryName'); |
+ var range = sender.getAttribute('repositoryRange'); |
ojan
2014/08/15 17:51:49
Do sender.repositoryName/sender.repositoryRange no
dsinclair
2014/08/15 18:58:34
That doesn't seem to work in this case? I can neve
|
- if (first > last) { |
- console.warn('Revision range is backwards, which is invalid:', first, last); |
- return commits; |
+ for(var i = 0; i < this.repositories.length; i++) { |
ojan
2014/08/15 17:51:49
Missing space after "for". Also, if you wanted you
dsinclair
2014/08/15 18:58:34
Done.
Don't need to check range, that was a hold-
|
+ var r = this.repositories[i]; |
+ if (r.name === repo && r.range === range) { |
+ r.expanded = !r.expanded; |
+ break; |
} |
- |
- return this.commits.range(repository, first + 1, last); |
- }, |
- }); |
+ } |
+ } |
+ }); |
</script> |
</polymer-element> |