blob: 343f7d3bf9cf836f17c706d0b2ea57d2d7f46523 [file] [log] [blame]
<!--
Copyright (C) 2015 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<link rel="import" href="../bower_components/polymer/polymer.html">
<link rel="import" href="gr-date-formatter.html">
<dom-module id="gr-diff-comment">
<template>
<style>
:host {
border: 1px solid #ddd;
display: block;
}
.header,
.message,
.actions {
padding: .5em .7em;
}
.header {
background-color: #eee;
font-family: 'Open Sans', sans-serif;
}
gr-date-formatter {
float: right;
margin-left: 5px;
}
.authorName {
font-weight: bold;
}
.message {
white-space: pre-wrap;
}
.actions {
/** TODO: remove once the actions actually do something. **/
display: none;
padding-top: 0;
}
</style>
<div class="header" id="header">
<span class="authorName">[[comment.author.name]]</span>
<gr-date-formatter date-str="[[comment.updated]]"></gr-date-formatter>
</div>
<div class="message">[[comment.message]]</div>
<div class="actions">
<a class="reply" href="#" on-tap="_handleReply">Reply</a>
<a class="done" href="#" on-tap="_handleDone">Done</a>
</div>
</template>
<script>
(function() {
'use strict';
Polymer({
is: 'gr-diff-comment',
/**
* Fired when the height of the comment changes.
*
* @event gr-diff-comment-height-changed
*/
/**
* Fired when the Reply action is triggered.
*
* @event gr-diff-comment-reply
*/
/**
* Fired when the Done action is triggered.
*
* @event gr-diff-comment-done
*/
properties: {
comment: Object,
draft: {
type: Boolean,
value: false,
},
},
attached: function() {
this.fire('gr-diff-comment-height-changed',
{height: this.offsetHeight});
},
_handleReply: function(e) {
e.preventDefault();
this.fire('gr-diff-comment-reply');
},
_handleDone: function(e) {
e.preventDefault();
this.fire('gr-diff-comment-done');
},
});
})();
</script>
</dom-module>