blob: 7fb998b65b0b1be6c8498d0377c6d99474b0b0eb [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="../../../bower_components/iron-autogrow-textarea/iron-autogrow-textarea.html">
<link rel="import" href="../../../bower_components/iron-selector/iron-selector.html">
<link rel="import" href="../../../behaviors/rest-client-behavior.html">
<link rel="import" href="../../shared/gr-button/gr-button.html">
<link rel="import" href="../../shared/gr-rest-api-interface/gr-rest-api-interface.html">
<dom-module id="gr-reply-dialog">
<template>
<style>
:host {
display: block;
max-height: 90vh;
}
:host([disabled]) {
pointer-events: none;
}
:host([disabled]) .container {
opacity: .5;
}
.container {
display: flex;
flex-direction: column;
max-height: 90vh;
}
section {
border-top: 1px solid #ddd;
padding: .5em .75em;
}
.labelsContainer,
.actionsContainer {
flex-shrink: 0;
}
.textareaContainer {
position: relative;
display: flex;
}
iron-autogrow-textarea {
padding: 0;
font-family: var(--monospace-font-family);
}
.message {
border: none;
width: 100%;
}
.labelsNotShown {
color: #666;
}
.labelContainer:not(:first-of-type) {
margin-top: .5em;
}
.labelName {
display: inline-block;
min-width: 7em;
margin-right: .5em;
white-space: nowrap;
}
iron-selector {
display: inline-flex;
}
iron-selector > gr-button {
margin-right: .25em;
}
iron-selector > gr-button:first-of-type {
border-top-left-radius: 2px;
border-bottom-left-radius: 2px;
}
iron-selector > gr-button:last-of-type {
border-top-right-radius: 2px;
border-bottom-right-radius: 2px;
}
iron-selector > gr-button.iron-selected {
background-color: #ddd;
}
.draftsContainer {
overflow-y: auto;
}
.draftsContainer h3 {
margin-top: .25em;
}
.actionsContainer {
display: flex;
justify-content: space-between;
}
.action:link,
.action:visited {
color: #00e;
}
</style>
<div class="container">
<section class="textareaContainer">
<iron-autogrow-textarea
id="textarea"
class="message"
placeholder="Say something..."
disabled="{{disabled}}"
rows="4"
max-rows="15"
bind-value="{{draft}}"></iron-autogrow-textarea>
</section>
<section class="labelsContainer">
<template is="dom-if" if="[[_computeShowLabels(patchNum, revisions)]]">
<template is="dom-repeat"
items="[[_computeLabelArray(permittedLabels)]]" as="label">
<div class="labelContainer">
<span class="labelName">[[label]]</span>
<iron-selector data-label$="[[label]]"
selected="[[_computeIndexOfLabelValue(labels, permittedLabels, label, _account)]]">
<template is="dom-repeat"
items="[[_computePermittedLabelValues(permittedLabels, label)]]"
as="value">
<gr-button has-tooltip data-value$="[[value]]"
title$="[[_computeLabelValueTitle(labels, label, value)]]">[[value]]</gr-button>
</template>
</iron-selector>
</div>
</template>
</template>
<template is="dom-if" if="[[!_computeShowLabels(patchNum, revisions)]]">
<span class="labelsNotShown">
Labels are not shown because this is not the most recent patch set.
<a href$="/c/[[changeNum]]">Go to the latest patch set.</a>
</span>
</template>
</section>
<section class="draftsContainer" hidden$="[[_computeHideDraftList(diffDrafts)]]">
<h3>[[_computeDraftsTitle(diffDrafts)]]</h3>
<gr-comment-list
comments="[[diffDrafts]]"
change-num="[[changeNum]]"
patch-num="[[patchNum]]"></gr-comment-list>
</section>
<section class="actionsContainer">
<gr-button primary class="action send" on-tap="_sendTapHandler">Send</gr-button>
<gr-button class="action cancel" on-tap="_cancelTapHandler">Cancel</gr-button>
</section>
</div>
<gr-rest-api-interface id="restAPI"></gr-rest-api-interface>
</template>
<script src="gr-reply-dialog.js"></script>
</dom-module>