TODO in follow-up change + Autocomplete revisions/change numbers from the input + Consolidate button classes (it’s enough repeated code that it’s becomming a nuisance). + Perhaps move confirmation dialog functions into a behavior. Change-Id: I382cc63591cd537dbe1d29a0451f392c1e77f287
98 lines
2.3 KiB
HTML
98 lines
2.3 KiB
HTML
<!--
|
|
Copyright (C) 2016 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">
|
|
|
|
<dom-module id="gr-confirm-dialog">
|
|
<template>
|
|
<style>
|
|
:host {
|
|
display: block;
|
|
}
|
|
.header {
|
|
border-bottom: 1px solid #ddd;
|
|
font-weight: bold;
|
|
}
|
|
.header,
|
|
.mainContent,
|
|
.footer {
|
|
padding: .5em .65em;
|
|
}
|
|
.footer {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
}
|
|
button {
|
|
background-color: #f1f2f3;
|
|
border: 1px solid #aaa;
|
|
border-radius: 2px;
|
|
cursor: pointer;
|
|
font: inherit;
|
|
padding: .5em .75em;
|
|
}
|
|
.confirm {
|
|
background-color: #448aff;
|
|
border-color: #448aff;
|
|
color: #fff;
|
|
}
|
|
</style>
|
|
<div class="header"><content select=".header"></content></div>
|
|
<div class="mainContent"><content select=".main"></content></div>
|
|
<div class="footer">
|
|
<button class="confirm" on-tap="_handleConfirmTap">[[confirmLabel]]</button>
|
|
<button class="cancel" on-tap="_handleCancelTap">Cancel</button>
|
|
</div>
|
|
</template>
|
|
<script>
|
|
(function() {
|
|
'use strict';
|
|
|
|
Polymer({
|
|
is: 'gr-confirm-dialog',
|
|
|
|
/**
|
|
* Fired when the confirm button is pressed.
|
|
*
|
|
* @event confirm
|
|
*/
|
|
|
|
/**
|
|
* Fired when the cancel button is pressed.
|
|
*
|
|
* @event cancel
|
|
*/
|
|
|
|
properties: {
|
|
confirmLabel: {
|
|
type: String,
|
|
value: 'Confirm',
|
|
}
|
|
},
|
|
|
|
_handleConfirmTap: function(e) {
|
|
e.preventDefault();
|
|
this.fire('confirm', null, {bubbles: false});
|
|
},
|
|
|
|
_handleCancelTap: function(e) {
|
|
e.preventDefault();
|
|
this.fire('cancel', null, {bubbles: false});
|
|
},
|
|
});
|
|
})();
|
|
</script>
|
|
</dom-module>
|