| <!-- The <commits-dialog-sk> custom element declaration. |
| |
| An element to display information on one or more commits. |
| |
| Listens for 'show-commits' events on it's parent element and then displays |
| the info it receives in each event. Relies upon e.detail containing a |
| serialized slice of types.Commit that could have made up that dot. |
| |
| Attributes: |
| None. |
| |
| Events: |
| None. |
| |
| Methods: |
| setCommitInfo(commitinfo) - Where commitinfo is an array of objects of the form: |
| |
| { |
| author: "foo@example.org" |
| commit_time: 1428574804 |
| hash: "d9f8862ab6bed4195cbfe5dda48693e1062b01e2" |
| } |
| --> |
| |
| <link rel="import" href="bower_components/polymer/polymer.html"> |
| <link rel="import" href="bower_components/paper-dialog/paper-dialog.html"> |
| <link rel="import" href="../common/imp/commit-panel.html" /> |
| |
| <dom-module id="commits-dialog-sk"> |
| <template> |
| <style include="shared-styles"> |
| #commitsDialog { |
| position: fixed; |
| bottom: 1em; |
| right: 1em; |
| } |
| </style> |
| <paper-dialog id="commitsDialog"> |
| |
| <h1>Commit(s)</h1> |
| <commits-panel-sk id="commitsPanel" repo="{{_repo}}" origin></commits-panel-sk> |
| <div class="buttons"> |
| <paper-button raised dialog-dismiss>Close</paper-button> |
| </div> |
| </paper-dialog> |
| </template> |
| <script> |
| Polymer({ |
| is: 'commits-dialog-sk', |
| |
| properties:{ |
| _repo: { |
| type: String, |
| value: sk.app_config.baseRepoURL |
| } |
| }, |
| |
| attached: function () { |
| this.listen(this.parentElement, 'show-commits', '_handleCommitSelected'); |
| this.listen(this.$.commitsPanel, 'commits-loaded', '_handleCommitsLoaded'); |
| |
| // this.$.commitsDialog.positionTarget = document.body; |
| }, |
| |
| _handleCommitSelected: function(ev) { |
| ev.stopPropagation(); |
| this.setCommitInfo(ev.detail); |
| }, |
| |
| setCommitInfo: function(commitInfo) { |
| if (this.$.commitsDialog.opened) { |
| this.$.commitsDialog.close(); |
| } |
| this.$.commitsPanel.setCommitInfo(commitInfo); |
| }, |
| |
| _handleCommitsLoaded: function(ev) { |
| this.$.commitsDialog.open(); |
| } |
| }); |
| </script> |
| </dom-module> |