blob: 72e6e40b9a7845a8d88049ad8de7641328b931a4 [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.
repo - The URL of the underlying git repo. This assumes a
googlesource repo when deriving URLs from this value.
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.
setCommitInfo(commitinfo) - Where commitinfo is an array of objects of the form:
{
author: "foo@example.org"
commit_time: 1428574804
hash: "d9f8862ab6bed4195cbfe5dda48693e1062b01e2"
}
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 repo="[[repo]]" 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,
},
repo: {
type: String,
value: "https://skia.googlesource.com/skia",
notify: true
},
},
listeners: {
"select.tap": "_selectTap",
"panel.commit-selected": "_panelSelect",
},
selectHash: function(hash) {
this.$.panel.selectHash(hash);
},
setCommitInfo: function(commits) {
this.$.panel.setCommitInfo(commits);
},
_selectTap: function() {
this.$.dialog.open();
},
_panelSelect: function(e) {
this.$.desc.textContent = e.detail.description;
this.commit = e.detail.commit;
},
});
</script>