PolyGerrit: introduce gr-account-chip which supports a remove button.
Bug: Issue 3917 Change-Id: Ibe4d62786b0625bad34e651b715a2085c4a2da52
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<!--
|
||||
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">
|
||||
<link rel="import" href="../gr-account-link/gr-account-link.html">
|
||||
<link rel="import" href="../gr-button/gr-button.html">
|
||||
|
||||
<dom-module id="gr-account-chip">
|
||||
<template>
|
||||
<style>
|
||||
:host {
|
||||
display: inline-block;
|
||||
background: #ccc;
|
||||
border-radius: .75em;
|
||||
}
|
||||
span.innerspan {
|
||||
margin: .5em;
|
||||
}
|
||||
gr-button.remove {
|
||||
padding: 0;
|
||||
text-decoration: none;
|
||||
background: #ccc;
|
||||
}
|
||||
</style>
|
||||
<span class="innerspan">
|
||||
<gr-account-link account="[[account]]"></gr-account-link>
|
||||
<gr-button
|
||||
hidden$="[[!removable]]" hidden
|
||||
class="remove" on-tap="_handleRemoveTap">×</gr-button>
|
||||
</span>
|
||||
</template>
|
||||
<script src="gr-account-chip.js"></script>
|
||||
</dom-module>
|
||||
@@ -0,0 +1,34 @@
|
||||
// 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.
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
Polymer({
|
||||
is: 'gr-account-chip',
|
||||
|
||||
properties: {
|
||||
account: Object,
|
||||
removable: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
},
|
||||
|
||||
_handleRemoveTap: function(e) {
|
||||
e.preventDefault();
|
||||
this.fire('remove', {account: this.account}, {bubbles: false});
|
||||
},
|
||||
});
|
||||
})();
|
||||
Reference in New Issue
Block a user