blob: 7a120c071899739195cef5a554ce236c9ccc6cdb [file] [log] [blame]
Andrew Bonventre78792e82016-03-04 17:48:22 -05001// Copyright (C) 2016 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14(function() {
15 'use strict';
16
17 Polymer({
18 is: 'gr-account-link',
19
20 properties: {
21 account: Object,
22 avatarImageSize: {
23 type: Number,
24 value: 32,
25 },
26 },
27
Paladox none8b0d0462017-03-31 14:37:00 +000028 behaviors: [
29 Gerrit.BaseUrlBehavior,
30 ],
31
Kasper Nilsson098c5fe2017-05-15 15:54:56 -070032 _computeOwnerLink(account) {
Andrew Bonventre78792e82016-03-04 17:48:22 -050033 if (!account) { return; }
Logan Hankse6458a22017-08-11 14:41:57 -070034 return Gerrit.Nav.getUrlForOwner(
Paladox nonecc5ffb22017-08-21 09:36:42 +000035 account.email || account.username || account.name ||
36 account._account_id);
Andrew Bonventre78792e82016-03-04 17:48:22 -050037 },
Kasper Nilsson527221a2016-10-07 10:07:04 -070038
Kasper Nilsson098c5fe2017-05-15 15:54:56 -070039 _computeShowEmail(account) {
Kasper Nilsson527221a2016-10-07 10:07:04 -070040 return !!(account && !account.name);
41 },
Andrew Bonventre78792e82016-03-04 17:48:22 -050042 });
43})();