blob: a1f253dd9899f6dd90659fc89c83376307f1bad9 [file] [log] [blame]
<!-- The <commit-picker-sk> custom element declaration.
Attributes:
commit - A serialized types.Commit of the chosen commit. This is null if
no selection has been made.
Events:
commit-selected - Event produced when a commit is selected. The event
detail contains:
{
description: "fixed lengh string descripting the commit",
hash: "1213982193 (the commit hash)",
}
Methods:
selectHash - Forces the selection of the given hash.
Mailboxes:
commits - The sk.Mailbox name to listen for the data to populate
the element. The mailbox data needs to be a serialized slice
of []*types.Commit. If not set then the data must be supplied
by the setCommitInfo method.
[
{
commit_time: 1439649751,
author: "reed (reed@chromium.org)",
hash: "bb886749feb444edfd8fbf053a9ea815e3605f8a",
},
{
author: "reed (reed@chromium.org)",
commit_time: 1439648914,
hash: "e02716908fe82c7c4ae9b415793277620a22bcd6",
},
]
Note that the hashes need to be in order, but not necessarily
contiguous. Note that they also need to be supplied in time ascending
order, that is, the commit at index 0 needs to be the oldest commit, and
the last commit in the array needs to be the newest commit.
-->
<link rel="stylesheet" href="/res/common/css/md.css">
<link rel="import" href="commit-panel.html">
<link rel="import" href="/res/imp/bower_components/paper-dialog/paper-dialog.html">
<link rel="import" href="/res/imp/bower_components/paper-dialog-scrollable/paper-dialog-scrollable.html">
<dom-module id="commit-picker-sk">
<style>
</style>
<template>
<button class=raised id=select><pre id=desc>Select a commit</pre></button>
<paper-dialog id=dialog>
<paper-dialog-scrollable>
<commits-panel-sk id=panel selection></commits-panel-sk>
</paper-dialog-scrollable>
<div class=buttons>
<button dialog-confirm>Close</button>
</div>
</paper-dialog>
</template>
</dom-module>
<script>
Polymer({
is: "commit-picker-sk",
properties: {
commit: {
type: Object,
value: null,
},
},
listeners: {
"select.tap": "_selectTap",
"panel.commit-selected": "_panelSelect",
},
selectHash: function(hash) {
this.$.panel.selectHash(hash);
},
_selectTap: function() {
this.$.dialog.open();
},
_panelSelect: function(e) {
this.$.desc.textContent = e.detail.description;
this.commit = e.detail.commit;
},
});
</script>