blob: 2a799452ee1f31f84365020d3a904e4fc1eb997c [file] [log] [blame]
Urs Wolfer37525682016-01-22 11:57:10 +01001<!--
2Copyright (C) 2016 The Android Open Source Project
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15-->
16
Wyatt Allen740d8c32017-08-10 16:28:23 -070017<link rel="import" href="../../../behaviors/gr-anonymous-name-behavior/gr-anonymous-name-behavior.html">
Wyatt Allen740d8c32017-08-10 16:28:23 -070018<link rel="import" href="../../../behaviors/gr-tooltip-behavior/gr-tooltip-behavior.html">
Paladox nonecf6bb112017-07-23 18:45:05 +000019<link rel="import" href="../../../bower_components/polymer/polymer.html">
20<link rel="import" href="../../../styles/shared-styles.html">
Andrew Bonventre78792e82016-03-04 17:48:22 -050021<link rel="import" href="../gr-avatar/gr-avatar.html">
Wyatt Allen740d8c32017-08-10 16:28:23 -070022<link rel="import" href="../gr-rest-api-interface/gr-rest-api-interface.html">
Urs Wolfer37525682016-01-22 11:57:10 +010023
24<dom-module id="gr-account-label">
25 <template>
Becky Siegelb159a7f2017-06-01 15:31:55 -070026 <style include="shared-styles">
Urs Wolfer37525682016-01-22 11:57:10 +010027 :host {
28 display: inline;
29 }
Logan Hanks4a3e6b82016-07-19 15:34:37 -070030 :host::after {
31 content: var(--account-label-suffix);
32 }
Urs Wolfer37525682016-01-22 11:57:10 +010033 gr-avatar {
34 height: 1.3em;
35 width: 1.3em;
Andrew Bonventre09c8c242016-02-23 17:28:50 -050036 margin-right: .15em;
37 vertical-align: -.25em;
Urs Wolfer37525682016-01-22 11:57:10 +010038 }
Wyatt Allen740d8c32017-08-10 16:28:23 -070039 .text {
Peter Burnse1e85992017-10-27 12:15:03 -070040 @apply --gr-account-label-text-style;
Wyatt Allen740d8c32017-08-10 16:28:23 -070041 }
Urs Wolfer37525682016-01-22 11:57:10 +010042 .text:hover {
Peter Burnse1e85992017-10-27 12:15:03 -070043 @apply --gr-account-label-text-hover-style;
Urs Wolfer37525682016-01-22 11:57:10 +010044 }
Becky Siegel53df3252017-11-20 13:52:02 -080045 .email,
46 .showEmail .name {
47 display: none;
48 }
49 .showEmail .email {
50 display: inline-block;
51 }
Urs Wolfer37525682016-01-22 11:57:10 +010052 </style>
Wyatt Allen740d8c32017-08-10 16:28:23 -070053 <span>
54 <template is="dom-if" if="[[!hideAvatar]]">
55 <gr-avatar account="[[account]]"
56 image-size="[[avatarImageSize]]"></gr-avatar>
57 </template>
Becky Siegel53df3252017-11-20 13:52:02 -080058 <span class$="text [[_computeShowEmailClass(account)]]">
59 <span class="name">
60 [[_computeName(account, _serverConfig)]]</span>
61 <span class="email">
Kasper Nilsson3e0e0f52016-11-21 13:30:00 -080062 [[_computeEmailStr(account)]]
Urs Wolfer37525682016-01-22 11:57:10 +010063 </span>
Kasper Nilsson3b740452017-02-02 12:13:01 -080064 <template is="dom-if" if="[[account.status]]">
65 <span>([[account.status]])</span>
66 </template>
Urs Wolfer37525682016-01-22 11:57:10 +010067 </span>
68 </span>
Wyatt Allen740d8c32017-08-10 16:28:23 -070069 <gr-rest-api-interface id="restAPI"></gr-rest-api-interface>
Urs Wolfer37525682016-01-22 11:57:10 +010070 </template>
Kasper Nilssonf0f57402016-09-28 14:56:06 -070071 <script src="../../../scripts/util.js"></script>
Andrew Bonventre78792e82016-03-04 17:48:22 -050072 <script src="gr-account-label.js"></script>
Urs Wolfer37525682016-01-22 11:57:10 +010073</dom-module>