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..740540585199f21454c7fdb60e791c99d24a7569 100644 |
--- a/Tools/GardeningServer/ui/ct-commit-list.html |
+++ b/Tools/GardeningServer/ui/ct-commit-list.html |
@@ -5,6 +5,7 @@ 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> |
<template> |
@@ -12,10 +13,36 @@ found in the LICENSE file. |
:host { |
display: block; |
} |
+ paper-button[repository] { |
+ margin: .5em; |
+ text-transform: lowercase; |
+ } |
+ repository-info { |
+ display: block; |
+ } |
+ commit-list { |
+ display: none; |
+ padding-left: 1em; |
+ padding-right: 1em; |
+ } |
+ commit-list[visible="true"] { |
+ display: block; |
+ } |
</style> |
<template repeat="{{ repository in commits.commits | _repositories }}"> |
- <template repeat="{{ commit in repository | _commits }}"> |
- <ct-commit data="{{ commit }}"></ct-commit> |
+ <template if="{{ !_repositoryEmpty(repository) }}"> |
+ <repository-info> |
ojan
2014/08/06 23:45:55
It's kinda weird to define new elements that are n
dsinclair
2014/08/12 01:11:19
Done.
|
+ <paper-button raisedbutton role="button" |
ojan
2014/08/06 23:45:55
I'm sensitive to taking up too much screen real es
dsinclair
2014/08/12 01:11:20
I dropped the button and went with text and an arr
|
+ label="{{ repository }} {{ _range(repository) }}" |
+ on-click="{{ _toggleRepository }} " |
+ repository="{{ repository + _range(repository) }}"></paper-button> |
+ |
+ <commit-list visible="{{ repositoryVisible[repository + _range(repository)] }}"> |
ojan
2014/08/06 23:45:55
Use <template if> instead of attribute + display.
dsinclair
2014/08/12 01:11:19
Done.
|
+ <template repeat="{{ commit in repository | _commits }}"> |
+ <ct-commit data="{{ commit }}"></ct-commit> |
+ </template> |
+ </commit-list> |
+ </repository-info> |
</template> |
</template> |
</template> |
@@ -25,6 +52,13 @@ found in the LICENSE file. |
first: null, |
last: null, |
+ // FIXME: This is a hack. This hash ends up being shared between all of the |
+ // elements of this type. We name the repos above with name and commit |
+ // information to tell them apart. If we don't make this 'global' we |
+ // end up losing the expansion information when we refresh the failure |
+ // list. |
ojan
2014/08/06 23:45:55
TL;DR: I think it's worth the effort to fix the un
dsinclair
2014/08/12 01:11:19
Acknowledged.
|
+ repositoryVisible: {}, |
+ |
_repositories: function(commits) { |
if (!commits) |
return []; |
@@ -48,6 +82,22 @@ found in the LICENSE file. |
return this.commits.range(repository, first + 1, last); |
}, |
+ |
+ _repositoryEmpty: function(repository) { |
+ return this._commits(repository).length === 0; |
+ }, |
+ |
+ _range: function(repository) { |
+ var commits = this._commits(repository); |
+ if (commits.length === 0) |
+ return ""; |
+ return commits[0].revision + " : " + commits[commits.length - 1].revision; |
ojan
2014/08/06 23:45:55
Nit: sugarjs has first() and last() on array.
dsinclair
2014/08/12 01:11:19
Done.
|
+ }, |
+ |
+ _toggleRepository: function(event, detail, sender, target) { |
+ var repoName = sender.getAttribute('repository'); |
+ this.repositoryVisible[repoName] = !this.repositoryVisible[repoName]; |
+ } |
}); |
</script> |
</polymer-element> |